Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/09/17 00:36:20 (8 years ago)
Author:
abeham
Message:

#2701:

  • Added alternating bits binary test Problem
  • Refactored MemPR to work with programmable problem in current trunk
  • fixed a bug in permutation MemPR when crossover doesn't assign an offspring
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/LocalSearch/StaticAPI/ExhaustiveBitflip.cs

    r14450 r14552  
    3030namespace HeuristicLab.Encodings.Binary.LocalSearch {
    3131  public static class ExhaustiveBitflip {
    32     public static Tuple<int, int> Optimize(IRandom random, BinaryVector solution, ref double quality, bool maximization, Func<BinaryVector, double> evalFunc, CancellationToken token, bool[] subspace = null) {
    33       if (double.IsNaN(quality)) quality = evalFunc(solution);
     32    public static Tuple<int, int> Optimize(IRandom random, BinaryVector solution, ref double quality, bool maximization, Func<BinaryVector, CancellationToken, double> evalFunc, CancellationToken token, bool[] subspace = null) {
     33      if (double.IsNaN(quality)) quality = evalFunc(solution, token);
    3434      var improved = false;
    3535      var order = Enumerable.Range(0, solution.Length).Shuffle(random).ToArray();
     
    4747          // bitflip the solution
    4848          solution[idx] = !solution[idx];
    49           var after = evalFunc(solution);
     49          var after = evalFunc(solution, token);
    5050          evaluations++;
    5151          if (FitnessComparer.IsBetter(maximization, after, quality)) {
Note: See TracChangeset for help on using the changeset viewer.