Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/17 01:53:44 (7 years ago)
Author:
abeham
Message:

#2701:

  • fixed bug with breeding
  • fixed permutation sub-space hillclimber
  • improved speed of inversion by calling Array.Reverse(int, int) instead of using a for-loop
  • added delinking for relative-undirected permutations
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/BinaryMemPR.cs

    r14552 r14556  
    160160      while (evaluations < N) {
    161161        BinaryVector c = null;
    162         var xochoice = Context.Random.Next(3);
    163         switch (xochoice) {
    164           case 0: c = NPointCrossover.Apply(Context.Random, p1.Solution, p2.Solution, new IntValue(1)); break;
    165           case 1: c = NPointCrossover.Apply(Context.Random, p1.Solution, p2.Solution, new IntValue(2)); break;
    166           case 2: c = UniformCrossover.Apply(Context.Random, p1.Solution, p2.Solution); break;
    167         }
     162        var xochoice = Context.Random.NextDouble();
     163        if (xochoice < 0.2)
     164          c = NPointCrossover.Apply(Context.Random, p1.Solution, p2.Solution, new IntValue(1));
     165        else if (xochoice < 0.5)
     166          c = NPointCrossover.Apply(Context.Random, p1.Solution, p2.Solution, new IntValue(2));
     167        else c = UniformCrossover.Apply(Context.Random, p1.Solution, p2.Solution);
    168168        if (cache.Contains(c)) {
    169169          cacheHits++;
    170           if (cacheHits > 10) break;
     170          if (cacheHits > 20) break;
    171171          continue;
    172172        }
     173        probe.Solution = c;
    173174        Context.Evaluate(probe, token);
    174175        evaluations++;
Note: See TracChangeset for help on using the changeset viewer.