Changeset 3232 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding
- Timestamp:
- 03/29/10 18:49:55 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3
- Files:
-
- 3 added
- 3 deleted
- 1 edited
- 21 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/HeuristicLab.Encodings.PermutationEncoding-3.3.csproj
r3231 r3232 98 98 <Compile Include="Interfaces\IPermutationMoveOperator.cs" /> 99 99 <Compile Include="Interfaces\IPermutationOperator.cs" /> 100 <Compile Include="Interfaces\I ThreeOptPermutationMoveOperator.cs" />101 <Compile Include="Interfaces\I TwoOptPermutationMoveOperator.cs" />100 <Compile Include="Interfaces\IPermutationTranslocationMoveOperator.cs" /> 101 <Compile Include="Interfaces\IPermutationInversionMoveOperator.cs" /> 102 102 <Compile Include="Manipulators\InsertionManipulator.cs" /> 103 103 <Compile Include="Manipulators\InversionManipulator.cs" /> … … 108 108 <Compile Include="Manipulators\TranslocationManipulator.cs" /> 109 109 <Compile Include="Moves\ThreeIndexMove.cs" /> 110 <Compile Include="Moves\ThreeOpt\ Insertion\ExhaustiveInsertionMoveGenerator.cs">110 <Compile Include="Moves\ThreeOpt\ExhaustiveInsertionMoveGenerator.cs"> 111 111 <SubType>Code</SubType> 112 112 </Compile> 113 <Compile Include="Moves\ThreeOpt\PreventDeleteThreeOptTabuMoveEvaluator.cs"> 114 <SubType>Code</SubType> 115 </Compile> 116 <Compile Include="Moves\ThreeOpt\PreventReaddDeleteThreeOptTabuMoveEvaluator.cs"> 117 <SubType>Code</SubType> 118 </Compile> 119 <Compile Include="Moves\ThreeOpt\PreventReaddThreeOptTabuMoveEvaluator.cs"> 120 <SubType>Code</SubType> 121 </Compile> 122 <Compile Include="Moves\ThreeOpt\StochasticThreeOptMultiMoveGenerator.cs"> 123 <SubType>Code</SubType> 124 </Compile> 125 <Compile Include="Moves\ThreeOpt\StochasticThreeOptSingleMoveGenerator.cs"> 126 <SubType>Code</SubType> 127 </Compile> 128 <Compile Include="Moves\ThreeOpt\ThreeOptMove.cs"> 129 <SubType>Code</SubType> 130 </Compile> 131 <Compile Include="Moves\ThreeOpt\ThreeOptMoveGenerator.cs"> 132 <SubType>Code</SubType> 133 </Compile> 134 <Compile Include="Moves\ThreeOpt\ThreeOptMoveMaker.cs"> 135 <SubType>Code</SubType> 136 </Compile> 137 <Compile Include="Moves\ThreeOpt\ThreeOptTabuMoveAttribute.cs"> 138 <SubType>Code</SubType> 139 </Compile> 140 <Compile Include="Moves\ThreeOpt\ThreeOptTabuMoveMaker.cs"> 141 <SubType>Code</SubType> 142 </Compile> 113 <Compile Include="Moves\ThreeOpt\PreventReaddAndRemovalTranslocationMoveTabuChecker.cs" /> 114 <Compile Include="Moves\ThreeOpt\PreventReaddTranslocationMoveTabuChecker.cs" /> 115 <Compile Include="Moves\ThreeOpt\PreventRemovalTranslocationMoveTabuChecker.cs" /> 116 <Compile Include="Moves\ThreeOpt\StochasticTranslocationMultiMoveGenerator.cs" /> 117 <Compile Include="Moves\ThreeOpt\StochasticTranslocationSingleMoveGenerator.cs" /> 118 <Compile Include="Moves\ThreeOpt\TranslocationMove.cs" /> 119 <Compile Include="Moves\ThreeOpt\TranslocationMoveAttribute.cs" /> 120 <Compile Include="Moves\ThreeOpt\TranslocationMoveGenerator.cs" /> 121 <Compile Include="Moves\ThreeOpt\TranslocationMoveMaker.cs" /> 122 <Compile Include="Moves\ThreeOpt\TranslocationMoveTabuMaker.cs" /> 143 123 <Compile Include="Moves\TwoIndexMove.cs"> 144 124 <SubType>Code</SubType> 145 125 </Compile> 146 <Compile Include="Moves\TwoOpt\ExhaustiveTwoOptMoveGenerator.cs"> 147 <SubType>Code</SubType> 148 </Compile> 149 <Compile Include="Moves\TwoOpt\PreventDeleteTwoOptTabuMoveEvaluator.cs"> 150 <SubType>Code</SubType> 151 </Compile> 152 <Compile Include="Moves\TwoOpt\PreventReaddDeleteTwoOptTabuMoveEvaluator.cs"> 153 <SubType>Code</SubType> 154 </Compile> 155 <Compile Include="Moves\TwoOpt\PreventReaddTwoOptTabuMoveEvaluator.cs"> 156 <SubType>Code</SubType> 157 </Compile> 158 <Compile Include="Moves\TwoOpt\StochasticTwoOptMultiMoveGenerator.cs"> 159 <SubType>Code</SubType> 160 </Compile> 161 <Compile Include="Moves\TwoOpt\StochasticTwoOptSingleMoveGenerator.cs"> 162 <SubType>Code</SubType> 163 </Compile> 164 <Compile Include="Moves\TwoOpt\TwoOptMove.cs"> 165 <SubType>Code</SubType> 166 </Compile> 167 <Compile Include="Moves\TwoOpt\TwoOptMoveGenerator.cs"> 168 <SubType>Code</SubType> 169 </Compile> 170 <Compile Include="Moves\TwoOpt\TwoOptMoveMaker.cs"> 171 <SubType>Code</SubType> 172 </Compile> 173 <Compile Include="Moves\TwoOpt\TwoOptTabuMoveAttribute.cs"> 174 <SubType>Code</SubType> 175 </Compile> 176 <Compile Include="Moves\TwoOpt\TwoOptTabuMoveMaker.cs"> 177 <SubType>Code</SubType> 178 </Compile> 126 <Compile Include="Moves\TwoOpt\ExhaustiveInversionMoveGenerator.cs" /> 127 <Compile Include="Moves\TwoOpt\InversionMove.cs" /> 128 <Compile Include="Moves\TwoOpt\InversionMoveAttribute.cs" /> 129 <Compile Include="Moves\TwoOpt\InversionMoveGenerator.cs" /> 130 <Compile Include="Moves\TwoOpt\InversionMoveMaker.cs" /> 131 <Compile Include="Moves\TwoOpt\InversionMoveTabuMaker.cs" /> 132 <Compile Include="Moves\TwoOpt\PreventReaddAndRemovalInversionMoveTabuChecker.cs" /> 133 <Compile Include="Moves\TwoOpt\PreventReaddInversionMoveTabuChecker.cs" /> 134 <Compile Include="Moves\TwoOpt\PreventRemovalInversionMoveTabuChecker.cs" /> 135 <Compile Include="Moves\TwoOpt\StochasticInversionMultiMoveGenerator.cs" /> 136 <Compile Include="Moves\TwoOpt\StochasticInversionSingleMoveGenerator.cs" /> 179 137 <Compile Include="PermutationManipulator.cs" /> 180 138 <Compile Include="PermutationCrossover.cs" /> -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/PreventReaddAndRemovalTranslocationMoveTabuChecker.cs
r3231 r3232 29 29 30 30 namespace 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.")] 32 32 [StorableClass] 33 public class PreventReadd DeleteThreeOptTabuMoveEvaluator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, ITabuMoveEvaluator {33 public class PreventReaddAndRemovalTranslocationMoveTabuChecker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, ITabuChecker { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 public ILookupParameter<T hreeOptMove> ThreeOptMoveParameter {38 get { return (LookupParameter<T hreeOptMove>)Parameters["ThreeOptMove"]; }37 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { 38 get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; } 39 39 } 40 40 public ILookupParameter<Permutation> PermutationParameter { … … 51 51 } 52 52 53 public PreventReadd DeleteThreeOptTabuMoveEvaluator()53 public PreventReaddAndRemovalTranslocationMoveTabuChecker() 54 54 : base() { 55 Parameters.Add(new LookupParameter<T hreeOptMove>("ThreeOptMove", "The move to evaluate."));55 Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate.")); 56 56 Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu.")); 57 57 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 62 62 public override IOperation Apply() { 63 63 ItemList<IItem> tabuList = TabuListParameter.ActualValue; 64 T hreeOptMove move = ThreeOptMoveParameter.ActualValue;64 TranslocationMove move = TranslocationMoveParameter.ActualValue; 65 65 Permutation permutation = PermutationParameter.ActualValue; 66 66 int length = permutation.Length; … … 83 83 if (!isTabu) { 84 84 foreach (IItem tabuMove in tabuList) { 85 T hreeOptTabuMoveAttribute attribute = (tabuMove as ThreeOptTabuMoveAttribute);85 TranslocationMoveAttribute attribute = (tabuMove as TranslocationMoveAttribute); 86 86 if (attribute != null) { 87 87 // if previously deleted Edge1Source-Target is readded -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/PreventReaddTranslocationMoveTabuChecker.cs
r3231 r3232 29 29 30 30 namespace HeuristicLab.Encodings.PermutationEncoding { 31 [Item(" ThreeOptPreventEdgeReadding", "Prevents readding of previously deleted edges.")]31 [Item("PreventReaddTranslocationMoveTabuChecker", "Prevents readding of previously deleted edges.")] 32 32 [StorableClass] 33 public class PreventReaddT hreeOptTabuMoveEvaluator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, ITabuMoveEvaluator {33 public class PreventReaddTranslocationMoveTabuChecker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, ITabuChecker { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 public ILookupParameter<T hreeOptMove> ThreeOptMoveParameter {38 get { return (LookupParameter<T hreeOptMove>)Parameters["ThreeOptMove"]; }37 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { 38 get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; } 39 39 } 40 40 public ILookupParameter<Permutation> PermutationParameter { … … 51 51 } 52 52 53 public PreventReaddT hreeOptTabuMoveEvaluator()53 public PreventReaddTranslocationMoveTabuChecker() 54 54 : base() { 55 Parameters.Add(new LookupParameter<T hreeOptMove>("ThreeOptMove", "The move to evaluate."));55 Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate.")); 56 56 Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu.")); 57 57 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 62 62 public override IOperation Apply() { 63 63 ItemList<IItem> tabuList = TabuListParameter.ActualValue; 64 T hreeOptMove move = ThreeOptMoveParameter.ActualValue;64 TranslocationMove move = TranslocationMoveParameter.ActualValue; 65 65 Permutation permutation = PermutationParameter.ActualValue; 66 66 int length = permutation.Length; … … 83 83 if (!isTabu) { 84 84 foreach (IItem tabuMove in tabuList) { 85 T hreeOptTabuMoveAttribute attribute = (tabuMove as ThreeOptTabuMoveAttribute);85 TranslocationMoveAttribute attribute = (tabuMove as TranslocationMoveAttribute); 86 86 if (attribute != null) { 87 87 // if previously deleted Edge1Source-Target is readded -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/PreventRemovalTranslocationMoveTabuChecker.cs
r3231 r3232 29 29 30 30 namespace HeuristicLab.Encodings.PermutationEncoding { 31 [Item(" ThreeOptPreventEdgeRemoval", "Prevents deleting of previously added edges.")]31 [Item("PreventRemovalTranslocationMoveTabuChecker", "Prevents deleting of previously added edges.")] 32 32 [StorableClass] 33 public class Prevent DeleteThreeOptTabuMoveEvaluator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, ITabuMoveEvaluator {33 public class PreventRemovalTranslocationMoveTabuChecker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, ITabuChecker { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 public ILookupParameter<T hreeOptMove> ThreeOptMoveParameter {38 get { return (LookupParameter<T hreeOptMove>)Parameters["ThreeOptMove"]; }37 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { 38 get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; } 39 39 } 40 40 public ILookupParameter<Permutation> PermutationParameter { … … 51 51 } 52 52 53 public Prevent DeleteThreeOptTabuMoveEvaluator()53 public PreventRemovalTranslocationMoveTabuChecker() 54 54 : base() { 55 Parameters.Add(new LookupParameter<T hreeOptMove>("ThreeOptMove", "The move to evaluate."));55 Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate.")); 56 56 Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu.")); 57 57 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 62 62 public override IOperation Apply() { 63 63 ItemList<IItem> tabuList = TabuListParameter.ActualValue; 64 T hreeOptMove move = ThreeOptMoveParameter.ActualValue;64 TranslocationMove move = TranslocationMoveParameter.ActualValue; 65 65 Permutation permutation = PermutationParameter.ActualValue; 66 66 int length = permutation.Length; … … 83 83 if (!isTabu) { 84 84 foreach (IItem tabuMove in tabuList) { 85 T hreeOptTabuMoveAttribute attribute = (tabuMove as ThreeOptTabuMoveAttribute);85 TranslocationMoveAttribute attribute = (tabuMove as TranslocationMoveAttribute); 86 86 if (attribute != null) { 87 87 // if previously added Edge3Source-Edge1Target is deleted -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationMultiMoveGenerator.cs
r3231 r3232 28 28 29 29 namespace HeuristicLab.Encodings.PermutationEncoding { 30 [Item("StochasticT hreeOptMultiMoveGenerator", "Randomly samples n from all possible 3-opt movesfrom a given permutation.")]30 [Item("StochasticTranslocationMultiMoveGenerator", "Randomly samples n from all possible translocation and insertion moves (3-opt) from a given permutation.")] 31 31 [StorableClass] 32 public class StochasticT hreeOptMultiMoveGenerator : ThreeOptMoveGenerator, IStochasticOperator, IMultiMoveGenerator {32 public class StochasticTranslocationMultiMoveGenerator : TranslocationMoveGenerator, IStochasticOperator, IMultiMoveGenerator { 33 33 public ILookupParameter<IRandom> RandomParameter { 34 34 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } … … 43 43 } 44 44 45 public StochasticT hreeOptMultiMoveGenerator()45 public StochasticTranslocationMultiMoveGenerator() 46 46 : base() { 47 47 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); … … 49 49 } 50 50 51 public static T hreeOptMove[] Apply(Permutation permutation, IRandom random, int sampleSize) {51 public static TranslocationMove[] Apply(Permutation permutation, IRandom random, int sampleSize) { 52 52 int length = permutation.Length; 53 T hreeOptMove[] moves = new ThreeOptMove[sampleSize];53 TranslocationMove[] moves = new TranslocationMove[sampleSize]; 54 54 for (int i = 0; i < sampleSize; i++) { 55 55 moves[i] = StochasticThreeOptSingleMoveGenerator.Apply(permutation, random); … … 58 58 } 59 59 60 protected override T hreeOptMove[] GenerateMoves(Permutation permutation) {60 protected override TranslocationMove[] GenerateMoves(Permutation permutation) { 61 61 IRandom random = RandomParameter.ActualValue; 62 62 return Apply(permutation, random, SampleSizeParameter.ActualValue.Value); -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/StochasticTranslocationSingleMoveGenerator.cs
r3231 r3232 28 28 29 29 namespace HeuristicLab.Encodings.PermutationEncoding { 30 [Item("StochasticT hreeOptSingleMoveGenerator", "Randomly samples one from all possible 3-opt movesfrom a given permutation.")]30 [Item("StochasticTranslocationSingleMoveGenerator", "Randomly samples one from all possible translocation and insertion moves (3-opt) from a given permutation.")] 31 31 [StorableClass] 32 public class StochasticThreeOptSingleMoveGenerator : T hreeOptMoveGenerator, IStochasticOperator, ISingleMoveGenerator {32 public class StochasticThreeOptSingleMoveGenerator : TranslocationMoveGenerator, IStochasticOperator, ISingleMoveGenerator { 33 33 public ILookupParameter<IRandom> RandomParameter { 34 34 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } … … 40 40 } 41 41 42 public static T hreeOptMove Apply(Permutation permutation, IRandom random) {42 public static TranslocationMove Apply(Permutation permutation, IRandom random) { 43 43 int length = permutation.Length; 44 44 int index1, index2, index3; … … 51 51 } while (index3 == index1); 52 52 53 return new T hreeOptMove(index1, index2, index3);53 return new TranslocationMove(index1, index2, index3); 54 54 } 55 55 56 protected override T hreeOptMove[] GenerateMoves(Permutation permutation) {56 protected override TranslocationMove[] GenerateMoves(Permutation permutation) { 57 57 IRandom random = RandomParameter.ActualValue; 58 return new T hreeOptMove[] { Apply(permutation, random) };58 return new TranslocationMove[] { Apply(permutation, random) }; 59 59 } 60 60 } -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMove.cs
r3231 r3232 24 24 25 25 namespace HeuristicLab.Encodings.PermutationEncoding { 26 [Item("T hreeOptMove", "A move that changes three edges by performing a translocation.")]26 [Item("TranslocationMove", "A move that changes three edges by performing a translocation.")] 27 27 [StorableClass] 28 public class T hreeOptMove : ThreeIndexMove {29 public T hreeOptMove()28 public class TranslocationMove : ThreeIndexMove { 29 public TranslocationMove() 30 30 : base() { 31 31 } 32 32 33 public T hreeOptMove(int index1, int index2, int index3)33 public TranslocationMove(int index1, int index2, int index3) 34 34 : base(index1, index2, index3, null) { 35 35 } 36 36 37 public T hreeOptMove(int index1, int index2, int index3, Permutation permutation)37 public TranslocationMove(int index1, int index2, int index3, Permutation permutation) 38 38 : base(index1, index2, index3, permutation) { 39 39 } -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveAttribute.cs
r3231 r3232 24 24 25 25 namespace HeuristicLab.Encodings.PermutationEncoding { 26 [Item("T hreeOptTabuMoveAttribute", "Specifies the tabu attributes for a 3-opt move.")]26 [Item("TranslocationMoveAttribute", "Specifies the tabu attributes for a translocation and insertion move (3-opt).")] 27 27 [StorableClass] 28 public class T hreeOptTabuMoveAttribute : Item {28 public class TranslocationMoveAttribute : Item { 29 29 [Storable] 30 30 public int Edge1Source { get; private set; } … … 41 41 42 42 [StorableConstructor] 43 private T hreeOptTabuMoveAttribute(bool deserializing)43 private TranslocationMoveAttribute(bool deserializing) 44 44 : base() { 45 45 } 46 46 47 public T hreeOptTabuMoveAttribute()47 public TranslocationMoveAttribute() 48 48 : this(-1, -1, -1, -1, -1, -1) { } 49 49 50 public T hreeOptTabuMoveAttribute(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) 51 51 : base() { 52 52 Edge1Source = edge1Source; … … 59 59 60 60 public override IDeepCloneable Clone(Cloner cloner) { 61 T hreeOptTabuMoveAttribute clone = (ThreeOptTabuMoveAttribute)base.Clone(cloner);61 TranslocationMoveAttribute clone = (TranslocationMoveAttribute)base.Clone(cloner); 62 62 clone.Edge1Source = Edge1Source; 63 63 clone.Edge1Target = Edge1Target; -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveGenerator.cs
r3231 r3232 28 28 29 29 namespace HeuristicLab.Encodings.PermutationEncoding { 30 [Item("T hreeOptMoveGenerator", "Base class for move generators that produce 3-opt moves.")]30 [Item("TranslocationMoveGenerator", "Base class for move generators that produce translocation moves (3-opt).")] 31 31 [StorableClass] 32 public abstract class T hreeOptMoveGenerator : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, IMoveGenerator {32 public abstract class TranslocationMoveGenerator : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, IMoveGenerator { 33 33 public override bool CanChangeName { 34 34 get { return false; } … … 37 37 get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; } 38 38 } 39 public ILookupParameter<T hreeOptMove> ThreeOptMoveParameter {40 get { return (LookupParameter<T hreeOptMove>)Parameters["ThreeOptMove"]; }39 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { 40 get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; } 41 41 } 42 42 protected ScopeParameter CurrentScopeParameter { … … 44 44 } 45 45 46 public T hreeOptMoveGenerator()46 public TranslocationMoveGenerator() 47 47 : base() { 48 48 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation for which moves should be generated.")); 49 Parameters.Add(new LookupParameter<T hreeOptMove>("ThreeOptMove", "The moves that should be generated in subscopes."));49 Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The moves that should be generated in subscopes.")); 50 50 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes.")); 51 51 } … … 53 53 public override IOperation Apply() { 54 54 Permutation p = PermutationParameter.ActualValue; 55 T hreeOptMove[] moves = GenerateMoves(p);55 TranslocationMove[] moves = GenerateMoves(p); 56 56 Scope[] moveScopes = new Scope[moves.Length]; 57 57 for (int i = 0; i < moveScopes.Length; i++) { 58 58 moveScopes[i] = new Scope(i.ToString()); 59 moveScopes[i].Variables.Add(new Variable(T hreeOptMoveParameter.ActualName, moves[i]));59 moveScopes[i].Variables.Add(new Variable(TranslocationMoveParameter.ActualName, moves[i])); 60 60 } 61 61 CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes); … … 63 63 } 64 64 65 protected abstract T hreeOptMove[] GenerateMoves(Permutation permutation);65 protected abstract TranslocationMove[] GenerateMoves(Permutation permutation); 66 66 } 67 67 } -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveMaker.cs
r3231 r3232 29 29 30 30 namespace HeuristicLab.Encodings.PermutationEncoding { 31 [Item("T hreeOptMoveMaker", "Peforms a 3-opt moveon 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.")] 32 32 [StorableClass] 33 public class T hreeOptMoveMaker : SingleSuccessorOperator, IThreeOptPermutationMoveOperator, IMoveMaker {33 public class TranslocationMoveMaker : SingleSuccessorOperator, IPermutationTranslocationMoveOperator, IMoveMaker { 34 34 public override bool CanChangeName { 35 35 get { return false; } … … 41 41 get { return (ILookupParameter<DoubleValue>)Parameters["MoveQuality"]; } 42 42 } 43 public ILookupParameter<T hreeOptMove> ThreeOptMoveParameter {44 get { return (ILookupParameter<T hreeOptMove>)Parameters["ThreeOptMove"]; }43 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { 44 get { return (ILookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; } 45 45 } 46 46 public ILookupParameter<Permutation> PermutationParameter { … … 48 48 } 49 49 50 public T hreeOptMoveMaker()50 public TranslocationMoveMaker() 51 51 : base() { 52 52 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the solution.")); 53 Parameters.Add(new LookupParameter<T hreeOptMove>("ThreeOptMove", "The move to evaluate."));53 Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate.")); 54 54 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move.")); 55 55 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 57 57 58 58 public override IOperation Apply() { 59 T hreeOptMove move = ThreeOptMoveParameter.ActualValue;59 TranslocationMove move = TranslocationMoveParameter.ActualValue; 60 60 Permutation permutation = PermutationParameter.ActualValue; 61 61 DoubleValue moveQuality = MoveQualityParameter.ActualValue; -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveTabuMaker.cs
r3231 r3232 29 29 30 30 namespace HeuristicLab.Encodings.PermutationEncoding { 31 [Item("T hreeOptTabuMoveMaker", "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.")] 32 32 [StorableClass] 33 public class T hreeOptTabuMoveMaker : TabuMoveMaker, IThreeOptPermutationMoveOperator {33 public class TranslocationMoveTabuMaker : TabuMaker, IPermutationTranslocationMoveOperator { 34 34 public override bool CanChangeName { 35 35 get { return false; } … … 38 38 get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; } 39 39 } 40 public ILookupParameter<T hreeOptMove> ThreeOptMoveParameter {41 get { return (LookupParameter<T hreeOptMove>)Parameters["ThreeOptMove"]; }40 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { 41 get { return (LookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; } 42 42 } 43 43 44 public T hreeOptTabuMoveMaker()44 public TranslocationMoveTabuMaker() 45 45 : base() { 46 Parameters.Add(new LookupParameter<T hreeOptMove>("ThreeOptMove", "The move that was made."));46 Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move that was made.")); 47 47 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); 48 48 } 49 49 50 50 protected override IItem GetTabuAttribute() { 51 T hreeOptMove move = ThreeOptMoveParameter.ActualValue;51 TranslocationMove move = TranslocationMoveParameter.ActualValue; 52 52 Permutation permutation = PermutationParameter.ActualValue; 53 53 if (move.Index3 > move.Index1) 54 return new T hreeOptTabuMoveAttribute(permutation.GetCircular(move.Index1 - 1),54 return new TranslocationMoveAttribute(permutation.GetCircular(move.Index1 - 1), 55 55 permutation[move.Index1], 56 56 permutation[move.Index2], … … 59 59 permutation.GetCircular(move.Index3 + move.Index2 - move.Index1 + 1)); 60 60 else 61 return new T hreeOptTabuMoveAttribute(permutation.GetCircular(move.Index1 - 1),61 return new TranslocationMoveAttribute(permutation.GetCircular(move.Index1 - 1), 62 62 permutation[move.Index1], 63 63 permutation[move.Index2], -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveInversionMoveGenerator.cs
r3229 r3232 26 26 27 27 namespace HeuristicLab.Encodings.PermutationEncoding { 28 [Item("Exhaustive TwoOptMoveGenerator", "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.")] 29 29 [StorableClass] 30 public class Exhaustive TwoOptMoveGenerator : TwoOptMoveGenerator, IExhaustiveMoveGenerator {31 public static TwoOptMove[] Apply(Permutation permutation) {30 public class ExhaustiveInversionMoveGenerator : InversionMoveGenerator, IExhaustiveMoveGenerator { 31 public static InversionMove[] Apply(Permutation permutation) { 32 32 int length = permutation.Length; 33 33 int totalMoves = (length) * (length - 1) / 2; // - 3; 34 TwoOptMove[] moves = new TwoOptMove[totalMoves];34 InversionMove[] moves = new InversionMove[totalMoves]; 35 35 int count = 0; 36 36 for (int i = 0; i < length - 1; i++) … … 39 39 /*if (i == 0 && j >= length - 2) continue; 40 40 else if (i == 1 && j >= length - 1) continue;*/ 41 moves[count++] = new TwoOptMove(i, j);41 moves[count++] = new InversionMove(i, j); 42 42 } 43 43 return moves; 44 44 } 45 45 46 protected override TwoOptMove[] GenerateMoves(Permutation permutation) {46 protected override InversionMove[] GenerateMoves(Permutation permutation) { 47 47 return Apply(permutation); 48 48 } -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMove.cs
r3229 r3232 24 24 25 25 namespace HeuristicLab.Encodings.PermutationEncoding { 26 [Item(" TwoOptMove", "Item that describes a 2-Opt move.")]26 [Item("InversionMove", "Item that describes an inversion move (2-opt).")] 27 27 [StorableClass] 28 public class TwoOptMove : TwoIndexMove {29 public TwoOptMove()28 public class InversionMove : TwoIndexMove { 29 public InversionMove() 30 30 : base() { 31 31 } 32 32 33 public TwoOptMove(int index1, int index2)33 public InversionMove(int index1, int index2) 34 34 : base(index1, index2, null) { 35 35 } 36 36 37 public TwoOptMove(int index1, int index2, Permutation permutation)37 public InversionMove(int index1, int index2, Permutation permutation) 38 38 : base(index1, index2, permutation) { 39 39 } -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveAttribute.cs
r3229 r3232 24 24 25 25 namespace 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).")] 27 27 [StorableClass] 28 public class TwoOptTabuMoveAttribute : Item {28 public class InversionMoveAttribute : Item { 29 29 [Storable] 30 30 public int Edge1Source { get; private set; } … … 37 37 38 38 [StorableConstructor] 39 private TwoOptTabuMoveAttribute(bool deserializing)39 private InversionMoveAttribute(bool deserializing) 40 40 : base() { 41 41 } 42 42 43 public TwoOptTabuMoveAttribute()43 public InversionMoveAttribute() 44 44 : this(-1, -1, -1, -1) { } 45 45 46 public TwoOptTabuMoveAttribute(int edge1Source, int edge1Target, int edge2Source, int edge2Target)46 public InversionMoveAttribute(int edge1Source, int edge1Target, int edge2Source, int edge2Target) 47 47 : base() { 48 48 Edge1Source = edge1Source; … … 53 53 54 54 public override IDeepCloneable Clone(Cloner cloner) { 55 TwoOptTabuMoveAttribute clone = (TwoOptTabuMoveAttribute)base.Clone(cloner);55 InversionMoveAttribute clone = (InversionMoveAttribute)base.Clone(cloner); 56 56 clone.Edge1Source = Edge1Source; 57 57 clone.Edge1Target = Edge1Target; -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveGenerator.cs
r3229 r3232 28 28 29 29 namespace HeuristicLab.Encodings.PermutationEncoding { 30 [Item(" TwoOptMoveGenerator", "Base class for all 2-optmove generators.")]30 [Item("InversionMoveGenerator", "Base class for all inversion (2-opt) move generators.")] 31 31 [StorableClass] 32 public abstract class TwoOptMoveGenerator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, IMoveGenerator {32 public abstract class InversionMoveGenerator : SingleSuccessorOperator, IPermutationInversionMoveOperator, IMoveGenerator { 33 33 public override bool CanChangeName { 34 34 get { return false; } … … 37 37 get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; } 38 38 } 39 public ILookupParameter< TwoOptMove> TwoOptMoveParameter {40 get { return (LookupParameter< TwoOptMove>)Parameters["TwoOptMove"]; }39 public ILookupParameter<InversionMove> InversionMoveParameter { 40 get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; } 41 41 } 42 42 protected ScopeParameter CurrentScopeParameter { … … 44 44 } 45 45 46 public TwoOptMoveGenerator()46 public InversionMoveGenerator() 47 47 : base() { 48 48 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.")); 50 50 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes.")); 51 51 } … … 53 53 public override IOperation Apply() { 54 54 Permutation p = PermutationParameter.ActualValue; 55 TwoOptMove[] moves = GenerateMoves(p);55 InversionMove[] moves = GenerateMoves(p); 56 56 Scope[] moveScopes = new Scope[moves.Length]; 57 57 for (int i = 0; i < moveScopes.Length; i++) { 58 58 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])); 60 60 } 61 61 CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes); … … 63 63 } 64 64 65 protected abstract TwoOptMove[] GenerateMoves(Permutation permutation);65 protected abstract InversionMove[] GenerateMoves(Permutation permutation); 66 66 } 67 67 } -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveMaker.cs
r3229 r3232 29 29 30 30 namespace HeuristicLab.Encodings.PermutationEncoding { 31 [Item(" TwoOptMoveMaker", "Peforms a 2-opt moveon a given permutation and updates the quality.")]31 [Item("InversionMoveMaker", "Peforms an inversion move (2-opt) on a given permutation and updates the quality.")] 32 32 [StorableClass] 33 public class TwoOptMoveMaker : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, IMoveMaker {33 public class InversionMoveMaker : SingleSuccessorOperator, IPermutationInversionMoveOperator, IMoveMaker { 34 34 public override bool CanChangeName { 35 35 get { return false; } … … 41 41 get { return (ILookupParameter<DoubleValue>)Parameters["MoveQuality"]; } 42 42 } 43 public ILookupParameter< TwoOptMove> TwoOptMoveParameter {44 get { return (ILookupParameter< TwoOptMove>)Parameters["TwoOptMove"]; }43 public ILookupParameter<InversionMove> InversionMoveParameter { 44 get { return (ILookupParameter<InversionMove>)Parameters["InversionMove"]; } 45 45 } 46 46 public ILookupParameter<Permutation> PermutationParameter { … … 48 48 } 49 49 50 public TwoOptMoveMaker()50 public InversionMoveMaker() 51 51 : base() { 52 52 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.")); 54 54 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move.")); 55 55 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 57 57 58 58 public override IOperation Apply() { 59 TwoOptMove move = TwoOptMoveParameter.ActualValue;59 InversionMove move = InversionMoveParameter.ActualValue; 60 60 Permutation permutation = PermutationParameter.ActualValue; 61 61 DoubleValue moveQuality = MoveQualityParameter.ActualValue; -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveTabuMaker.cs
r3229 r3232 29 29 30 30 namespace 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.")] 32 32 [StorableClass] 33 public class TwoOptTabuMoveMaker : TabuMoveMaker, ITwoOptPermutationMoveOperator {33 public class InversionMoveTabuMaker : TabuMaker, IPermutationInversionMoveOperator { 34 34 public override bool CanChangeName { 35 35 get { return false; } … … 38 38 get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; } 39 39 } 40 public ILookupParameter< TwoOptMove> TwoOptMoveParameter {41 get { return (LookupParameter< TwoOptMove>)Parameters["TwoOptMove"]; }40 public ILookupParameter<InversionMove> InversionMoveParameter { 41 get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; } 42 42 } 43 43 44 public TwoOptTabuMoveMaker()44 public InversionMoveTabuMaker() 45 45 : 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.")); 47 47 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); 48 48 } 49 49 50 50 protected override IItem GetTabuAttribute() { 51 TwoOptMove move = TwoOptMoveParameter.ActualValue;51 InversionMove move = InversionMoveParameter.ActualValue; 52 52 Permutation permutation = PermutationParameter.ActualValue; 53 return new TwoOptTabuMoveAttribute( permutation.GetCircular(move.Index1 - 1),53 return new InversionMoveAttribute( permutation.GetCircular(move.Index1 - 1), 54 54 permutation[move.Index1], 55 55 permutation[move.Index2], -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/PreventReaddAndRemovalInversionMoveTabuChecker.cs
r3229 r3232 29 29 30 30 namespace 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.")] 32 32 [StorableClass] 33 public class PreventReadd DeleteTwoOptTabuMoveEvaluator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, ITabuMoveEvaluator {33 public class PreventReaddAndRemovalInversionMoveTabuChecker : SingleSuccessorOperator, IPermutationInversionMoveOperator, ITabuChecker { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 public ILookupParameter< TwoOptMove> TwoOptMoveParameter {38 get { return (LookupParameter< TwoOptMove>)Parameters["TwoOptMove"]; }37 public ILookupParameter<InversionMove> InversionMoveParameter { 38 get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; } 39 39 } 40 40 public ILookupParameter<Permutation> PermutationParameter { … … 51 51 } 52 52 53 public PreventReadd DeleteTwoOptTabuMoveEvaluator()53 public PreventReaddAndRemovalInversionMoveTabuChecker() 54 54 : base() { 55 Parameters.Add(new LookupParameter< TwoOptMove>("TwoOptMove", "The move to evaluate."));55 Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate.")); 56 56 Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu.")); 57 57 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 62 62 public override IOperation Apply() { 63 63 ItemList<IItem> tabuList = TabuListParameter.ActualValue; 64 TwoOptMove move = TwoOptMoveParameter.ActualValue;64 InversionMove move = InversionMoveParameter.ActualValue; 65 65 Permutation permutation = PermutationParameter.ActualValue; 66 66 int length = permutation.Length; … … 72 72 if (!isTabu) { 73 73 foreach (IItem tabuMove in tabuList) { 74 TwoOptTabuMoveAttribute attribute = (tabuMove as TwoOptTabuMoveAttribute);74 InversionMoveAttribute attribute = (tabuMove as InversionMoveAttribute); 75 75 if (attribute != null) { 76 76 // if previously deleted Edge1Source-Target is readded -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/PreventReaddInversionMoveTabuChecker.cs
r3229 r3232 29 29 30 30 namespace 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.")] 32 32 [StorableClass] 33 public class PreventReadd TwoOptTabuMoveEvaluator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, ITabuMoveEvaluator {33 public class PreventReaddInversionMoveTabuChecker : SingleSuccessorOperator, IPermutationInversionMoveOperator, ITabuChecker { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 public ILookupParameter< TwoOptMove> TwoOptMoveParameter {38 get { return (LookupParameter< TwoOptMove>)Parameters["TwoOptMove"]; }37 public ILookupParameter<InversionMove> InversionMoveParameter { 38 get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; } 39 39 } 40 40 public ILookupParameter<Permutation> PermutationParameter { … … 51 51 } 52 52 53 public PreventReadd TwoOptTabuMoveEvaluator()53 public PreventReaddInversionMoveTabuChecker() 54 54 : base() { 55 Parameters.Add(new LookupParameter< TwoOptMove>("TwoOptMove", "The move to evaluate."));55 Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate.")); 56 56 Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu.")); 57 57 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 62 62 public override IOperation Apply() { 63 63 ItemList<IItem> tabuList = TabuListParameter.ActualValue; 64 TwoOptMove move = TwoOptMoveParameter.ActualValue;64 InversionMove move = InversionMoveParameter.ActualValue; 65 65 Permutation permutation = PermutationParameter.ActualValue; 66 66 int length = permutation.Length; … … 72 72 if (!isTabu) { 73 73 foreach (IItem tabuMove in tabuList) { 74 TwoOptTabuMoveAttribute attribute = (tabuMove as TwoOptTabuMoveAttribute);74 InversionMoveAttribute attribute = (tabuMove as InversionMoveAttribute); 75 75 if (attribute != null) { 76 76 // if previously deleted Edge1Source-Target is readded -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/PreventRemovalInversionMoveTabuChecker.cs
r3229 r3232 29 29 30 30 namespace HeuristicLab.Encodings.PermutationEncoding { 31 [Item(" TwoOptPreventEdgeRemoval", "Prevents deleting of previously added edges.")]31 [Item("PreventRemovalInversionMoveTabuChecker", "Prevents deleting of previously added edges.")] 32 32 [StorableClass] 33 public class Prevent DeleteTwoOptTabuMoveEvaluator : SingleSuccessorOperator, ITwoOptPermutationMoveOperator, ITabuMoveEvaluator {33 public class PreventRemovalInversionMoveTabuChecker : SingleSuccessorOperator, IPermutationInversionMoveOperator, ITabuChecker { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 public ILookupParameter< TwoOptMove> TwoOptMoveParameter {38 get { return (LookupParameter< TwoOptMove>)Parameters["TwoOptMove"]; }37 public ILookupParameter<InversionMove> InversionMoveParameter { 38 get { return (LookupParameter<InversionMove>)Parameters["InversionMove"]; } 39 39 } 40 40 public ILookupParameter<Permutation> PermutationParameter { … … 51 51 } 52 52 53 public Prevent DeleteTwoOptTabuMoveEvaluator()53 public PreventRemovalInversionMoveTabuChecker() 54 54 : base() { 55 Parameters.Add(new LookupParameter< TwoOptMove>("TwoOptMove", "The move to evaluate."));55 Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate.")); 56 56 Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu.")); 57 57 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); … … 62 62 public override IOperation Apply() { 63 63 ItemList<IItem> tabuList = TabuListParameter.ActualValue; 64 TwoOptMove move = TwoOptMoveParameter.ActualValue;64 InversionMove move = InversionMoveParameter.ActualValue; 65 65 Permutation permutation = PermutationParameter.ActualValue; 66 66 int length = permutation.Length; … … 72 72 if (!isTabu) { 73 73 foreach (IItem tabuMove in tabuList) { 74 TwoOptTabuMoveAttribute attribute = (tabuMove as TwoOptTabuMoveAttribute);74 InversionMoveAttribute attribute = (tabuMove as InversionMoveAttribute); 75 75 if (attribute != null) { 76 76 // if previously added Edge1Source-Edge2Source is deleted -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/StochasticInversionMultiMoveGenerator.cs
r3229 r3232 28 28 29 29 namespace HeuristicLab.Encodings.PermutationEncoding { 30 [Item("Stochastic TwoOptMultiMoveGenerator", "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.")] 31 31 [StorableClass] 32 public class Stochastic TwoOptMultiMoveGenerator : TwoOptMoveGenerator, IMultiMoveGenerator, IStochasticOperator {32 public class StochasticInversionMultiMoveGenerator : InversionMoveGenerator, IMultiMoveGenerator, IStochasticOperator { 33 33 public ILookupParameter<IRandom> RandomParameter { 34 34 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } … … 43 43 } 44 44 45 public Stochastic TwoOptMultiMoveGenerator()45 public StochasticInversionMultiMoveGenerator() 46 46 : base() { 47 47 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); … … 49 49 } 50 50 51 public static TwoOptMove[] Apply(Permutation permutation, IRandom random, int sampleSize) {51 public static InversionMove[] Apply(Permutation permutation, IRandom random, int sampleSize) { 52 52 int length = permutation.Length; 53 TwoOptMove[] moves = new TwoOptMove[sampleSize];53 InversionMove[] moves = new InversionMove[sampleSize]; 54 54 for (int i = 0; i < sampleSize; i++) { 55 moves[i] = Stochastic TwoOptSingleMoveGenerator.Apply(permutation, random);55 moves[i] = StochasticInversionSingleMoveGenerator.Apply(permutation, random); 56 56 } 57 57 return moves; 58 58 } 59 59 60 protected override TwoOptMove[] GenerateMoves(Permutation permutation) {60 protected override InversionMove[] GenerateMoves(Permutation permutation) { 61 61 IRandom random = RandomParameter.ActualValue; 62 62 return Apply(permutation, random, SampleSizeParameter.ActualValue.Value); -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/StochasticInversionSingleMoveGenerator.cs
r3229 r3232 28 28 29 29 namespace HeuristicLab.Encodings.PermutationEncoding { 30 [Item("Stochastic TwoOptSingleMoveGenerator", "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.")] 31 31 [StorableClass] 32 public class Stochastic TwoOptSingleMoveGenerator : TwoOptMoveGenerator, IStochasticOperator, ISingleMoveGenerator {32 public class StochasticInversionSingleMoveGenerator : InversionMoveGenerator, IStochasticOperator, ISingleMoveGenerator { 33 33 public ILookupParameter<IRandom> RandomParameter { 34 34 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 35 35 } 36 36 37 public Stochastic TwoOptSingleMoveGenerator()37 public StochasticInversionSingleMoveGenerator() 38 38 : base() { 39 39 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 40 40 } 41 41 42 public static TwoOptMove Apply(Permutation permutation, IRandom random) {42 public static InversionMove Apply(Permutation permutation, IRandom random) { 43 43 int length = permutation.Length; 44 44 int index1 = random.Next(length - 1); 45 45 int index2 = random.Next(index1 + 1, length); 46 return new TwoOptMove(index1, index2);;46 return new InversionMove(index1, index2);; 47 47 } 48 48 49 protected override TwoOptMove[] GenerateMoves(Permutation permutation) {49 protected override InversionMove[] GenerateMoves(Permutation permutation) { 50 50 IRandom random = RandomParameter.ActualValue; 51 return new TwoOptMove[] { Apply(permutation, random) };51 return new InversionMove[] { Apply(permutation, random) }; 52 52 } 53 53 }
Note: See TracChangeset
for help on using the changeset viewer.