Changeset 3340 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationSingleMoveGenerator.cs
- Timestamp:
- 04/14/10 03:52:07 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationSingleMoveGenerator.cs
r3232 r3340 43 43 int length = permutation.Length; 44 44 int index1, index2, index3; 45 index1 = random.Next(length - 1);46 45 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)); 53 54 return new TranslocationMove(index1, index2, index3); 54 55 }
Note: See TracChangeset
for help on using the changeset viewer.