Aspose.Tasks for C++
RiskPattern.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="RiskPattern.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/object.h>
9 #include <cstdint>
10 
11 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
12 
13 namespace Aspose
14 {
15 namespace Tasks
16 {
17 namespace RiskAnalysis
18 {
19 enum class ConfidenceLevel;
20 enum class ProbabilityDistributionType;
21 class RndDurationAlgorithm;
22 } // namespace RiskAnalysis
23 class Task;
24 } // namespace Tasks
25 } // namespace Aspose
26 
27 namespace Aspose {
28 
29 namespace Tasks {
30 
31 namespace RiskAnalysis {
32 
33 /// <summary>
34 /// Represents a risk pattern for a project task.
35 /// </summary>
36 class ASPOSE_TASKS_SHARED_CLASS RiskPattern : public System::Object
37 {
38  typedef RiskPattern ThisType;
39  typedef System::Object BaseType;
40 
41  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
42  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
43 
44  friend class Aspose::Tasks::RiskAnalysis::RndDurationAlgorithm;
45 
46 public:
47 
48  /// <summary>
49  /// Gets a project task to which this risk pattern is applied.
50  /// </summary>
51  ASPOSE_TASKS_SHARED_API System::SharedPtr<Aspose::Tasks::Task> get_Task() const;
52  /// <summary>
53  /// Gets the probability distribution used in Monte Carlo simulation.
54  /// The default value is ProbabilityDistributionType.Normal.
55  /// </summary>
56  /// <remarks>Can be one of the values defined in the <see cref="ProbabilityDistributionType"></see> enumeration.</remarks>
57  ASPOSE_TASKS_SHARED_API ProbabilityDistributionType get_Distribution() const;
58  /// <summary>
59  /// Sets the probability distribution used in Monte Carlo simulation.
60  /// The default value is ProbabilityDistributionType.Normal.
61  /// </summary>
62  /// <remarks>Can be one of the values defined in the <see cref="ProbabilityDistributionType"></see> enumeration.</remarks>
63  ASPOSE_TASKS_SHARED_API void set_Distribution(ProbabilityDistributionType value);
64  /// <summary>
65  /// Gets the confidence level that correspond to the percentage of the time the actual generated values will be within optimistic and pessimistic estimates.
66  /// The default value is CL99.
67  /// </summary>
68  /// <remarks>Can be one of the values defined in the <see cref="ConfidenceLevel"></see> enumeration.</remarks>
69  ASPOSE_TASKS_SHARED_API Aspose::Tasks::RiskAnalysis::ConfidenceLevel get_ConfidenceLevel() const;
70  /// <summary>
71  /// Sets the confidence level that correspond to the percentage of the time the actual generated values will be within optimistic and pessimistic estimates.
72  /// The default value is CL99.
73  /// </summary>
74  /// <remarks>Can be one of the values defined in the <see cref="ConfidenceLevel"></see> enumeration.</remarks>
75  ASPOSE_TASKS_SHARED_API void set_ConfidenceLevel(Aspose::Tasks::RiskAnalysis::ConfidenceLevel value);
76  /// <summary>
77  /// Gets the percentage of the most likely task duration which can happen in the best possible project scenario.
78  /// 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.
79  /// </summary>
80  ASPOSE_TASKS_SHARED_API int32_t get_Optimistic() const;
81  /// <summary>
82  /// Sets the percentage of the most likely task duration which can happen in the best possible project scenario.
83  /// 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.
84  /// </summary>
85  ASPOSE_TASKS_SHARED_API void set_Optimistic(int32_t value);
86  /// <summary>
87  /// Gets the percentage of the most likely task duration which can happen in the worst possible project scenario.
88  /// 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.
89  /// </summary>
90  ASPOSE_TASKS_SHARED_API int32_t get_Pessimistic() const;
91  /// <summary>
92  /// Sets the percentage of the most likely task duration which can happen in the worst possible project scenario.
93  /// 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.
94  /// </summary>
95  ASPOSE_TASKS_SHARED_API void set_Pessimistic(int32_t value);
96 
97  /// <summary>
98  /// Initializes a new instance of the <see cref="RiskPattern"></see> class.
99  /// </summary>
100  /// <param name="task">the specified project task for which this risk will be applied in Monte Carlo simulation.</param>
101  ASPOSE_TASKS_SHARED_API RiskPattern(const System::SharedPtr<Aspose::Tasks::Task>& task);
102 
103 protected:
104 
105  /// <summary>
106  /// Gets the optimistic duration calculated from the most likely one.
107  /// </summary>
108  ASPOSE_TASKS_SHARED_API double get_OptimisticDuration();
109  /// <summary>
110  /// Gets the pessimistic duration calculated from the most likely one.
111  /// </summary>
112  ASPOSE_TASKS_SHARED_API double get_PessimisticDuration();
113  /// <summary>
114  /// Gets the mean task duration based on pessimistic and optimistic values.
115  /// </summary>
116  ASPOSE_TASKS_SHARED_API double get_MeanDuration();
117  /// <summary>
118  /// Gets the half range of optimistic and pessimistic values.
119  /// </summary>
120  ASPOSE_TASKS_SHARED_API double get_HalfRange();
121 
122  #ifdef ASPOSE_GET_SHARED_MEMBERS
123  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
124  #endif
125 
126 
127 private:
128 
129  System::SharedPtr<Aspose::Tasks::Task> task;
130  int32_t optimistic;
131  int32_t pessimistic;
132  ProbabilityDistributionType pr_Distribution;
133  Aspose::Tasks::RiskAnalysis::ConfidenceLevel pr_ConfidenceLevel;
134 
135  /// <summary>
136  /// Gets the most likely task duration.
137  /// </summary>
138  double get_MostLikelyDuration();
139 
140  void ValidatePercentGreaterThanZero(int32_t value);
141 
142 };
143 
144 } // namespace RiskAnalysis
145 } // namespace Tasks
146 } // namespace Aspose
147 
148 
Represents a risk pattern for a project task.
Definition: RiskPattern.h:37
void set_Optimistic(int32_t value)
Sets the percentage of the most likely task duration which can happen in the best possible project sc...
void set_Distribution(ProbabilityDistributionType value)
Sets the probability distribution used in Monte Carlo simulation. The default value is ProbabilityDis...
int32_t get_Pessimistic() const
Gets the percentage of the most likely task duration which can happen in the worst possible project s...
int32_t get_Optimistic() const
Gets the percentage of the most likely task duration which can happen in the best possible project sc...
System::SharedPtr< Aspose::Tasks::Task > get_Task() const
Gets a project task to which this risk pattern is applied.
Aspose::Tasks::RiskAnalysis::ConfidenceLevel get_ConfidenceLevel() const
Gets the confidence level that correspond to the percentage of the time the actual generated values w...
void set_ConfidenceLevel(Aspose::Tasks::RiskAnalysis::ConfidenceLevel value)
Sets the confidence level that correspond to the percentage of the time the actual generated values w...
RiskPattern(const System::SharedPtr< Aspose::Tasks::Task > &task)
Initializes a new instance of the RiskPattern class.
void set_Pessimistic(int32_t value)
Sets the percentage of the most likely task duration which can happen in the worst possible project s...
ProbabilityDistributionType get_Distribution() const
Gets the probability distribution used in Monte Carlo simulation. The default value is ProbabilityDis...
Definition: Asn.h:13