Changeset 15483
- Timestamp:
- 11/21/17 17:10:05 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r15481 r15483 44 44 private const string FunctionEvaluationsResultParameterName = "Constants Optimization Function Evaluations"; 45 45 private const string GradientEvaluationsResultParameterName = "Constants Optimization Gradient Evaluations"; 46 private const string CountEvaluationsParameterName = "Count Function and Gradient Evaluations"; 46 47 47 48 public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter { … … 69 70 public IResultParameter<IntValue> GradientEvaluationsResultParameter { 70 71 get { return (IResultParameter<IntValue>)Parameters[GradientEvaluationsResultParameterName]; } 72 } 73 public IFixedValueParameter<BoolValue> CountEvaluationsParameter { 74 get { return (IFixedValueParameter<BoolValue>)Parameters[CountEvaluationsParameterName]; } 71 75 } 72 76 … … 92 96 get { return UpdateVariableWeightsParameter.Value.Value; } 93 97 set { UpdateVariableWeightsParameter.Value.Value = value; } 98 } 99 100 public bool CountEvaluations { 101 get { return CountEvaluationsParameter.Value.Value; } 102 set { CountEvaluationsParameter.Value.Value = value; } 94 103 } 95 104 … … 112 121 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized.", new BoolValue(true)) { Hidden = true }); 113 122 123 Parameters.Add(new FixedValueParameter<BoolValue>(CountEvaluationsParameterName, "Determines if function and gradient evaluation should be counted.", new BoolValue(false))); 114 124 Parameters.Add(new ResultParameter<IntValue>(FunctionEvaluationsResultParameterName, "The number of function evaluations performed by the constants optimization evaluator", "Results", new IntValue())); 115 125 Parameters.Add(new ResultParameter<IntValue>(GradientEvaluationsResultParameterName, "The number of gradient evaluations performed by the constants optimization evaluator", "Results", new IntValue())); … … 126 136 if (!Parameters.ContainsKey(UpdateVariableWeightsParameterName)) 127 137 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized.", new BoolValue(true))); 138 139 if (!Parameters.ContainsKey(CountEvaluationsParameterName)) 140 Parameters.Add(new FixedValueParameter<BoolValue>(CountEvaluationsParameterName, "Determines if function and gradient evaluation should be counted.", new BoolValue(false))); 141 if (Parameters.ContainsKey(FunctionEvaluationsResultParameterName) && Parameters.ContainsKey(GradientEvaluationsResultParameterName)) 142 CountEvaluations = true; 128 143 129 144 if (!Parameters.ContainsKey(FunctionEvaluationsResultParameterName)) … … 148 163 } 149 164 150 lock (locker) { 151 FunctionEvaluationsResultParameter.ActualValue.Value += counter.FunctionEvaluations; 152 GradientEvaluationsResultParameter.ActualValue.Value += counter.GradientEvaluations; 165 if (CountEvaluations) { 166 lock (locker) { 167 FunctionEvaluationsResultParameter.ActualValue.Value += counter.FunctionEvaluations; 168 GradientEvaluationsResultParameter.ActualValue.Value += counter.GradientEvaluations; 169 } 153 170 } 154 171
Note: See TracChangeset
for help on using the changeset viewer.