Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/29/10 18:49:55 (14 years ago)
Author:
abeham
Message:

Renamed operators according to the underlying operation #889

Location:
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves
Files:
1 added
1 deleted
21 moved

Legend:

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

    r3231 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("ThreeOptPreventEdgeRemovalAndReadding", "Prevents readding of previously deleted edges as well as deleting previously added edges.")]
     31  [Item("PreventReaddAndRemovalTranslocationMoveTabuChecker", "Prevents readding of previously deleted edges as well as deleting previously added edges.")]
    3232  [StorableClass]
    33   public class PreventReaddDeleteThreeOptTabuMoveEvaluator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, ITabuMoveEvaluator {
     33  public class PreventReaddAndRemovalTranslocationMoveTabuChecker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, ITabuChecker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
    3636    }
    37     public ILookupParameter<ThreeOptMove> ThreeOptMoveParameter {
    38       get { return (LookupParameter<ThreeOptMove>)Parameters["ThreeOptMove"]; }
     37    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
     38      get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
    3939    }
    4040    public ILookupParameter<Permutation> PermutationParameter {
     
    5151    }
    5252
    53     public PreventReaddDeleteThreeOptTabuMoveEvaluator()
     53    public PreventReaddAndRemovalTranslocationMoveTabuChecker()
    5454      : base() {
    55       Parameters.Add(new LookupParameter<ThreeOptMove>("ThreeOptMove", "The move to evaluate."));
     55      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
    5656      Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu."));
    5757      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    6262    public override IOperation Apply() {
    6363      ItemList<IItem> tabuList = TabuListParameter.ActualValue;
    64       ThreeOptMove move = ThreeOptMoveParameter.ActualValue;
     64      TranslocationMove move = TranslocationMoveParameter.ActualValue;
    6565      Permutation permutation = PermutationParameter.ActualValue;
    6666      int length = permutation.Length;
     
    8383      if (!isTabu) {
    8484        foreach (IItem tabuMove in tabuList) {
    85           ThreeOptTabuMoveAttribute attribute = (tabuMove as ThreeOptTabuMoveAttribute);
     85          TranslocationMoveAttribute attribute = (tabuMove as TranslocationMoveAttribute);
    8686          if (attribute != null) {
    8787            // if previously deleted Edge1Source-Target is readded
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/PreventReaddTranslocationMoveTabuChecker.cs

    r3231 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("ThreeOptPreventEdgeReadding", "Prevents readding of previously deleted edges.")]
     31  [Item("PreventReaddTranslocationMoveTabuChecker", "Prevents readding of previously deleted edges.")]
    3232  [StorableClass]
    33   public class PreventReaddThreeOptTabuMoveEvaluator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, ITabuMoveEvaluator {
     33  public class PreventReaddTranslocationMoveTabuChecker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, ITabuChecker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
    3636    }
    37     public ILookupParameter<ThreeOptMove> ThreeOptMoveParameter {
    38       get { return (LookupParameter<ThreeOptMove>)Parameters["ThreeOptMove"]; }
     37    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
     38      get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
    3939    }
    4040    public ILookupParameter<Permutation> PermutationParameter {
     
    5151    }
    5252
    53     public PreventReaddThreeOptTabuMoveEvaluator()
     53    public PreventReaddTranslocationMoveTabuChecker()
    5454      : base() {
    55       Parameters.Add(new LookupParameter<ThreeOptMove>("ThreeOptMove", "The move to evaluate."));
     55      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
    5656      Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu."));
    5757      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    6262    public override IOperation Apply() {
    6363      ItemList<IItem> tabuList = TabuListParameter.ActualValue;
    64       ThreeOptMove move = ThreeOptMoveParameter.ActualValue;
     64      TranslocationMove move = TranslocationMoveParameter.ActualValue;
    6565      Permutation permutation = PermutationParameter.ActualValue;
    6666      int length = permutation.Length;
     
    8383      if (!isTabu) {
    8484        foreach (IItem tabuMove in tabuList) {
    85           ThreeOptTabuMoveAttribute attribute = (tabuMove as ThreeOptTabuMoveAttribute);
     85          TranslocationMoveAttribute attribute = (tabuMove as TranslocationMoveAttribute);
    8686          if (attribute != null) {
    8787            // if previously deleted Edge1Source-Target is readded
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/PreventRemovalTranslocationMoveTabuChecker.cs

    r3231 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("ThreeOptPreventEdgeRemoval", "Prevents deleting of previously added edges.")]
     31  [Item("PreventRemovalTranslocationMoveTabuChecker", "Prevents deleting of previously added edges.")]
    3232  [StorableClass]
    33   public class PreventDeleteThreeOptTabuMoveEvaluator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, ITabuMoveEvaluator {
     33  public class PreventRemovalTranslocationMoveTabuChecker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, ITabuChecker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
    3636    }
    37     public ILookupParameter<ThreeOptMove> ThreeOptMoveParameter {
    38       get { return (LookupParameter<ThreeOptMove>)Parameters["ThreeOptMove"]; }
     37    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
     38      get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
    3939    }
    4040    public ILookupParameter<Permutation> PermutationParameter {
     
    5151    }
    5252
    53     public PreventDeleteThreeOptTabuMoveEvaluator()
     53    public PreventRemovalTranslocationMoveTabuChecker()
    5454      : base() {
    55       Parameters.Add(new LookupParameter<ThreeOptMove>("ThreeOptMove", "The move to evaluate."));
     55      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
    5656      Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu."));
    5757      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    6262    public override IOperation Apply() {
    6363      ItemList<IItem> tabuList = TabuListParameter.ActualValue;
    64       ThreeOptMove move = ThreeOptMoveParameter.ActualValue;
     64      TranslocationMove move = TranslocationMoveParameter.ActualValue;
    6565      Permutation permutation = PermutationParameter.ActualValue;
    6666      int length = permutation.Length;
     
    8383      if (!isTabu) {
    8484        foreach (IItem tabuMove in tabuList) {
    85           ThreeOptTabuMoveAttribute attribute = (tabuMove as ThreeOptTabuMoveAttribute);
     85          TranslocationMoveAttribute attribute = (tabuMove as TranslocationMoveAttribute);
    8686          if (attribute != null) {
    8787            // if previously added Edge3Source-Edge1Target is deleted
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationMultiMoveGenerator.cs

    r3231 r3232  
    2828
    2929namespace HeuristicLab.Encodings.PermutationEncoding {
    30   [Item("StochasticThreeOptMultiMoveGenerator", "Randomly samples n from all possible 3-opt moves from a given permutation.")]
     30  [Item("StochasticTranslocationMultiMoveGenerator", "Randomly samples n from all possible translocation and insertion moves (3-opt) from a given permutation.")]
    3131  [StorableClass]
    32   public class StochasticThreeOptMultiMoveGenerator : ThreeOptMoveGenerator, IStochasticOperator, IMultiMoveGenerator {
     32  public class StochasticTranslocationMultiMoveGenerator : TranslocationMoveGenerator, IStochasticOperator, IMultiMoveGenerator {
    3333    public ILookupParameter<IRandom> RandomParameter {
    3434      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     
    4343    }
    4444
    45     public StochasticThreeOptMultiMoveGenerator()
     45    public StochasticTranslocationMultiMoveGenerator()
    4646      : base() {
    4747      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     
    4949    }
    5050
    51     public static ThreeOptMove[] Apply(Permutation permutation, IRandom random, int sampleSize) {
     51    public static TranslocationMove[] Apply(Permutation permutation, IRandom random, int sampleSize) {
    5252      int length = permutation.Length;
    53       ThreeOptMove[] moves = new ThreeOptMove[sampleSize];
     53      TranslocationMove[] moves = new TranslocationMove[sampleSize];
    5454      for (int i = 0; i < sampleSize; i++) {
    5555        moves[i] = StochasticThreeOptSingleMoveGenerator.Apply(permutation, random);
     
    5858    }
    5959
    60     protected override ThreeOptMove[] GenerateMoves(Permutation permutation) {
     60    protected override TranslocationMove[] GenerateMoves(Permutation permutation) {
    6161      IRandom random = RandomParameter.ActualValue;
    6262      return Apply(permutation, random, SampleSizeParameter.ActualValue.Value);
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationSingleMoveGenerator.cs

    r3231 r3232  
    2828
    2929namespace HeuristicLab.Encodings.PermutationEncoding {
    30   [Item("StochasticThreeOptSingleMoveGenerator", "Randomly samples one from all possible 3-opt moves from a given permutation.")]
     30  [Item("StochasticTranslocationSingleMoveGenerator", "Randomly samples one from all possible translocation and insertion moves (3-opt) from a given permutation.")]
    3131  [StorableClass]
    32   public class StochasticThreeOptSingleMoveGenerator : ThreeOptMoveGenerator, IStochasticOperator, ISingleMoveGenerator {
     32  public class StochasticThreeOptSingleMoveGenerator : TranslocationMoveGenerator, IStochasticOperator, ISingleMoveGenerator {
    3333    public ILookupParameter<IRandom> RandomParameter {
    3434      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     
    4040    }
    4141
    42     public static ThreeOptMove Apply(Permutation permutation, IRandom random) {
     42    public static TranslocationMove Apply(Permutation permutation, IRandom random) {
    4343      int length = permutation.Length;
    4444      int index1, index2, index3;
     
    5151      } while (index3 == index1);
    5252     
    53       return new ThreeOptMove(index1, index2, index3);
     53      return new TranslocationMove(index1, index2, index3);
    5454    }
    5555
    56     protected override ThreeOptMove[] GenerateMoves(Permutation permutation) {
     56    protected override TranslocationMove[] GenerateMoves(Permutation permutation) {
    5757      IRandom random = RandomParameter.ActualValue;
    58       return new ThreeOptMove[] { Apply(permutation, random) };
     58      return new TranslocationMove[] { Apply(permutation, random) };
    5959    }
    6060  }
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMove.cs

    r3231 r3232  
    2424
    2525namespace HeuristicLab.Encodings.PermutationEncoding {
    26   [Item("ThreeOptMove", "A move that changes three edges by performing a translocation.")]
     26  [Item("TranslocationMove", "A move that changes three edges by performing a translocation.")]
    2727  [StorableClass]
    28   public class ThreeOptMove : ThreeIndexMove {
    29     public ThreeOptMove()
     28  public class TranslocationMove : ThreeIndexMove {
     29    public TranslocationMove()
    3030      : base() {
    3131    }
    3232
    33     public ThreeOptMove(int index1, int index2, int index3)
     33    public TranslocationMove(int index1, int index2, int index3)
    3434      : base(index1, index2, index3, null) {
    3535    }
    3636
    37     public ThreeOptMove(int index1, int index2, int index3, Permutation permutation)
     37    public TranslocationMove(int index1, int index2, int index3, Permutation permutation)
    3838      : base(index1, index2, index3, permutation) {
    3939    }
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveAttribute.cs

    r3231 r3232  
    2424
    2525namespace HeuristicLab.Encodings.PermutationEncoding {
    26   [Item("ThreeOptTabuMoveAttribute", "Specifies the tabu attributes for a 3-opt move.")]
     26  [Item("TranslocationMoveAttribute", "Specifies the tabu attributes for a translocation and insertion move (3-opt).")]
    2727  [StorableClass]
    28   public class ThreeOptTabuMoveAttribute : Item {
     28  public class TranslocationMoveAttribute : Item {
    2929    [Storable]
    3030    public int Edge1Source { get; private set; }
     
    4141
    4242    [StorableConstructor]
    43     private ThreeOptTabuMoveAttribute(bool deserializing)
     43    private TranslocationMoveAttribute(bool deserializing)
    4444      : base() {
    4545    }
    4646
    47     public ThreeOptTabuMoveAttribute()
     47    public TranslocationMoveAttribute()
    4848      : this(-1, -1, -1, -1, -1, -1) { }
    4949
    50     public ThreeOptTabuMoveAttribute(int edge1Source, int edge1Target, int edge2Source, int edge2Target, int edge3Source, int edge3Target)
     50    public TranslocationMoveAttribute(int edge1Source, int edge1Target, int edge2Source, int edge2Target, int edge3Source, int edge3Target)
    5151      : base() {
    5252      Edge1Source = edge1Source;
     
    5959
    6060    public override IDeepCloneable Clone(Cloner cloner) {
    61       ThreeOptTabuMoveAttribute clone = (ThreeOptTabuMoveAttribute)base.Clone(cloner);
     61      TranslocationMoveAttribute clone = (TranslocationMoveAttribute)base.Clone(cloner);
    6262      clone.Edge1Source = Edge1Source;
    6363      clone.Edge1Target = Edge1Target;
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveGenerator.cs

    r3231 r3232  
    2828
    2929namespace HeuristicLab.Encodings.PermutationEncoding {
    30   [Item("ThreeOptMoveGenerator", "Base class for move generators that produce 3-opt moves.")]
     30  [Item("TranslocationMoveGenerator", "Base class for move generators that produce translocation moves (3-opt).")]
    3131  [StorableClass]
    32   public abstract class ThreeOptMoveGenerator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, IMoveGenerator {
     32  public abstract class TranslocationMoveGenerator : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, IMoveGenerator {
    3333    public override bool CanChangeName {
    3434      get { return false; }
     
    3737      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
    3838    }
    39     public ILookupParameter<ThreeOptMove> ThreeOptMoveParameter {
    40       get { return (LookupParameter<ThreeOptMove>)Parameters["ThreeOptMove"]; }
     39    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
     40      get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
    4141    }
    4242    protected ScopeParameter CurrentScopeParameter {
     
    4444    }
    4545
    46     public ThreeOptMoveGenerator()
     46    public TranslocationMoveGenerator()
    4747      : base() {
    4848      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation for which moves should be generated."));
    49       Parameters.Add(new LookupParameter<ThreeOptMove>("ThreeOptMove", "The moves that should be generated in subscopes."));
     49      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The moves that should be generated in subscopes."));
    5050      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
    5151    }
     
    5353    public override IOperation Apply() {
    5454      Permutation p = PermutationParameter.ActualValue;
    55       ThreeOptMove[] moves = GenerateMoves(p);
     55      TranslocationMove[] moves = GenerateMoves(p);
    5656      Scope[] moveScopes = new Scope[moves.Length];
    5757      for (int i = 0; i < moveScopes.Length; i++) {
    5858        moveScopes[i] = new Scope(i.ToString());
    59         moveScopes[i].Variables.Add(new Variable(ThreeOptMoveParameter.ActualName, moves[i]));
     59        moveScopes[i].Variables.Add(new Variable(TranslocationMoveParameter.ActualName, moves[i]));
    6060      }
    6161      CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes);
     
    6363    }
    6464
    65     protected abstract ThreeOptMove[] GenerateMoves(Permutation permutation);
     65    protected abstract TranslocationMove[] GenerateMoves(Permutation permutation);
    6666  }
    6767}
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveMaker.cs

    r3231 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("ThreeOptMoveMaker", "Peforms a 3-opt move on a given permutation and updates the quality.")]
     31  [Item("TranslocationMoveMaker", "Peforms a translocation or insertion move (3-opt) on a given permutation and updates the quality.")]
    3232  [StorableClass]
    33   public class ThreeOptMoveMaker : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, IMoveMaker {
     33  public class TranslocationMoveMaker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, IMoveMaker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
     
    4141      get { return (ILookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
    4242    }
    43     public ILookupParameter<ThreeOptMove> ThreeOptMoveParameter {
    44       get { return (ILookupParameter<ThreeOptMove>)Parameters["ThreeOptMove"]; }
     43    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
     44      get { return (ILookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
    4545    }
    4646    public ILookupParameter<Permutation> PermutationParameter {
     
    4848    }
    4949
    50     public ThreeOptMoveMaker()
     50    public TranslocationMoveMaker()
    5151      : base() {
    5252      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the solution."));
    53       Parameters.Add(new LookupParameter<ThreeOptMove>("ThreeOptMove", "The move to evaluate."));
     53      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
    5454      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move."));
    5555      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    5757
    5858    public override IOperation Apply() {
    59       ThreeOptMove move = ThreeOptMoveParameter.ActualValue;
     59      TranslocationMove move = TranslocationMoveParameter.ActualValue;
    6060      Permutation permutation = PermutationParameter.ActualValue;
    6161      DoubleValue moveQuality = MoveQualityParameter.ActualValue;
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveTabuMaker.cs

    r3231 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("ThreeOptTabuMoveMaker", "Declares a given 3-opt move as tabu, by adding its attributes to the tabu list. It also removes the oldest entry in the tabu list when its size is greater than tenure.")]
     31  [Item("TranslocationMoveTabuMaker", "Declares a given translocation or insertion move (3-opt) as tabu, by adding its attributes to the tabu list.")]
    3232  [StorableClass]
    33   public class ThreeOptTabuMoveMaker : TabuMoveMaker, IThreeOptPermutationMoveOperator {
     33  public class TranslocationMoveTabuMaker : TabuMaker, IPermutationTranslocationMoveOperator {
    3434    public override bool CanChangeName {
    3535      get { return false; }
     
    3838      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
    3939    }
    40     public ILookupParameter<ThreeOptMove> ThreeOptMoveParameter {
    41       get { return (LookupParameter<ThreeOptMove>)Parameters["ThreeOptMove"]; }
     40    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
     41      get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
    4242    }
    4343
    44     public ThreeOptTabuMoveMaker()
     44    public TranslocationMoveTabuMaker()
    4545      : base() {
    46       Parameters.Add(new LookupParameter<ThreeOptMove>("ThreeOptMove", "The move that was made."));
     46      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move that was made."));
    4747      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
    4848    }
    4949
    5050    protected override IItem GetTabuAttribute() {
    51       ThreeOptMove move = ThreeOptMoveParameter.ActualValue;
     51      TranslocationMove move = TranslocationMoveParameter.ActualValue;
    5252      Permutation permutation = PermutationParameter.ActualValue;
    5353      if (move.Index3 > move.Index1)
    54         return new ThreeOptTabuMoveAttribute(permutation.GetCircular(move.Index1 - 1),
     54        return new TranslocationMoveAttribute(permutation.GetCircular(move.Index1 - 1),
    5555        permutation[move.Index1],
    5656        permutation[move.Index2],
     
    5959        permutation.GetCircular(move.Index3 + move.Index2 - move.Index1 + 1));
    6060      else
    61         return new ThreeOptTabuMoveAttribute(permutation.GetCircular(move.Index1 - 1),
     61        return new TranslocationMoveAttribute(permutation.GetCircular(move.Index1 - 1),
    6262        permutation[move.Index1],
    6363        permutation[move.Index2],
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveInversionMoveGenerator.cs

    r3229 r3232  
    2626
    2727namespace HeuristicLab.Encodings.PermutationEncoding {
    28   [Item("ExhaustiveTwoOptMoveGenerator", "Generates all possible 2-opt moves (inversion) from a given permutation.")]
     28  [Item("ExhaustiveInversionMoveGenerator", "Generates all possible inversion moves (2-opt) from a given permutation.")]
    2929  [StorableClass]
    30   public class ExhaustiveTwoOptMoveGenerator : TwoOptMoveGenerator, IExhaustiveMoveGenerator {
    31     public static TwoOptMove[] Apply(Permutation permutation) {
     30  public class ExhaustiveInversionMoveGenerator : InversionMoveGenerator, IExhaustiveMoveGenerator {
     31    public static InversionMove[] Apply(Permutation permutation) {
    3232      int length = permutation.Length;
    3333      int totalMoves = (length) * (length - 1) / 2; // - 3;
    34       TwoOptMove[] moves = new TwoOptMove[totalMoves];
     34      InversionMove[] moves = new InversionMove[totalMoves];
    3535      int count = 0;
    3636      for (int i = 0; i < length - 1; i++)
     
    3939          /*if (i == 0 && j >= length - 2) continue;
    4040          else if (i == 1 && j >= length - 1) continue;*/
    41           moves[count++] = new TwoOptMove(i, j);
     41          moves[count++] = new InversionMove(i, j);
    4242        }
    4343      return moves;
    4444    }
    4545
    46     protected override TwoOptMove[] GenerateMoves(Permutation permutation) {
     46    protected override InversionMove[] GenerateMoves(Permutation permutation) {
    4747      return Apply(permutation);
    4848    }
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMove.cs

    r3229 r3232  
    2424
    2525namespace HeuristicLab.Encodings.PermutationEncoding {
    26   [Item("TwoOptMove", "Item that describes a 2-Opt move.")]
     26  [Item("InversionMove", "Item that describes an inversion move (2-opt).")]
    2727  [StorableClass]
    28   public class TwoOptMove : TwoIndexMove {
    29     public TwoOptMove()
     28  public class InversionMove : TwoIndexMove {
     29    public InversionMove()
    3030      : base() {
    3131    }
    3232
    33     public TwoOptMove(int index1, int index2)
     33    public InversionMove(int index1, int index2)
    3434      : base(index1, index2, null) {
    3535    }
    3636
    37     public TwoOptMove(int index1, int index2, Permutation permutation)
     37    public InversionMove(int index1, int index2, Permutation permutation)
    3838      : base(index1, index2, permutation) {
    3939    }
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveAttribute.cs

    r3229 r3232  
    2424
    2525namespace HeuristicLab.Encodings.PermutationEncoding {
    26   [Item("TwoOptTabuMoveAttribute", "Specifies the tabu attributes for a 2-opt move.")]
     26  [Item("InversionMoveAttribute", "Specifies the tabu attributes for an inversion move (2-opt).")]
    2727  [StorableClass]
    28   public class TwoOptTabuMoveAttribute : Item {
     28  public class InversionMoveAttribute : Item {
    2929    [Storable]
    3030    public int Edge1Source { get; private set; }
     
    3737
    3838    [StorableConstructor]
    39     private TwoOptTabuMoveAttribute(bool deserializing)
     39    private InversionMoveAttribute(bool deserializing)
    4040      : base() {
    4141    }
    4242
    43     public TwoOptTabuMoveAttribute()
     43    public InversionMoveAttribute()
    4444      : this(-1, -1, -1, -1) { }
    4545
    46     public TwoOptTabuMoveAttribute(int edge1Source, int edge1Target, int edge2Source, int edge2Target)
     46    public InversionMoveAttribute(int edge1Source, int edge1Target, int edge2Source, int edge2Target)
    4747      : base() {
    4848      Edge1Source = edge1Source;
     
    5353
    5454    public override IDeepCloneable Clone(Cloner cloner) {
    55       TwoOptTabuMoveAttribute clone = (TwoOptTabuMoveAttribute)base.Clone(cloner);
     55      InversionMoveAttribute clone = (InversionMoveAttribute)base.Clone(cloner);
    5656      clone.Edge1Source = Edge1Source;
    5757      clone.Edge1Target = Edge1Target;
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveGenerator.cs

    r3229 r3232  
    2828
    2929namespace HeuristicLab.Encodings.PermutationEncoding {
    30   [Item("TwoOptMoveGenerator", "Base class for all 2-opt move generators.")]
     30  [Item("InversionMoveGenerator", "Base class for all inversion (2-opt) move generators.")]
    3131  [StorableClass]
    32   public abstract class TwoOptMoveGenerator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, IMoveGenerator {
     32  public abstract class InversionMoveGenerator : SingleSuccessorOperator, IPermutationInversionMoveOperator, IMoveGenerator {
    3333    public override bool CanChangeName {
    3434      get { return false; }
     
    3737      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
    3838    }
    39     public ILookupParameter<TwoOptMove> TwoOptMoveParameter {
    40       get { return (LookupParameter<TwoOptMove>)Parameters["TwoOptMove"]; }
     39    public ILookupParameter<InversionMove> InversionMoveParameter {
     40      get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; }
    4141    }
    4242    protected ScopeParameter CurrentScopeParameter {
     
    4444    }
    4545
    46     public TwoOptMoveGenerator()
     46    public InversionMoveGenerator()
    4747      : base() {
    4848      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation for which moves should be generated."));
    49       Parameters.Add(new LookupParameter<TwoOptMove>("TwoOptMove", "The moves that should be generated in subscopes."));
     49      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The moves that should be generated in subscopes."));
    5050      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
    5151    }
     
    5353    public override IOperation Apply() {
    5454      Permutation p = PermutationParameter.ActualValue;
    55       TwoOptMove[] moves = GenerateMoves(p);
     55      InversionMove[] moves = GenerateMoves(p);
    5656      Scope[] moveScopes = new Scope[moves.Length];
    5757      for (int i = 0; i < moveScopes.Length; i++) {
    5858        moveScopes[i] = new Scope(i.ToString());
    59         moveScopes[i].Variables.Add(new Variable(TwoOptMoveParameter.ActualName, moves[i]));
     59        moveScopes[i].Variables.Add(new Variable(InversionMoveParameter.ActualName, moves[i]));
    6060      }
    6161      CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes);
     
    6363    }
    6464
    65     protected abstract TwoOptMove[] GenerateMoves(Permutation permutation);
     65    protected abstract InversionMove[] GenerateMoves(Permutation permutation);
    6666  }
    6767}
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveMaker.cs

    r3229 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("TwoOptMoveMaker", "Peforms a 2-opt move on a given permutation and updates the quality.")]
     31  [Item("InversionMoveMaker", "Peforms an inversion move (2-opt) on a given permutation and updates the quality.")]
    3232  [StorableClass]
    33   public class TwoOptMoveMaker : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, IMoveMaker {
     33  public class InversionMoveMaker : SingleSuccessorOperator, IPermutationInversionMoveOperator, IMoveMaker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
     
    4141      get { return (ILookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
    4242    }
    43     public ILookupParameter<TwoOptMove> TwoOptMoveParameter {
    44       get { return (ILookupParameter<TwoOptMove>)Parameters["TwoOptMove"]; }
     43    public ILookupParameter<InversionMove> InversionMoveParameter {
     44      get { return (ILookupParameter<InversionMove>)Parameters["InversionMove"]; }
    4545    }
    4646    public ILookupParameter<Permutation> PermutationParameter {
     
    4848    }
    4949
    50     public TwoOptMoveMaker()
     50    public InversionMoveMaker()
    5151      : base() {
    5252      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the solution."));
    53       Parameters.Add(new LookupParameter<TwoOptMove>("TwoOptMove", "The move to evaluate."));
     53      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate."));
    5454      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move."));
    5555      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    5757
    5858    public override IOperation Apply() {
    59       TwoOptMove move = TwoOptMoveParameter.ActualValue;
     59      InversionMove move = InversionMoveParameter.ActualValue;
    6060      Permutation permutation = PermutationParameter.ActualValue;
    6161      DoubleValue moveQuality = MoveQualityParameter.ActualValue;
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveTabuMaker.cs

    r3229 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("TwoOptTabuMoveMaker", "Declares a given 2-opt move as tabu, by adding its attributes to the tabu list. It also removes the oldest entry in the tabu list when its size is greater than tenure.")]
     31  [Item("InversionMoveTabuMaker", "Declares a given inversion move (2-opt) as tabu, by adding its attributes to the tabu list.")]
    3232  [StorableClass]
    33   public class TwoOptTabuMoveMaker : TabuMoveMaker, ITwoOptPermutationMoveOperator {
     33  public class InversionMoveTabuMaker : TabuMaker, IPermutationInversionMoveOperator {
    3434    public override bool CanChangeName {
    3535      get { return false; }
     
    3838      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
    3939    }
    40     public ILookupParameter<TwoOptMove> TwoOptMoveParameter {
    41       get { return (LookupParameter<TwoOptMove>)Parameters["TwoOptMove"]; }
     40    public ILookupParameter<InversionMove> InversionMoveParameter {
     41      get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; }
    4242    }
    4343
    44     public TwoOptTabuMoveMaker()
     44    public InversionMoveTabuMaker()
    4545      : base() {
    46       Parameters.Add(new LookupParameter<TwoOptMove>("TwoOptMove", "The move that was made."));
     46      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move that was made."));
    4747      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
    4848    }
    4949
    5050    protected override IItem GetTabuAttribute() {
    51       TwoOptMove move = TwoOptMoveParameter.ActualValue;
     51      InversionMove move = InversionMoveParameter.ActualValue;
    5252      Permutation permutation = PermutationParameter.ActualValue;
    53       return new TwoOptTabuMoveAttribute( permutation.GetCircular(move.Index1 - 1),
     53      return new InversionMoveAttribute( permutation.GetCircular(move.Index1 - 1),
    5454        permutation[move.Index1],
    5555        permutation[move.Index2],
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/PreventReaddAndRemovalInversionMoveTabuChecker.cs

    r3229 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("TwoOptPreventEdgeRemovalAndReadding", "Prevents readding of previously deleted edges as well as deleting previously added edges.")]
     31  [Item("PreventReaddAndRemovalInversionMoveTabuChecker", "Prevents readding of previously deleted edges as well as deleting previously added edges.")]
    3232  [StorableClass]
    33   public class PreventReaddDeleteTwoOptTabuMoveEvaluator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, ITabuMoveEvaluator {
     33  public class PreventReaddAndRemovalInversionMoveTabuChecker : SingleSuccessorOperator, IPermutationInversionMoveOperator, ITabuChecker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
    3636    }
    37     public ILookupParameter<TwoOptMove> TwoOptMoveParameter {
    38       get { return (LookupParameter<TwoOptMove>)Parameters["TwoOptMove"]; }
     37    public ILookupParameter<InversionMove> InversionMoveParameter {
     38      get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; }
    3939    }
    4040    public ILookupParameter<Permutation> PermutationParameter {
     
    5151    }
    5252
    53     public PreventReaddDeleteTwoOptTabuMoveEvaluator()
     53    public PreventReaddAndRemovalInversionMoveTabuChecker()
    5454      : base() {
    55       Parameters.Add(new LookupParameter<TwoOptMove>("TwoOptMove", "The move to evaluate."));
     55      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate."));
    5656      Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu."));
    5757      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    6262    public override IOperation Apply() {
    6363      ItemList<IItem> tabuList = TabuListParameter.ActualValue;
    64       TwoOptMove move = TwoOptMoveParameter.ActualValue;
     64      InversionMove move = InversionMoveParameter.ActualValue;
    6565      Permutation permutation = PermutationParameter.ActualValue;
    6666      int length = permutation.Length;
     
    7272      if (!isTabu) {
    7373        foreach (IItem tabuMove in tabuList) {
    74           TwoOptTabuMoveAttribute attribute = (tabuMove as TwoOptTabuMoveAttribute);
     74          InversionMoveAttribute attribute = (tabuMove as InversionMoveAttribute);
    7575          if (attribute != null) {
    7676            // if previously deleted Edge1Source-Target is readded
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/PreventReaddInversionMoveTabuChecker.cs

    r3229 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("TwoOptPreventEdgeReadding", "Prevents readding of previously deleted edges, but allows deleting previously added edges.")]
     31  [Item("PreventReaddInversionMoveTabuChecker", "Prevents readding of previously deleted edges, but allows deleting previously added edges.")]
    3232  [StorableClass]
    33   public class PreventReaddTwoOptTabuMoveEvaluator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, ITabuMoveEvaluator {
     33  public class PreventReaddInversionMoveTabuChecker : SingleSuccessorOperator, IPermutationInversionMoveOperator, ITabuChecker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
    3636    }
    37     public ILookupParameter<TwoOptMove> TwoOptMoveParameter {
    38       get { return (LookupParameter<TwoOptMove>)Parameters["TwoOptMove"]; }
     37    public ILookupParameter<InversionMove> InversionMoveParameter {
     38      get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; }
    3939    }
    4040    public ILookupParameter<Permutation> PermutationParameter {
     
    5151    }
    5252
    53     public PreventReaddTwoOptTabuMoveEvaluator()
     53    public PreventReaddInversionMoveTabuChecker()
    5454      : base() {
    55       Parameters.Add(new LookupParameter<TwoOptMove>("TwoOptMove", "The move to evaluate."));
     55      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate."));
    5656      Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu."));
    5757      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    6262    public override IOperation Apply() {
    6363      ItemList<IItem> tabuList = TabuListParameter.ActualValue;
    64       TwoOptMove move = TwoOptMoveParameter.ActualValue;
     64      InversionMove move = InversionMoveParameter.ActualValue;
    6565      Permutation permutation = PermutationParameter.ActualValue;
    6666      int length = permutation.Length;
     
    7272      if (!isTabu) {
    7373        foreach (IItem tabuMove in tabuList) {
    74           TwoOptTabuMoveAttribute attribute = (tabuMove as TwoOptTabuMoveAttribute);
     74          InversionMoveAttribute attribute = (tabuMove as InversionMoveAttribute);
    7575          if (attribute != null) {
    7676            // if previously deleted Edge1Source-Target is readded
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/PreventRemovalInversionMoveTabuChecker.cs

    r3229 r3232  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("TwoOptPreventEdgeRemoval", "Prevents deleting of previously added edges.")]
     31  [Item("PreventRemovalInversionMoveTabuChecker", "Prevents deleting of previously added edges.")]
    3232  [StorableClass]
    33   public class PreventDeleteTwoOptTabuMoveEvaluator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, ITabuMoveEvaluator {
     33  public class PreventRemovalInversionMoveTabuChecker : SingleSuccessorOperator, IPermutationInversionMoveOperator, ITabuChecker {
    3434    public override bool CanChangeName {
    3535      get { return false; }
    3636    }
    37     public ILookupParameter<TwoOptMove> TwoOptMoveParameter {
    38       get { return (LookupParameter<TwoOptMove>)Parameters["TwoOptMove"]; }
     37    public ILookupParameter<InversionMove> InversionMoveParameter {
     38      get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; }
    3939    }
    4040    public ILookupParameter<Permutation> PermutationParameter {
     
    5151    }
    5252
    53     public PreventDeleteTwoOptTabuMoveEvaluator()
     53    public PreventRemovalInversionMoveTabuChecker()
    5454      : base() {
    55       Parameters.Add(new LookupParameter<TwoOptMove>("TwoOptMove", "The move to evaluate."));
     55      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate."));
    5656      Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu."));
    5757      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
     
    6262    public override IOperation Apply() {
    6363      ItemList<IItem> tabuList = TabuListParameter.ActualValue;
    64       TwoOptMove move = TwoOptMoveParameter.ActualValue;
     64      InversionMove move = InversionMoveParameter.ActualValue;
    6565      Permutation permutation = PermutationParameter.ActualValue;
    6666      int length = permutation.Length;
     
    7272      if (!isTabu) {
    7373        foreach (IItem tabuMove in tabuList) {
    74           TwoOptTabuMoveAttribute attribute = (tabuMove as TwoOptTabuMoveAttribute);
     74          InversionMoveAttribute attribute = (tabuMove as InversionMoveAttribute);
    7575          if (attribute != null) {
    7676            // if previously added Edge1Source-Edge2Source is deleted
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/StochasticInversionMultiMoveGenerator.cs

    r3229 r3232  
    2828
    2929namespace HeuristicLab.Encodings.PermutationEncoding {
    30   [Item("StochasticTwoOptMultiMoveGenerator", "Randomly samples n from all possible 2-opt moves (inversion) from a given permutation.")]
     30  [Item("StochasticInversionMultiMoveGenerator", "Randomly samples n from all possible inversion moves (2-opt) from a given permutation.")]
    3131  [StorableClass]
    32   public class StochasticTwoOptMultiMoveGenerator : TwoOptMoveGenerator, IMultiMoveGenerator, IStochasticOperator {
     32  public class StochasticInversionMultiMoveGenerator : InversionMoveGenerator, IMultiMoveGenerator, IStochasticOperator {
    3333    public ILookupParameter<IRandom> RandomParameter {
    3434      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     
    4343    }
    4444
    45     public StochasticTwoOptMultiMoveGenerator()
     45    public StochasticInversionMultiMoveGenerator()
    4646      : base() {
    4747      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     
    4949    }
    5050
    51     public static TwoOptMove[] Apply(Permutation permutation, IRandom random, int sampleSize) {
     51    public static InversionMove[] Apply(Permutation permutation, IRandom random, int sampleSize) {
    5252      int length = permutation.Length;
    53       TwoOptMove[] moves = new TwoOptMove[sampleSize];
     53      InversionMove[] moves = new InversionMove[sampleSize];
    5454      for (int i = 0; i < sampleSize; i++) {
    55         moves[i] = StochasticTwoOptSingleMoveGenerator.Apply(permutation, random);
     55        moves[i] = StochasticInversionSingleMoveGenerator.Apply(permutation, random);
    5656      }
    5757      return moves;
    5858    }
    5959
    60     protected override TwoOptMove[] GenerateMoves(Permutation permutation) {
     60    protected override InversionMove[] GenerateMoves(Permutation permutation) {
    6161      IRandom random = RandomParameter.ActualValue;
    6262      return Apply(permutation, random, SampleSizeParameter.ActualValue.Value);
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/StochasticInversionSingleMoveGenerator.cs

    r3229 r3232  
    2828
    2929namespace HeuristicLab.Encodings.PermutationEncoding {
    30   [Item("StochasticTwoOptSingleMoveGenerator", "Randomly samples a single from all possible 2-opt moves (inversion) from a given permutation.")]
     30  [Item("StochasticInversionSingleMoveGenerator", "Randomly samples a single from all possible inversion moves (2-opt) from a given permutation.")]
    3131  [StorableClass]
    32   public class StochasticTwoOptSingleMoveGenerator : TwoOptMoveGenerator, IStochasticOperator, ISingleMoveGenerator {
     32  public class StochasticInversionSingleMoveGenerator : InversionMoveGenerator, IStochasticOperator, ISingleMoveGenerator {
    3333    public ILookupParameter<IRandom> RandomParameter {
    3434      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    3535    }
    3636
    37     public StochasticTwoOptSingleMoveGenerator()
     37    public StochasticInversionSingleMoveGenerator()
    3838      : base() {
    3939      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
    4040    }
    4141
    42     public static TwoOptMove Apply(Permutation permutation, IRandom random) {
     42    public static InversionMove Apply(Permutation permutation, IRandom random) {
    4343      int length = permutation.Length;
    4444      int index1 = random.Next(length - 1);
    4545      int index2 = random.Next(index1 + 1, length);
    46       return new TwoOptMove(index1, index2);;
     46      return new InversionMove(index1, index2);;
    4747    }
    4848
    49     protected override TwoOptMove[] GenerateMoves(Permutation permutation) {
     49    protected override InversionMove[] GenerateMoves(Permutation permutation) {
    5050      IRandom random = RandomParameter.ActualValue;
    51       return new TwoOptMove[] { Apply(permutation, random) };
     51      return new InversionMove[] { Apply(permutation, random) };
    5252    }
    5353  }
Note: See TracChangeset for help on using the changeset viewer.