Changeset 16692 for branches/2521_ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/Swap3Manipulator.cs
- Timestamp:
- 03/18/19 17:24:30 (6 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/Swap3Manipulator.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 57 57 public static void Apply(IRandom random, Permutation permutation) { 58 58 if (permutation.Length < 3) throw new ArgumentException("Swap3Manipulator: The permutation must be at least of size 3.", "permutation"); 59 int index1, index2, index3 , temp;59 int index1, index2, index3; 60 60 61 61 do { … … 65 65 } while (index1 == index2 || index2 == index3 || index1 == index3); 66 66 67 // swap positions 1 and 2 68 temp = permutation[index1]; 69 permutation[index1] = permutation[index2]; 70 permutation[index2] = temp; 71 // swap positions 2 and 3 72 temp = permutation[index2]; 73 permutation[index2] = permutation[index3]; 74 permutation[index3] = temp; 67 permutation.Swap(index1, index2); 68 permutation.Swap(index2, index3); 75 69 } 76 70
Note: See TracChangeset
for help on using the changeset viewer.