Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/10 16:29:25 (14 years ago)
Author:
abeham
Message:

#839

  • Added some checks to allow moves in permutation of length 2 or 3.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationSingleMoveGenerator.cs

    r3376 r3706  
    3131  [Item("StochasticTranslocationSingleMoveGenerator", "Randomly samples one from all possible translocation and insertion moves (3-opt) from a given permutation.")]
    3232  [StorableClass]
    33   public class StochasticThreeOptSingleMoveGenerator : TranslocationMoveGenerator, IStochasticOperator, ISingleMoveGenerator {
     33  public class StochasticTranslocationSingleMoveGenerator : TranslocationMoveGenerator, IStochasticOperator, ISingleMoveGenerator {
    3434    public ILookupParameter<IRandom> RandomParameter {
    3535      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    3636    }
    3737
    38     public StochasticThreeOptSingleMoveGenerator()
     38    public StochasticTranslocationSingleMoveGenerator()
    3939      : base() {
    4040      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     
    4343    public static TranslocationMove Apply(Permutation permutation, IRandom random) {
    4444      int length = permutation.Length;
     45      if (length == 1) throw new ArgumentException("StochasticThreeOptSingleMoveGenerator: There cannot be an insertion move given a permutation of length 1.", "permutation");
     46      if (permutation.PermutationType != PermutationTypes.Absolute && length == 2) return new TranslocationMove(0, 0, 1);
    4547      int index1, index2, index3;
    4648      do {
Note: See TracChangeset for help on using the changeset viewer.