Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/21/19 17:58:32 (4 years ago)
Author:
mkommend
Message:

#2521: First version of contexts in problem evaluation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/SingleObjectiveEvaluator.cs

    r17226 r17363  
    4646    }
    4747
    48     public Func<TEncodedSolution, IRandom, double> EvaluateFunc { get; set; }
     48    public Action<ISingleObjectiveSolutionContext<TEncodedSolution>, IRandom> Evaluate { get; set; }
    4949
    5050    [StorableConstructor]
     
    6363      var encoding = EncodingParameter.ActualValue;
    6464      var solution = ScopeUtil.GetEncodedSolution(ExecutionContext.Scope, encoding);
    65       QualityParameter.ActualValue = new DoubleValue(EvaluateFunc(solution, random));
     65      var solutionContext = new SingleObjectiveSolutionContextScope<TEncodedSolution>(ExecutionContext.Scope, solution);
     66
     67      Evaluate(solutionContext, random);
     68      var qualityValue = solutionContext.EvaluationResult.Quality;
     69
     70      QualityParameter.ActualValue = new DoubleValue(qualityValue);
    6671      return base.InstrumentedApply();
    6772    }
Note: See TracChangeset for help on using the changeset viewer.