Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/15 17:22:41 (8 years ago)
Author:
mkommend
Message:

#2521: Fixed all problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/MultiObjectiveExternalEvaluationProblem.cs

    r13336 r13372  
    3737  [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 200)]
    3838  [StorableClass]
    39   public class MultiObjectiveExternalEvaluationProblem : MultiObjectiveProblem<IEncoding>, IExternalEvaluationProblem {
     39  public class MultiObjectiveExternalEvaluationProblem : MultiObjectiveProblem<IEncoding<ISolution>, ISolution>, IExternalEvaluationProblem {
    4040
    4141    public static new Image StaticItemImage {
     
    9999    }
    100100
    101     public override double[] Evaluate(Individual individual, IRandom random) {
     101    public override double[] Evaluate(ISolution individual, IRandom random) {
    102102      var qualityMessage = Evaluate(BuildSolutionMessage(individual));
    103103      if (!qualityMessage.HasExtension(MultiObjectiveQualityMessage.QualityMessage_))
     
    111111    }
    112112
    113     public override void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) {
     113    public override void Analyze(ISolution[] individuals, double[][] qualities, ResultCollection results, IRandom random) {
    114114      OptimizationSupport.Analyze(individuals, qualities, results, random);
    115115    }
     
    140140      try {
    141141        return client.Evaluate(message, GetQualityMessageExtensions());
    142       } finally {
     142      }
     143      finally {
    143144        lock (clientLock) {
    144145          activeClients.Remove(client);
     
    148149    }
    149150
    150     private SolutionMessage BuildSolutionMessage(Individual individual, int solutionId = 0) {
     151    private SolutionMessage BuildSolutionMessage(ISolution solution, int solutionId = 0) {
    151152      lock (clientLock) {
    152153        SolutionMessage.Builder protobufBuilder = SolutionMessage.CreateBuilder();
    153154        protobufBuilder.SolutionId = solutionId;
    154155        var scope = new Scope();
    155         individual.CopyToScope(scope);
     156        ScopeUtil.CopySolutionToScope(scope, Encoding, solution);
    156157        foreach (var variable in scope.Variables) {
    157158          try {
    158159            MessageBuilder.AddToMessage(variable.Value, variable.Name, protobufBuilder);
    159           } catch (ArgumentException ex) {
     160          }
     161          catch (ArgumentException ex) {
    160162            throw new InvalidOperationException(string.Format("ERROR while building solution message: Parameter {0} cannot be added to the message", Name), ex);
    161163          }
Note: See TracChangeset for help on using the changeset viewer.