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/SingleObjectiveMoveEvaluator.cs

    r17226 r17363  
    5050    }
    5151
    52     public Func<TEncodedSolution, IRandom, double> EvaluateFunc { get; set; }
     52    public Action<ISingleObjectiveSolutionContext<TEncodedSolution>, IRandom> Evaluate { get; set; }
    5353
    5454    [StorableConstructor]
     
    6969      var random = RandomParameter.ActualValue;
    7070      var encoding = EncodingParameter.ActualValue;
    71       var individual = ScopeUtil.GetEncodedSolution(ExecutionContext.Scope, encoding);
    72       MoveQualityParameter.ActualValue = new DoubleValue(EvaluateFunc(individual, random));
     71      var solution = ScopeUtil.GetEncodedSolution(ExecutionContext.Scope, encoding);
     72      var solutionContext = new SingleObjectiveSolutionContextScope<TEncodedSolution>(ExecutionContext.Scope, solution);
     73
     74      Evaluate(solutionContext, random);
     75      var qualityValue = solutionContext.EvaluationResult.Quality;
     76
     77      MoveQualityParameter.ActualValue = new DoubleValue(qualityValue);
    7378      return base.Apply();
    7479    }
Note: See TracChangeset for help on using the changeset viewer.