Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/14/10 03:52:07 (14 years ago)
Author:
abeham
Message:

Updated Tabu search, permutation move operators, real vector move operators, binary vector move operators #840
Added a Tabu Search TSP workbench

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationSingleMoveGenerator.cs

    r3232 r3340  
    4343      int length = permutation.Length;
    4444      int index1, index2, index3;
    45       index1 = random.Next(length - 1);
    4645      do {
    47         index2 = random.Next(index1, length);
    48       } while (index2 - index1 >= length - 2);
    49       do {
    50         index3 = random.Next(length - index2 + index1);
    51       } while (index3 == index1);
    52      
     46        index1 = random.Next(length);
     47        do {
     48          index2 = random.Next(index1, length);
     49        } while (index2 - index1 >= length - 2);
     50        do {
     51          index3 = random.Next(length - index2 + index1);
     52        } while (index3 == index1);
     53      } while (permutation.PermutationType != PermutationTypes.Absolute && (index1 == 0 && index3 == length - 1 || index1 == length - 1 && index3 == 0));
    5354      return new TranslocationMove(index1, index2, index3);
    5455    }
Note: See TracChangeset for help on using the changeset viewer.