Changeset 13412 for branches/PTSP/HeuristicLab.Problems.PTSP/3.3/Moves/TwoPointFiveOpt/TwoPointFiveMoveGenerator.cs
- Timestamp:
- 11/28/15 23:38:51 (9 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/PTSP/HeuristicLab.Problems.PTSP/3.3/Moves/TwoPointFiveOpt/TwoPointFiveMoveGenerator.cs
r13408 r13412 32 32 [Item("TwoPointFiveMoveGenerator", "Base class for all inversion and shift (2.5-opt) move generators.")] 33 33 [StorableClass] 34 public abstract class TwoPointFiveMoveGenerator : SingleSuccessorOperator, I 25MoveOperator, IMoveGenerator {34 public abstract class TwoPointFiveMoveGenerator : SingleSuccessorOperator, ITwoPointFiveMoveOperator, IMoveGenerator { 35 35 public override bool CanChangeName { 36 36 get { return false; } 37 37 } 38 38 39 public ILookupParameter<Permutation> PermutationParameter { 39 40 get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; } … … 42 43 get { return (LookupParameter<TwoPointFiveMove>)Parameters["TwoPointFiveMove"]; } 43 44 } 44 protected ScopeParameter CurrentScopeParameter {45 get { return (ScopeParameter)Parameters["CurrentScope"]; }46 }47 45 48 46 [StorableConstructor] 49 47 protected TwoPointFiveMoveGenerator(bool deserializing) : base(deserializing) { } 50 48 protected TwoPointFiveMoveGenerator(TwoPointFiveMoveGenerator original, Cloner cloner) : base(original, cloner) { } 51 p ublicTwoPointFiveMoveGenerator()49 protected TwoPointFiveMoveGenerator() 52 50 : base() { 53 51 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation for which moves should be generated.")); … … 57 55 58 56 public override IOperation Apply() { 59 Permutationp = PermutationParameter.ActualValue;60 TwoPointFiveMove[]moves = GenerateMoves(p);61 Scope[]moveScopes = new Scope[moves.Length];57 var p = PermutationParameter.ActualValue; 58 var moves = GenerateMoves(p); 59 var moveScopes = new Scope[moves.Length]; 62 60 for (int i = 0; i < moveScopes.Length; i++) { 63 61 moveScopes[i] = new Scope(i.ToString()); 64 62 moveScopes[i].Variables.Add(new Variable(TwoPointFiveMoveParameter.ActualName, moves[i])); 65 63 } 66 CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes);64 ExecutionContext.Scope.SubScopes.AddRange(moveScopes); 67 65 return base.Apply(); 68 66 }
Note: See TracChangeset
for help on using the changeset viewer.