Risk Analysis Tool

Performing Risk Analysis

Aspose.Tasks for .NET API supports performing risk analysis on a Project data file. This is based on the Monte Carlo simulation that supports different probability distributions and correlations. The Aspose.Tasks.RiskAnalysis.RiskAnalyzer class can be used to perform the risk analysis that is based on a project schedule (task durations and their start/finish dates). So, a project Finish date can be the output of such analysis. The following example illustrates this functionality step-by-step.

Performing Risk Analysis

Preparing Analysis Settings

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");

Conclusion

The risk analysis feature in Aspose.Tasks for .NET allows developers to evaluate uncertainty in project schedules by simulating variations in task durations using Monte Carlo methods. By configuring input parameters such as probability distributions, task correlations, and analysis settings, the RiskAnalyzer class can estimate outcomes like the project’s finish date.

This capability is intended for integration into project planning workflows where quantitative analysis of schedule risk is required. The results can be used to support project decision-making or to identify tasks with the highest potential impact on schedule reliability.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.