Changeset 9152 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs
- Timestamp:
- 01/14/13 13:14:22 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs
r8798 r9152 20 20 #endregion 21 21 22 using System.Collections.Generic;23 22 using System.Linq; 24 23 using HeuristicLab.Common; … … 26 25 using HeuristicLab.Data; 27 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Operators;29 27 using HeuristicLab.Optimization; 30 28 using HeuristicLab.Parameters; … … 41 39 private const string TrainingBestSolutionParameterName = "Best training solution"; 42 40 private const string TrainingBestSolutionQualityParameterName = "Best training solution quality"; 41 private const string UpdateAlwaysParameterName = "Always update best solution"; 43 42 44 43 #region parameter properties … … 48 47 public ILookupParameter<DoubleValue> TrainingBestSolutionQualityParameter { 49 48 get { return (ILookupParameter<DoubleValue>)Parameters[TrainingBestSolutionQualityParameterName]; } 49 } 50 public IFixedValueParameter<BoolValue> UpdateAlwaysParameter { 51 get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateAlwaysParameterName]; } 50 52 } 51 53 #endregion … … 59 61 set { TrainingBestSolutionQualityParameter.ActualValue = value; } 60 62 } 63 public BoolValue UpdateAlways { 64 get { return UpdateAlwaysParameter.Value; } 65 } 61 66 #endregion 62 67 … … 68 73 Parameters.Add(new LookupParameter<T>(TrainingBestSolutionParameterName, "The training best symbolic data analyis solution.")); 69 74 Parameters.Add(new LookupParameter<DoubleValue>(TrainingBestSolutionQualityParameterName, "The quality of the training best symbolic data analysis solution.")); 75 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best training solution should always be updated regardless of its quality.", new BoolValue(false))); 76 UpdateAlwaysParameter.Hidden = true; 77 } 78 79 [StorableHook(HookType.AfterDeserialization)] 80 private void AfterDeserialization() { 81 if (!Parameters.ContainsKey(UpdateAlwaysParameterName)) { 82 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best training solution should always be updated regardless of its quality.", new BoolValue(false))); 83 UpdateAlwaysParameter.Hidden = true; 84 } 70 85 } 71 86 … … 85 100 86 101 var results = ResultCollection; 87 if (bestTree != null && ( TrainingBestSolutionQuality == null ||102 if (bestTree != null && (UpdateAlways.Value || TrainingBestSolutionQuality == null || 88 103 IsBetter(bestQuality, TrainingBestSolutionQuality.Value, Maximization.Value))) { 89 104 TrainingBestSolution = CreateSolution(bestTree, bestQuality);
Note: See TracChangeset
for help on using the changeset viewer.