Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/15 16:14:57 (9 years ago)
Author:
mkommend
Message:

#2521: Rectored problems and encodings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs

    r13173 r13339  
    3232using HeuristicLab.Parameters;
    3333using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    34 using HeuristicLab.Problems.Binary;
    3534using HeuristicLab.Random;
    3635
     
    5049
    5150    public override Type ProblemType {
    52       get { return typeof(BinaryProblem); }
     51      get { return typeof(ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>); }
    5352    }
    54     public new BinaryProblem Problem {
    55       get { return (BinaryProblem)base.Problem; }
     53    public new ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector> Problem {
     54      get { return (ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>)base.Problem; }
    5655      set { base.Problem = value; }
    5756    }
     
    8483      Results.Add(new Result("Best quality", BestQuality));
    8584      for (int iteration = 0; iteration < Iterations; iteration++) {
    86         var solution = new BinaryVector(Problem.Length);
     85        var solution = new BinaryVector(Problem.Encoding.Length);
    8786        for (int i = 0; i < solution.Length; i++) {
    8887          solution[i] = random.Next(2) == 1;
     
    9897    }
    9998    // In the GECCO paper, Section 2.1
    100     public static double ImproveToLocalOptimum(BinaryProblem problem, BinaryVector solution, double fitness, IRandom rand) {
     99    public static double ImproveToLocalOptimum(ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector> problem, BinaryVector solution, double fitness, IRandom rand) {
    101100      var tried = new HashSet<int>();
    102101      do {
Note: See TracChangeset for help on using the changeset viewer.