Changeset 9444 for branches/HivePerformance/sources/HeuristicLab.Problems.TestFunctions/3.3/Improvers
- Timestamp:
- 05/06/13 12:30:18 (12 years ago)
- Location:
- branches/HivePerformance/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HivePerformance/sources
- Property svn:mergeinfo changed
/trunk/sources (added) merged: 9376,9379,9388,9390,9396,9402-9410,9413,9417,9426-9429,9432-9433,9435-9439,9441-9443
- Property svn:mergeinfo changed
-
branches/HivePerformance/sources/HeuristicLab.Problems.TestFunctions
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.TestFunctions (added) merged: 9407
- Property svn:mergeinfo changed
-
branches/HivePerformance/sources/HeuristicLab.Problems.TestFunctions/3.3/Improvers/SingleObjectiveTestFunctionImprovementOperator.cs
r9345 r9444 125 125 throw new ArgumentException("Cannot improve solution because it has the wrong type."); 126 126 127 double bestSolQuality = Evaluator.EvaluateFunction(bestSol); 127 var evaluator = Evaluator; 128 129 double bestSolQuality = evaluator.Evaluate(bestSol); 128 130 129 131 // create perturbed solutions … … 139 141 for (int i = 0; i < ImprovementAttempts.Value; i++) { 140 142 // order according to their objective function value 141 Array.Sort(simplex, (x, y) => Evaluator.EvaluateFunction(x).CompareTo(Evaluator.EvaluateFunction(y)));143 Array.Sort(simplex, (x, y) => evaluator.Evaluate(x).CompareTo(evaluator.Evaluate(y))); 142 144 143 145 // calculate centroid … … 153 155 for (int j = 0; j < reflectionPoint.Length; j++) 154 156 reflectionPoint[j] = centroid[j] + Alpha.Value * (centroid[j] - simplex[simplex.Length - 1][j]); 155 double reflectionPointQuality = Evaluator.EvaluateFunction(reflectionPoint);156 if ( Evaluator.EvaluateFunction(simplex[0]) <= reflectionPointQuality157 && reflectionPointQuality < Evaluator.EvaluateFunction(simplex[simplex.Length - 2]))157 double reflectionPointQuality = evaluator.Evaluate(reflectionPoint); 158 if (evaluator.Evaluate(simplex[0]) <= reflectionPointQuality 159 && reflectionPointQuality < evaluator.Evaluate(simplex[simplex.Length - 2])) 158 160 simplex[simplex.Length - 1] = reflectionPoint; 159 161 160 162 // expansion 161 if (reflectionPointQuality < Evaluator.EvaluateFunction(simplex[0])) {163 if (reflectionPointQuality < evaluator.Evaluate(simplex[0])) { 162 164 RealVector expansionPoint = new RealVector(bestSol.Length); 163 165 for (int j = 0; j < expansionPoint.Length; j++) 164 166 expansionPoint[j] = centroid[j] + Beta.Value * (reflectionPoint[j] - centroid[j]); 165 simplex[simplex.Length - 1] = Evaluator.EvaluateFunction(expansionPoint) < reflectionPointQuality ? expansionPoint : reflectionPoint;167 simplex[simplex.Length - 1] = evaluator.Evaluate(expansionPoint) < reflectionPointQuality ? expansionPoint : reflectionPoint; 166 168 } 167 169 168 170 // contraction 169 if ( Evaluator.EvaluateFunction(simplex[simplex.Length - 2]) <= reflectionPointQuality170 && reflectionPointQuality < Evaluator.EvaluateFunction(simplex[simplex.Length - 1])) {171 if (evaluator.Evaluate(simplex[simplex.Length - 2]) <= reflectionPointQuality 172 && reflectionPointQuality < evaluator.Evaluate(simplex[simplex.Length - 1])) { 171 173 RealVector outsideContractionPoint = new RealVector(bestSol.Length); 172 174 for (int j = 0; j < outsideContractionPoint.Length; j++) 173 175 outsideContractionPoint[j] = centroid[j] + Gamma.Value * (reflectionPoint[j] - centroid[j]); 174 if ( Evaluator.EvaluateFunction(outsideContractionPoint) <= reflectionPointQuality) {176 if (evaluator.Evaluate(outsideContractionPoint) <= reflectionPointQuality) { 175 177 simplex[simplex.Length - 1] = outsideContractionPoint; 176 if ( Evaluator.EvaluateFunction(reflectionPoint) >= Evaluator.EvaluateFunction(simplex[simplex.Length - 1])) {178 if (evaluator.Evaluate(reflectionPoint) >= evaluator.Evaluate(simplex[simplex.Length - 1])) { 177 179 RealVector insideContractionPoint = new RealVector(bestSol.Length); 178 180 for (int j = 0; j < insideContractionPoint.Length; j++) 179 181 insideContractionPoint[j] = centroid[j] - Gamma.Value * (reflectionPoint[j] - centroid[j]); 180 if ( Evaluator.EvaluateFunction(insideContractionPoint) < Evaluator.EvaluateFunction(simplex[simplex.Length - 1])) simplex[simplex.Length - 1] = insideContractionPoint;182 if (evaluator.Evaluate(insideContractionPoint) < evaluator.Evaluate(simplex[simplex.Length - 1])) simplex[simplex.Length - 1] = insideContractionPoint; 181 183 } 182 184 }
Note: See TracChangeset
for help on using the changeset viewer.