Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3200 for trunk


Ignore:
Timestamp:
03/23/10 02:44:07 (15 years ago)
Author:
abeham
Message:

Excluded three opt move from the project as it doesn't currently work #889

Location:
trunk/sources
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/HeuristicLab.Encodings.PermutationEncoding-3.3.csproj

    r3104 r3200  
    108108    <Compile Include="Manipulators\TranslocationManipulator.cs" />
    109109    <Compile Include="Moves\ThreeIndexMove.cs" />
    110     <Compile Include="Moves\ThreeOpt\StochasticThreeOptMoveGenerator.cs" />
    111     <Compile Include="Moves\ThreeOpt\ThreeOptMove.cs" />
    112     <Compile Include="Moves\ThreeOpt\ThreeOptMoveGenerator.cs" />
     110    <Compile Include="Moves\ThreeOpt\ThreeOptMove.cs">
     111      <SubType>Code</SubType>
     112    </Compile>
    113113    <Compile Include="Moves\TwoOpt\PreventReaddTwoOptTabuMoveEvaluator.cs" />
    114114    <Compile Include="Moves\TwoOpt\StochasticTwoOptSingleMoveGenerator.cs" />
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/TranslocationManipulator.cs

    r3160 r3200  
    4141    /// <param name="permutation">The permutation array to manipulate.</param>
    4242    public static void Apply(IRandom random, Permutation permutation) {
    43       Permutation original = (Permutation)permutation.Clone();
    4443      int breakPoint1, breakPoint2, insertPoint, insertPointLimit;
    4544
     
    5150      else
    5251        insertPoint = 0;
     52
     53      Apply(permutation, breakPoint1, breakPoint2, insertPoint);
     54    }
     55
     56    public static void Apply(Permutation permutation, int breakPoint1, int breakPoint2, int insertPoint) {
     57      Permutation original = (Permutation)permutation.Clone();
    5358
    5459      int i = 0;  // index in new permutation
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticThreeOptMoveGenerator.cs

    r3074 r3200  
    3030  [Item("StochasticThreeOptMoveGenerator", "Randomly samples n from all possible 3-opt moves from a given permutation.")]
    3131  [StorableClass]
    32   public class StochasticThreeOptMoveGenerator : ThreeOptMoveGenerator, IStochasticOperator {
     32  public class StochasticThreeOptMultiMoveGenerator : ThreeOptMoveGenerator, IStochasticOperator, IMultiMoveGenerator {
    3333    public ILookupParameter<IRandom> RandomParameter {
    3434      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    3535    }
    36     private ValueLookupParameter<IntValue> SampleSizeParameter {
    37       get { return (ValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
     36    public IValueLookupParameter<IntValue> SampleSizeParameter {
     37      get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
    3838    }
    3939
     
    4343    }
    4444
    45     public StochasticThreeOptMoveGenerator()
     45    public StochasticThreeOptMultiMoveGenerator()
    4646      : base() {
    4747      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     
    5151    public static ThreeOptMove[] Apply(Permutation permutation, IRandom random, int sampleSize) {
    5252      int length = permutation.Length;
    53       /*int totalMoves = (length) * (length - 1) / 2 - 3;
    54       // FIXME: Remove this comment if ExhaustiveThreeOptMoveGenerator exists, otherwise alter the exception message below.
    55       if (sampleSize >= totalMoves) throw new InvalidOperationException("StochasticThreeOptMoveGenerator: Sample size (" + sampleSize + ") is larger than the set of all possible moves (" + totalMoves + "), use the ExhaustiveThreeOptMoveGenerator instead.");
    56       */
    5753      ThreeOptMove[] moves = new ThreeOptMove[sampleSize];
    5854      for (int i = 0; i < sampleSize; i++) {
    5955        int index1, index2, index3;
    60         do {
    61           index1 = random.Next(length - 1);
    62           index2 = random.Next(index1 + 1, length);
    63         } while (index2 - index1 == length - 1);
    64         do {
    65           index3 = random.Next(length);
    66         } while (index1 <= index3 && index3 <= index2 + 1);
     56        index1 = random.Next(length - 1);
     57        index2 = random.Next(index1 + 1, length);
     58        index3 = length - index2 + index1 - 1;  // get insertion point in remaining part
     59        if (index3 > 0)
     60          index3 = random.Next(index3);
     61        else
     62          index3 = 0;
    6763        moves[i] = new ThreeOptMove(index1, index2, index3);
    6864      }
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj

    r3159 r3200  
    8787    <Compile Include="Evaluators\TSPGeoPathEvaluator.cs" />
    8888    <Compile Include="HeuristicLabProblemsTravelingSalesmanPlugin.cs" />
     89    <Compile Include="MoveEvaluators\ThreeOptMoveTSPCoordinatesPathEvaluator.cs" />
     90    <Compile Include="MoveEvaluators\ThreeOptMoveTSPRoundedEuclideanPathEvaluator.cs" />
    8991    <Compile Include="TravelingSalesmanProblem.cs" />
    9092    <Compile Include="TSPLIBTourParser.cs" />
Note: See TracChangeset for help on using the changeset viewer.