Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/07/11 12:49:03 (14 years ago)
Author:
mkommend
Message:

#1479: Merged trunk changes into branch.

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  
    118118    <Compile Include="Crossovers\PartiallyMatchedCrossover.cs" />
    119119    <Compile Include="Crossovers\PositionBasedCrossover.cs" />
     120    <Compile Include="Crossovers\UniformLikeCrossover.cs" />
    120121    <Compile Include="HeuristicLabEncodingsPermutationEncodingPlugin.cs" />
    121122    <Compile Include="Interfaces\IPermutationMultiNeighborhoodShakingOperator.cs" />
     
    179180    <Compile Include="Moves\TwoOpt\StochasticInversionMultiMoveGenerator.cs" />
    180181    <Compile Include="Moves\TwoOpt\StochasticInversionSingleMoveGenerator.cs" />
     182    <Compile Include="PermutationEqualityComparer.cs" />
    181183    <Compile Include="PermutationManipulator.cs" />
    182184    <Compile Include="PermutationCrossover.cs" />
  • branches/GP.Grammar.Editor/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/Swap2/ExhaustiveSwap2MoveGenerator.cs

    r5933 r6377  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    3940    }
    4041
     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
    4152    public static Swap2Move[] Apply(Permutation permutation) {
    4253      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");
    4454      int totalMoves = (length) * (length - 1) / 2;
    4555      Swap2Move[] moves = new Swap2Move[totalMoves];
    4656      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      }
    5260      return moves;
    5361    }
  • branches/GP.Grammar.Editor/HeuristicLab.Encodings.PermutationEncoding/3.3/Tests/HeuristicLab.Encodings.PermutationEncoding-3.3.Tests.csproj

    r5163 r6377  
    120120    <Compile Include="TranslocationInversionManipulatorTest.cs" />
    121121    <Compile Include="TranslocationManipulatorTest.cs" />
     122    <Compile Include="UniformLikeCrossoverTest.cs" />
    122123  </ItemGroup>
    123124  <ItemGroup>
     
    129130      <Name>HeuristicLab.Collections-3.3</Name>
    130131    </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>
    131136    <ProjectReference Include="..\..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    132137      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
     
    144149      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    145150      <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>
    146155    </ProjectReference>
    147156    <ProjectReference Include="..\..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
Note: See TracChangeset for help on using the changeset viewer.