- Timestamp:
- 08/16/10 11:24:14 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/DynOpEqComparator.cs
r4224 r4227 77 77 public ILookupParameter<DoubleValue> BestValidationQualityParameter { 78 78 get { return (ILookupParameter<DoubleValue>)Parameters["Best solution quality (validation)"]; } 79 } 80 public IValueLookupParameter<DoubleValue> CRaiseParameter { 81 get { return (IValueLookupParameter<DoubleValue>)Parameters["CRaise"]; } 79 82 } 80 83 … … 95 98 Parameters.Add(new LookupParameter<DoubleValue>("Current best validation quality")); 96 99 Parameters.Add(new LookupParameter<DoubleValue>("Best solution quality (validation)")); 100 Parameters.Add(new ValueLookupParameter<DoubleValue>("CRaise", "Necessary quality improvement per bin to allow extensions.", new DoubleValue(0.005))); 97 101 } 98 102 … … 110 114 #endregion 111 115 if (!Exists(bin)) { 112 113 116 if (AntiOverfitParameter.ActualValue.Value) { 114 117 // reject more complex solutions if the current validation quality is worse than the best so far … … 138 141 double bestValidationQuality = BestValidationQualityParameter.ActualValue.Value; 139 142 return maximization ? currentValidationQuality < bestValidationQuality : currentValidationQuality > bestValidationQuality; 140 } else 143 } else 141 144 return false; 142 145 } … … 150 153 if (Exists(binIndex)) { 151 154 //if (IsNotFull(binIndex) /*|| 152 155 //NewBestOfBin(solutionQuality, binIndex)*/) { 153 156 AddToBin(solutionQuality, binIndex); 154 accept = true; 157 accept = true; 158 UpdateBestQuality(solutionQuality); 155 159 //} 156 } else if (NewBestOfRun(solutionQuality) ) {160 } else if (NewBestOfRun(solutionQuality) && SignificantImprovement(solutionQuality, binIndex)) { 157 161 CreateNewBin(binIndex); 158 162 AddToBin(solutionQuality, binIndex); 159 163 accept = true; 164 UpdateBestQuality(solutionQuality); 160 165 } 161 166 return accept; 167 } 168 169 private void UpdateBestQuality(double solutionQuality) { 170 bool maximization = MaximizationParameter.ActualValue.Value; 171 double bestQuality = BestQualityParameter.ActualValue.Value; 172 if ((maximization && bestQuality < solutionQuality) || 173 (!maximization && solutionQuality < bestQuality)) 174 BestQualityParameter.ActualValue.Value = solutionQuality; 175 } 176 177 private bool SignificantImprovement(double solutionQuality, int newIndex) { 178 var binCapacities = BinCapacityParameter.ActualValue; 179 int binDiff = newIndex - binCapacities.Count + 1; 180 double bestQuality = BestQualityParameter.ActualValue.Value; 181 bool maximization = MaximizationParameter.ActualValue.Value; 182 183 double relativeQuality = maximization ? solutionQuality / bestQuality - 1 : bestQuality / solutionQuality - 1; 184 return relativeQuality >= binDiff * CRaiseParameter.ActualValue.Value; 162 185 } 163 186
Note: See TracChangeset
for help on using the changeset viewer.