Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/16/15 20:14:52 (9 years ago)
Author:
pfleck
Message:

#2269

  • merged trunk after 3.3.11 release
  • updated copyright and plugin version in ALPS plugin
  • removed old ALPS samples based on an userdefined alg
Location:
branches/ALPS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS

  • branches/ALPS/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs

    r11960 r12018  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 * and the BEACON Center for the Study of Evolution in Action.
    55 *
     
    2828using HeuristicLab.Core;
    2929using HeuristicLab.Data;
     30using HeuristicLab.Encodings.BinaryVectorEncoding;
    3031using HeuristicLab.Optimization;
    3132using HeuristicLab.Parameters;
    3233using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    33 using HeuristicLab.Problems.BinaryVector;
     34using HeuristicLab.Problems.Binary;
    3435using HeuristicLab.Random;
    3536
     
    4950
    5051    public override Type ProblemType {
    51       get { return typeof(BinaryVectorProblem); }
     52      get { return typeof(BinaryProblem); }
    5253    }
    53     public new BinaryVectorProblem Problem {
    54       get { return (BinaryVectorProblem)base.Problem; }
     54    public new BinaryProblem Problem {
     55      get { return (BinaryProblem)base.Problem; }
    5556      set { base.Problem = value; }
    5657    }
     
    8384      Results.Add(new Result("Best quality", BestQuality));
    8485      for (int iteration = 0; iteration < Iterations; iteration++) {
    85         bool[] solution = new bool[Problem.Length];
     86        var solution = new BinaryVector(Problem.Length);
    8687        for (int i = 0; i < solution.Length; i++) {
    8788          solution[i] = random.Next(2) == 1;
    8889        }
    8990
    90         var fitness = Problem.Evaluate(solution);
     91        var fitness = Problem.Evaluate(solution, random);
    9192
    9293        fitness = ImproveToLocalOptimum(Problem, solution, fitness, random);
     
    9798    }
    9899    // In the GECCO paper, Section 2.1
    99     public static double ImproveToLocalOptimum(IBinaryVectorProblem problem, bool[] solution, double fitness, IRandom rand) {
     100    public static double ImproveToLocalOptimum(BinaryProblem problem, BinaryVector solution, double fitness, IRandom rand) {
    100101      var tried = new HashSet<int>();
    101102      do {
     
    104105          if (tried.Contains(option)) continue;
    105106          solution[option] = !solution[option];
    106           double newFitness = problem.Evaluate(solution);
     107          double newFitness = problem.Evaluate(solution, rand);
    107108          if (problem.IsBetter(newFitness, fitness)) {
    108109            fitness = newFitness;
Note: See TracChangeset for help on using the changeset viewer.