Інструмент аналізу ризику
Проведення аналізу ризику
Aspose.tasks для .NET API підтримує проведення аналізу ризиків у файлі даних проекту. Це ґрунтується на моделюванні Монте -Карло, яке підтримує різні розподіли і кореляцій ймовірності. Aspose.tasks.riskanalysis.riskanalyzer клас може бути використаний для проведення аналізу ризику, який базується на графіку проекту (тривалість завдань та їх дати початку/закінчення). Отже, дата закінчення проекту може бути результатом такого аналізу. Наступний приклад ілюструє цю функціональність поетапно.
Проведення аналізу ризику
Налаштування аналізу аналізу
1RiskAnalysisSettings settings = new RiskAnalysisSettings();
2
3// Set number of iterations for Monte Carlo simulation (the default value is 100).
4settings.IterationsCount = 200;
Identifying the Input of Analysis
1Project project = new Project("New Project.mpp");
2Task task = project.RootTask.Children.GetById(17);
3
4// Initialize a risk pattern
5RiskPattern pattern = new RiskPattern(task);
6
7// Select a distribution type for the random number generator to generate possible values from (only two types currently supported, namely normal and uniform)
8// For more details see here: https://en.wikipedia.org/wiki/Normal_distribution)
9pattern.Distribution = ProbabilityDistributionType.Normal;
10
11// Set the percentage of the most likely task duration which can happen in the best possible project scenario
12// The default value is 75, which means that if the estimated specified task duration is 4 days then the optimistic duration will be 3 days
13pattern.Optimistic = 70;
14
15// Set the percentage of the most likely task duration which can happen in the worst possible project scenario
16// The default value is 125, which means that if the estimated specified task duration is 4 days then the pessimistic duration will be 5 days.
17pattern.Pessimistic = 130;
18
19// Set a confidence level that correspond to the percentage of the time the actual values will be within optimistic and pessimistic estimates.
20// You can think of it as a value of standard deviation: the more uncertain about your estimates you are, the more the value of standard deviation used in random number generator is
21pattern.ConfidenceLevel = ConfidenceLevel.CL75;
22
23settings.Patterns.Add(pattern);
1// Analyze the project risks
2RiskAnalyzer analyzer = new RiskAnalyzer(settings);
3RiskAnalysisResult analysisResult = analyzer.Analyze(project);
Use the Results of the Analysis
1// Select the desired output (here we get early finish of the root task)
2RiskItemStatistics rootEarlyFinish = analysisResult.GetRiskItems(RiskItemType.EarlyFinish).Get(project.RootTask);
3Console.WriteLine("Expected value: {0}", rootEarlyFinish.ExpectedValue);
4Console.WriteLine("StandardDeviation: {0}", rootEarlyFinish.StandardDeviation);
5Console.WriteLine("10% Percentile: {0}", rootEarlyFinish.GetPercentile(10));
6Console.WriteLine("50% Percentile: {0}", rootEarlyFinish.GetPercentile(50));
7Console.WriteLine("90% Percentile: {0}", rootEarlyFinish.GetPercentile(90));
8Console.WriteLine("Minimum: {0}", rootEarlyFinish.Minimum);
9Console.WriteLine("Maximum: {0}", rootEarlyFinish.Maximum);
10analysisResult.SaveReport("AnalysisReport_out.pdf");
Висновок
Функція аналізу ризиків в Aspose.Tasks for .NET дозволяє розробникам оцінювати невизначеність у графіках проєктів шляхом моделювання варіацій тривалості завдань із використанням методів Монте-Карло. Налаштовуючи вхідні параметри, такі як ймовірнісні розподіли, кореляції між завданнями та параметри аналізу, клас RiskAnalyzer
може оцінити результати, наприклад, дату завершення проєкту.
Ця можливість призначена для інтеграції у процеси планування проєктів, де потрібен кількісний аналіз ризику графіка. Отримані результати можуть використовуватись для підтримки прийняття рішень або для виявлення завдань із найбільшим потенційним впливом на надійність графіка.