Changeset 17382 for branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/EvaluationTracker.cs
- Timestamp:
- 12/18/19 16:11:21 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/EvaluationTracker.cs
r17363 r17382 95 95 } 96 96 97 public doubleEvaluate(BinaryVector vector, IRandom random) {97 public ISingleObjectiveEvaluationResult Evaluate(BinaryVector vector, IRandom random) { 98 98 return Evaluate(vector, random, CancellationToken.None); 99 99 } 100 100 101 public doubleEvaluate(BinaryVector vector, IRandom random, CancellationToken cancellationToken) {101 public ISingleObjectiveEvaluationResult Evaluate(BinaryVector vector, IRandom random, CancellationToken cancellationToken) { 102 102 if (Evaluations >= maxEvaluations) throw new OperationCanceledException("Maximum Evaluation Limit Reached"); 103 103 Evaluations++; 104 double fitness = problem.Evaluate(vector, random); 104 105 var evaluationResult = problem.Evaluate(vector, random); 106 double fitness = evaluationResult.Quality; 105 107 if (double.IsNaN(BestQuality) || problem.IsBetter(fitness, BestQuality)) { 106 108 BestQuality = fitness; … … 108 110 BestFoundOnEvaluation = Evaluations; 109 111 } 110 return fitness;112 return evaluationResult; 111 113 } 112 114 … … 115 117 } 116 118 public void Evaluate(ISingleObjectiveSolutionContext<BinaryVector> solutionContext, IRandom random, CancellationToken cancellationToken) { 117 double quality= Evaluate(solutionContext.EncodedSolution, random, cancellationToken);118 solutionContext.EvaluationResult = new SingleObjectiveEvaluationResult(quality);119 var evaluationResult = Evaluate(solutionContext.EncodedSolution, random, cancellationToken); 120 solutionContext.EvaluationResult = evaluationResult; 119 121 } 120 122
Note: See TracChangeset
for help on using the changeset viewer.