Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/17/19 23:07:03 (5 years ago)
Author:
mkommend
Message:

#2521: Adapted test functions to new architecture and partly MOCMAES.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.MOCMAEvolutionStrategy/3.3/MOCMAEvolutionStrategy.cs

    r16723 r16807  
    2525using System.Linq;
    2626using System.Threading;
     27using HEAL.Attic;
    2728using HeuristicLab.Analysis;
    2829using HeuristicLab.Common;
     
    3233using HeuristicLab.Optimization;
    3334using HeuristicLab.Parameters;
    34 using HEAL.Attic;
    3535using HeuristicLab.Problems.TestFunctions.MultiObjective;
    3636using HeuristicLab.Random;
     
    4242  public class MOCMAEvolutionStrategy : BasicAlgorithm {
    4343    public override Type ProblemType {
    44       get { return typeof(MultiObjectiveBasicProblem<RealVectorEncoding>); }
    45     }
    46     public new MultiObjectiveBasicProblem<RealVectorEncoding> Problem {
    47       get { return (MultiObjectiveBasicProblem<RealVectorEncoding>)base.Problem; }
     44      get { return typeof(MultiObjectiveProblem<RealVectorEncoding, RealVector>); }
     45    }
     46    public new MultiObjectiveProblem<RealVectorEncoding, RealVector> Problem {
     47      get { return (MultiObjectiveProblem<RealVectorEncoding, RealVector>)base.Problem; }
    4848      set { base.Problem = value; }
    4949    }
     
    361361        ResultsDifferenceBestKnownHypervolume = ResultsBestKnownHypervolume;
    362362      }
    363       ResultsScatterPlot = new ParetoFrontScatterPlot(new double[0][], new double[0][], problem.BestKnownFront.ToJaggedArray(), problem.Objectives, problem.ProblemSize);
     363      ResultsScatterPlot = new ParetoFrontScatterPlot(new double[0][], new double[0][], problem.BestKnownFront.ToJaggedArray(), Problem.Objectives, Problem.Encoding.Length);
    364364    }
    365365    #endregion
     
    409409    }
    410410    private double[] Evaluate(RealVector x) {
    411       var res = Problem.Evaluate(new SingleEncodingIndividual(Problem.Encoding, new Scope { Variables = { new Variable(Problem.Encoding.Name, x) } }), random);
     411      var res = Problem.Evaluate(x, random);
    412412      return res;
    413413    }
     
    495495      ResultsHypervolumeDifferenceDataLine.Values.Add(ResultsDifferenceBestKnownHypervolume);
    496496
    497       Problem.Analyze(
    498         solutions.Select(x => (Optimization.Individual)new SingleEncodingIndividual(Problem.Encoding, new Scope { Variables = { new Variable(Problem.Encoding.Name, x.Mean) } })).ToArray(),
     497      Problem.Analyze(solutions.Select(x => x.Mean).ToArray(),
    499498        solutions.Select(x => x.Fitness).ToArray(),
    500499        Results,
Note: See TracChangeset for help on using the changeset viewer.