- Timestamp:
- 06/07/11 12:49:03 (13 years ago)
- Location:
- branches/GP.Grammar.Editor/HeuristicLab.Encodings.PermutationEncoding/3.3
- Files:
-
- 3 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Encodings.PermutationEncoding/3.3/HeuristicLab.Encodings.PermutationEncoding-3.3.csproj
r6042 r6377 118 118 <Compile Include="Crossovers\PartiallyMatchedCrossover.cs" /> 119 119 <Compile Include="Crossovers\PositionBasedCrossover.cs" /> 120 <Compile Include="Crossovers\UniformLikeCrossover.cs" /> 120 121 <Compile Include="HeuristicLabEncodingsPermutationEncodingPlugin.cs" /> 121 122 <Compile Include="Interfaces\IPermutationMultiNeighborhoodShakingOperator.cs" /> … … 179 180 <Compile Include="Moves\TwoOpt\StochasticInversionMultiMoveGenerator.cs" /> 180 181 <Compile Include="Moves\TwoOpt\StochasticInversionSingleMoveGenerator.cs" /> 182 <Compile Include="PermutationEqualityComparer.cs" /> 181 183 <Compile Include="PermutationManipulator.cs" /> 182 184 <Compile Include="PermutationCrossover.cs" /> -
branches/GP.Grammar.Editor/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/Swap2/ExhaustiveSwap2MoveGenerator.cs
r5933 r6377 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 39 40 } 40 41 42 public static IEnumerable<Swap2Move> Generate(Permutation permutation) { 43 int length = permutation.Length; 44 if (length == 1) throw new ArgumentException("ExhaustiveSwap2MoveGenerator: There cannot be an Swap move given a permutation of length 1.", "permutation"); 45 46 for (int i = 0; i < length - 1; i++) 47 for (int j = i + 1; j < length; j++) { 48 yield return new Swap2Move(i, j); 49 } 50 } 51 41 52 public static Swap2Move[] Apply(Permutation permutation) { 42 53 int length = permutation.Length; 43 if (length == 1) throw new ArgumentException("ExhaustiveSwap2MoveGenerator: There cannot be an Swap move given a permutation of length 1.", "permutation");44 54 int totalMoves = (length) * (length - 1) / 2; 45 55 Swap2Move[] moves = new Swap2Move[totalMoves]; 46 56 int count = 0; 47 48 for (int i = 0; i < length - 1; i++) 49 for (int j = i + 1; j < length; j++) { 50 moves[count++] = new Swap2Move(i, j); 51 } 57 foreach (Swap2Move move in Generate(permutation)) { 58 moves[count++] = move; 59 } 52 60 return moves; 53 61 } -
branches/GP.Grammar.Editor/HeuristicLab.Encodings.PermutationEncoding/3.3/Tests/HeuristicLab.Encodings.PermutationEncoding-3.3.Tests.csproj
r5163 r6377 120 120 <Compile Include="TranslocationInversionManipulatorTest.cs" /> 121 121 <Compile Include="TranslocationManipulatorTest.cs" /> 122 <Compile Include="UniformLikeCrossoverTest.cs" /> 122 123 </ItemGroup> 123 124 <ItemGroup> … … 129 130 <Name>HeuristicLab.Collections-3.3</Name> 130 131 </ProjectReference> 132 <ProjectReference Include="..\..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 133 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 134 <Name>HeuristicLab.Common.Resources-3.3</Name> 135 </ProjectReference> 131 136 <ProjectReference Include="..\..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 132 137 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> … … 144 149 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 145 150 <Name>HeuristicLab.Operators-3.3</Name> 151 </ProjectReference> 152 <ProjectReference Include="..\..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 153 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 154 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 146 155 </ProjectReference> 147 156 <ProjectReference Include="..\..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
Note: See TracChangeset
for help on using the changeset viewer.