Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/31/11 11:52:11 (13 years ago)
Author:
abeham
Message:

#1628

  • Updated branch from trunk
  • Changed ReferenceEqualityComparer<T> to become a non-generic class (generic implementation probably was only made because of lacking support for co- and contravariance in C# 3.5)
  • Added finished experiment from sample algorithms to the tests
  • Wrote a unit test to instantiate every IDeepCloneable type, clone it and compare the objects in the object graph for equal references
  • Wrote a unit test to load the experiment, clone it and compare again the objects in the object graph
  • Preliminary fix for a potential bug in ThreadSafeLog
  • Preliminary fix for a potential bug in OperatorGraphVisualizationInfo
  • Preliminary fix for a potential bug in Calculator (and added license headers)
  • Preliminary fix for a potential bug in ScrambleMove
Location:
branches/GeneralizedQAP
Files:
4 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP

  • branches/GeneralizedQAP/HeuristicLab.Encodings.PermutationEncoding

  • branches/GeneralizedQAP/HeuristicLab.Encodings.PermutationEncoding/3.3/HeuristicLab.Encodings.PermutationEncoding-3.3.csproj

    r6342 r6685  
    120120    <Compile Include="Crossovers\UniformLikeCrossover.cs" />
    121121    <Compile Include="HeuristicLabEncodingsPermutationEncodingPlugin.cs" />
     122    <Compile Include="Interfaces\IPermutationScrambleMoveOperator.cs" />
    122123    <Compile Include="Interfaces\IPermutationMultiNeighborhoodShakingOperator.cs" />
    123124    <Compile Include="Interfaces\IPermutationSwap2MoveOperator.cs" />
     
    139140    <Compile Include="Moves\Edge.cs" />
    140141    <Compile Include="Moves\PermutationMoveAttribute.cs" />
     142    <Compile Include="Moves\Scramble\StochasticScrambleMultiMoveGenerator.cs" />
     143    <Compile Include="Moves\Scramble\ScrambleMove.cs" />
     144    <Compile Include="Moves\Scramble\ScrambleMoveGenerator.cs" />
     145    <Compile Include="Moves\Scramble\ScrambleMoveMaker.cs" />
    141146    <Compile Include="Moves\StandardEdgeEqualityComparer.cs" />
    142147    <Compile Include="Moves\Swap2\ExhaustiveSwap2MoveGenerator.cs" />
  • branches/GeneralizedQAP/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/ScrambleManipulator.cs

    r5445 r6685  
    5050    /// <param name="permutation">The permutation to manipulate.</param>
    5151    public static void Apply(IRandom random, Permutation permutation) {
    52       Permutation original = (Permutation)permutation.Clone();
    53 
    5452      int breakPoint1, breakPoint2;
    5553      int[] scrambledIndices, remainingIndices, temp;
    5654      int selectedIndex, index;
    5755
    58       breakPoint1 = random.Next(original.Length - 1);
    59       breakPoint2 = random.Next(breakPoint1 + 1, original.Length);
     56      breakPoint1 = random.Next(permutation.Length - 1);
     57      breakPoint2 = random.Next(breakPoint1 + 1, permutation.Length);
    6058
    6159      scrambledIndices = new int[breakPoint2 - breakPoint1 + 1];
     
    8078      }
    8179
    82       for (int i = 0; i <= (breakPoint2 - breakPoint1); i++) {  // scramble permutation between breakpoints
    83         permutation[breakPoint1 + i] = original[breakPoint1 + scrambledIndices[i]];
     80      Apply(permutation, breakPoint1, scrambledIndices);
     81    }
     82
     83    public static void Apply(Permutation permutation, int startIndex, int[] scrambleArray) {
     84      Permutation original = (Permutation)permutation.Clone();
     85      for (int i = 0; i < scrambleArray.Length; i++) {  // scramble permutation between breakpoints
     86        permutation[startIndex + i] = original[startIndex + scrambleArray[i]];
    8487      }
    8588    }
  • branches/GeneralizedQAP/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/Scramble/ScrambleMove.cs

    r6684 r6685  
    3838      : base(original, cloner) {
    3939      this.StartIndex = original.StartIndex;
    40       this.ScrambledIndices = (int[])original.ScrambledIndices.Clone();
     40      if (original.ScrambledIndices != null)
     41        this.ScrambledIndices = (int[])original.ScrambledIndices.Clone();
    4142    }
    4243    public ScrambleMove() : this(-1, null) { }
Note: See TracChangeset for help on using the changeset viewer.