Инструмент анализа риска
Выполнение анализа рисков
Aspose.tasks для .NET API поддерживает анализ рисков в файле данных проекта. Это основано на моделировании Монте -Карло, которая поддерживает различные распределения вероятностей и корреляции. Aspose.tasks.riskanalysis.lass.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
может оценивать результаты, например, дату завершения проекта.
Эта возможность предназначена для интеграции в процессы планирования проектов, где требуется количественный анализ рисков расписания. Полученные результаты могут быть использованы для поддержки принятия решений по проекту или для выявления задач с наибольшим потенциальным влиянием на надёжность графика.