Changeset 10598 for branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers
- Timestamp:
- 03/17/14 12:50:59 (11 years ago)
- Location:
- branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs
r9456 r10598 35 35 [Item("SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic data analysis solution for single objective symbolic data analysis problems.")] 36 36 [StorableClass] 37 public abstract class SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<T> : SymbolicDataAnalysisSingleObjectiveAnalyzer 37 public abstract class SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<T> : SymbolicDataAnalysisSingleObjectiveAnalyzer, IIterationBasedOperator 38 38 39 where T : class, ISymbolicDataAnalysisSolution { 39 40 private const string TrainingBestSolutionParameterName = "Best training solution"; 40 41 private const string TrainingBestSolutionQualityParameterName = "Best training solution quality"; 42 private const string TrainingBestSolutionGenerationParameterName = "Best training solution generation"; 41 43 private const string UpdateAlwaysParameterName = "Always update best solution"; 44 private const string IterationsParameterName = "Iterations"; 45 private const string MaximumIterationsParameterName = "Maximum Iterations"; 42 46 43 47 #region parameter properties … … 48 52 get { return (ILookupParameter<DoubleValue>)Parameters[TrainingBestSolutionQualityParameterName]; } 49 53 } 54 public ILookupParameter<IntValue> TrainingBestSolutionGenerationParameter { 55 get { return (ILookupParameter<IntValue>)Parameters[TrainingBestSolutionGenerationParameterName]; } 56 } 50 57 public IFixedValueParameter<BoolValue> UpdateAlwaysParameter { 51 58 get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateAlwaysParameterName]; } 59 } 60 public ILookupParameter<IntValue> IterationsParameter { 61 get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; } 62 } 63 public IValueLookupParameter<IntValue> MaximumIterationsParameter { 64 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumIterationsParameterName]; } 52 65 } 53 66 #endregion … … 73 86 Parameters.Add(new LookupParameter<T>(TrainingBestSolutionParameterName, "The training best symbolic data analyis solution.")); 74 87 Parameters.Add(new LookupParameter<DoubleValue>(TrainingBestSolutionQualityParameterName, "The quality of the training best symbolic data analysis solution.")); 88 Parameters.Add(new LookupParameter<IntValue>(TrainingBestSolutionGenerationParameterName, "The generation in which the best training solution was found.")); 75 89 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best training solution should always be updated regardless of its quality.", new BoolValue(false))); 90 Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations.")); 91 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true }); 76 92 UpdateAlwaysParameter.Hidden = true; 77 93 } … … 83 99 UpdateAlwaysParameter.Hidden = true; 84 100 } 101 if (!Parameters.ContainsKey(TrainingBestSolutionGenerationParameterName)) 102 Parameters.Add(new LookupParameter<IntValue>(TrainingBestSolutionGenerationParameterName, "The generation in which the best training solution was found.")); 103 if (!Parameters.ContainsKey(IterationsParameterName)) 104 Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations.")); 105 if (!Parameters.ContainsKey(MaximumIterationsParameterName)) 106 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true }); 85 107 } 86 108 … … 104 126 TrainingBestSolution = CreateSolution(bestTree, bestQuality); 105 127 TrainingBestSolutionQuality = new DoubleValue(bestQuality); 128 if (IterationsParameter.ActualValue != null) 129 TrainingBestSolutionGenerationParameter.ActualValue = new IntValue(IterationsParameter.ActualValue.Value); 106 130 107 131 if (!results.ContainsKey(TrainingBestSolutionParameter.Name)) { 108 132 results.Add(new Result(TrainingBestSolutionParameter.Name, TrainingBestSolutionParameter.Description, TrainingBestSolution)); 109 133 results.Add(new Result(TrainingBestSolutionQualityParameter.Name, TrainingBestSolutionQualityParameter.Description, TrainingBestSolutionQuality)); 134 if (TrainingBestSolutionGenerationParameter.ActualValue != null) 135 results.Add(new Result(TrainingBestSolutionGenerationParameter.Name, TrainingBestSolutionGenerationParameter.Description, TrainingBestSolutionGenerationParameter.ActualValue)); 110 136 } else { 111 137 results[TrainingBestSolutionParameter.Name].Value = TrainingBestSolution; 112 138 results[TrainingBestSolutionQualityParameter.Name].Value = TrainingBestSolutionQuality; 139 if (TrainingBestSolutionGenerationParameter.ActualValue != null) 140 results[TrainingBestSolutionGenerationParameter.Name].Value = TrainingBestSolutionGenerationParameter.ActualValue; 141 113 142 } 114 143 } -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs
r10579 r10598 37 37 [Item("SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic data analysis solution for single objective symbolic data analysis problems.")] 38 38 [StorableClass] 39 public abstract class SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U> 39 public abstract class SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>, IIterationBasedOperator 40 40 where S : class, ISymbolicDataAnalysisSolution 41 41 where T : class, ISymbolicDataAnalysisSingleObjectiveEvaluator<U> … … 43 43 private const string ValidationBestSolutionParameterName = "Best validation solution"; 44 44 private const string ValidationBestSolutionQualityParameterName = "Best validation solution quality"; 45 private const string ValidationBestSolutionGenerationParameterName = "Best validation solution generation"; 45 46 private const string UpdateAlwaysParameterName = "Always update best solution"; 47 private const string IterationsParameterName = "Iterations"; 48 private const string MaximumIterationsParameterName = "Maximum Iterations"; 46 49 47 50 #region parameter properties … … 52 55 get { return (ILookupParameter<DoubleValue>)Parameters[ValidationBestSolutionQualityParameterName]; } 53 56 } 57 public ILookupParameter<IntValue> ValidationBestSolutionGenerationParameter { 58 get { return (ILookupParameter<IntValue>)Parameters[ValidationBestSolutionGenerationParameterName]; } 59 } 54 60 public IFixedValueParameter<BoolValue> UpdateAlwaysParameter { 55 61 get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateAlwaysParameterName]; } 62 } 63 public ILookupParameter<IntValue> IterationsParameter { 64 get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; } 65 } 66 public IValueLookupParameter<IntValue> MaximumIterationsParameter { 67 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumIterationsParameterName]; } 56 68 } 57 69 #endregion … … 77 89 Parameters.Add(new LookupParameter<S>(ValidationBestSolutionParameterName, "The validation best symbolic data analyis solution.")); 78 90 Parameters.Add(new LookupParameter<DoubleValue>(ValidationBestSolutionQualityParameterName, "The quality of the validation best symbolic data analysis solution.")); 91 Parameters.Add(new LookupParameter<IntValue>(ValidationBestSolutionGenerationParameterName, "The generation in which the best validation solution was found.")); 79 92 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best validation solution should always be updated regardless of its quality.", new BoolValue(false))); 93 Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations.")); 94 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true }); 80 95 UpdateAlwaysParameter.Hidden = true; 81 96 } … … 84 99 private void AfterDeserialization() { 85 100 if (!Parameters.ContainsKey(UpdateAlwaysParameterName)) { 86 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best trainingsolution should always be updated regardless of its quality.", new BoolValue(false)));101 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best validation solution should always be updated regardless of its quality.", new BoolValue(false))); 87 102 UpdateAlwaysParameter.Hidden = true; 88 103 } 104 if (!Parameters.ContainsKey(ValidationBestSolutionGenerationParameterName)) 105 Parameters.Add(new LookupParameter<IntValue>(ValidationBestSolutionGenerationParameterName, "The generation in which the best validation solution was found.")); 106 if (!Parameters.ContainsKey(IterationsParameterName)) 107 Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations.")); 108 if (!Parameters.ContainsKey(MaximumIterationsParameterName)) 109 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true }); 89 110 } 90 111 … … 137 158 ValidationBestSolution = CreateSolution(bestTree, bestValidationQuality); 138 159 ValidationBestSolutionQuality = new DoubleValue(bestValidationQuality); 160 if (IterationsParameter.ActualValue != null) 161 ValidationBestSolutionGenerationParameter.ActualValue = new IntValue(IterationsParameter.ActualValue.Value); 139 162 140 163 if (!results.ContainsKey(ValidationBestSolutionParameter.Name)) { 141 164 results.Add(new Result(ValidationBestSolutionParameter.Name, ValidationBestSolutionParameter.Description, ValidationBestSolution)); 142 165 results.Add(new Result(ValidationBestSolutionQualityParameter.Name, ValidationBestSolutionQualityParameter.Description, ValidationBestSolutionQuality)); 166 if (ValidationBestSolutionGenerationParameter.ActualValue != null) 167 results.Add(new Result(ValidationBestSolutionGenerationParameter.Name, ValidationBestSolutionGenerationParameter.Description, ValidationBestSolutionGenerationParameter.ActualValue)); 143 168 } else { 144 169 results[ValidationBestSolutionParameter.Name].Value = ValidationBestSolution; 145 170 results[ValidationBestSolutionQualityParameter.Name].Value = ValidationBestSolutionQuality; 171 if (ValidationBestSolutionGenerationParameter.ActualValue != null) 172 results[ValidationBestSolutionGenerationParameter.Name].Value = ValidationBestSolutionGenerationParameter.ActualValue; 146 173 } 147 174 }
Note: See TracChangeset
for help on using the changeset viewer.