Herramienta de análisis de riesgos para desarrolladores de Java
Contents
[
Hide
Show
]Realización de análisis de riesgos
Aspose.Tasks for Java API Supports para realizar análisis de riesgos en un archivo de datos del proyecto. Esto se basa en la simulación de Monte Carlo que admite diferentes distribuciones y correlaciones de probabilidad. La clase RiskAnalyzer se puede utilizar para realizar el análisis de riesgos basado en un cronograma de proyecto (duraciones de tareas y sus fechas de inicio/finalización). Por lo tanto, una fecha de finalización del proyecto puede ser la salida de dicho análisis. El siguiente ejemplo ilustra esta funcionalidad paso a paso.
1. Preparación de configuraciones de análisis
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2RiskAnalysisSettings settings = new RiskAnalysisSettings();
3// set a number of iterations for Monte Carlo simulation (the default value is 100).
4settings.setIterationsCount(200);
2. Identifying the Input of Analysis
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2Project project = new Project("NewProductDev.mpp"); // attached test project
3
4// Initialize a risk pattern
5Task task = project.getRootTask().getChildren().getById(14);
6
7RiskPattern pattern = new RiskPattern(task);
8// Select a distribution type for the random number generator to generate possible values from (only two types currently supported, namely normal and uniform)
9// note that the normal distributions are often used in the natural and social sciences to represent real-valued random variables whose distributions are not known,
10// thus this distribution is set to default (for more details see here: https://en.wikipedia.org/wiki/Normal_distribution)
11pattern.setDistribution (ProbabilityDistributionType.Normal);
12// Set the percentage of the most likely task duration which can happen in the best possible project scenario
13// (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)
14pattern.setOptimistic(70);
15// Set the percentage of the most likely task duration which can happen in the worst possible project scenario
16// (the defaut value is 125, which means that if the estimated specified task duration is 4 days then the pessimistic duration will be 5 days.).
17pattern.setPessimistic(130);
18// Set a confidence level that correspond to the percentage of the time the actual values will be within optimistic and pessimistic estimates.
19// 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
20pattern.setConfidenceLevel(ConfidenceLevel.CL75);
21
22// you can add as many risk patterns as needed to model expected project risks
23settings.getPatterns().add(pattern);
3. Analyze the Risks
1RiskAnalyzer analyzer = new RiskAnalyzer(settings);
2RiskAnalysisResult analysisResult = analyzer.analyze(project);
4. Use the Results of the Analysis
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2//Select the desired output (here we get early finish of the root task)
3RiskItemStatistics rootEarlyFinish = analysisResult.getRiskItems(RiskItemType.EarlyFinish).get(project.getRootTask());
4
5System.out.println("Expected value: "+ rootEarlyFinish.getExpectedValue());
6System.out.println("StandardDeviation: " + rootEarlyFinish.getStandardDeviation());
7System.out.println("10% Percentile: " +rootEarlyFinish.getPercentile(10));
8System.out.println("50% Percentile: " + rootEarlyFinish.getPercentile(50));
9System.out.println("90% Percentile: " + rootEarlyFinish.getPercentile(90));
10System.out.println("Minimum: " + rootEarlyFinish.getMinimum());
11System.out.println("Maximum: " + rootEarlyFinish.getMaximum());
12
13// Also pdf report can be saved (it is rendered for Project Root Task Finish date):
14analysisResult.saveReport("AnalysisReport.pdf");