Changeset 4204 for trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt
- Timestamp:
- 08/12/10 14:36:13 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs
r4179 r4204 29 29 [Item("AlbaTranslocationMoveEvaluator", "Evaluates a translocation or insertion move (3-opt) for the Alba representation.")] 30 30 [StorableClass] 31 public sealed class AlbaTranslocationMoveEvaluator : VRPMoveEvaluator {31 public sealed class AlbaTranslocationMoveEvaluator : VRPMoveEvaluator, IAlbaTranslocationMoveOperator { 32 32 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { 33 33 get { return (ILookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs
r4179 r4204 31 31 [Item("AlbaTranslocationMoveGenerator", "An operator which generates translocation moves for the Alba representation.")] 32 32 [StorableClass] 33 public sealed class AlbaTranslocationMoveGenerator : AlbaMoveOperator, IAlbaTranslocationMoveOperator, IMultiMoveGenerator {33 public sealed class AlbaTranslocationMoveGenerator : PermutationMoveOperator, IAlbaTranslocationMoveOperator, IMultiMoveGenerator { 34 34 public IValueLookupParameter<TranslocationMoveGenerator> TranslocationMoveGeneratorParameter { 35 35 get { return (IValueLookupParameter<TranslocationMoveGenerator>)Parameters["TranslocationMoveGenerator"]; } … … 86 86 string moveName = TranslocationMoveGeneratorParameter.ActualValue.TranslocationMoveParameter.Name; 87 87 88 List<Scope> toBeDeleted = new List<Scope>();89 foreach (Scope scope in this.ExecutionContext.Scope.SubScopes) {90 if (scope.Variables.ContainsKey(moveName)) {91 TranslocationMove move = scope.Variables[moveName].Value as TranslocationMove;92 93 if (move != null) {94 bool criteria1 = true;95 if (move.Index1 - 1 >= 0 &&96 move.Index3 - 1 >= 0)97 criteria1 = (permutation[move.Index1] >= Cities &&98 permutation[move.Index1 - 1] >= Cities &&99 permutation[move.Index3 - 1] >= Cities);100 101 int index3 = move.Index3 + (move.Index2 - move.Index1) + 1;102 bool criteria2 = true;103 if (move.Index2 + 1 < permutation.Length &&104 index3 < permutation.Length)105 criteria2 = (permutation[move.Index2] >= Cities &&106 permutation[move.Index2 + 1] >= Cities &&107 permutation[index3] >= Cities);108 109 if (criteria1 && criteria2)110 toBeDeleted.Add(scope);111 }112 }113 }114 115 foreach (Scope scope in toBeDeleted) {116 this.ExecutionContext.Scope.SubScopes.Remove(scope);117 }118 119 88 return successor; 120 89 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveHardTabuCriterion.cs
r4179 r4204 29 29 [Item("AlbaTranslocationMoveHardTabuCriterion", "An operator which checks if translocation moves are tabu using a hard criterion for the Alba representation.")] 30 30 [StorableClass] 31 public sealed class AlbaTranslocationMoveHardTabuCriterion : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {31 public sealed class AlbaTranslocationMoveHardTabuCriterion : PermutationMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker { 32 32 private TranslocationMoveHardTabuCriterion tabuChecker; 33 33 protected override IPermutationMoveOperator PermutationMoveOperatorParameter { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs
r4179 r4204 31 31 public sealed class AlbaTranslocationMoveMaker : AlbaMoveMaker, IAlbaTranslocationMoveOperator, IVRPMoveMaker { 32 32 private TranslocationMoveMaker moveMaker; 33 protected override IPermutationMoveOperator PermutationMoveOperatorParameter {34 get { return moveMaker; }35 set { moveMaker = value as TranslocationMoveMaker; }36 }37 33 38 34 public ILookupParameter<TranslocationMove> TranslocationMoveParameter { … … 59 55 moveMaker = new TranslocationMoveMaker(); 60 56 } 57 58 public override IOperation Apply() { 59 IOperation next = base.Apply(); 60 61 IVRPEncoding solution = VRPToursParameter.ActualValue; 62 63 moveMaker.PermutationParameter.ActualName = VRPToursParameter.ActualName; 64 IAtomicOperation op = this.ExecutionContext.CreateChildOperation(moveMaker); 65 op.Operator.Execute((IExecutionContext)op); 66 67 return next; 68 } 61 69 } 62 70 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveSoftTabuCriterion.cs
r4179 r4204 29 29 [Item("AlbaTranslocationMoveSoftTabuCriterion", "An operator which checks if translocation moves are tabu using a soft criterion for the Alba representation.")] 30 30 [StorableClass] 31 public sealed class AlbaTranslocationMoveSoftTabuCriterion : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {31 public sealed class AlbaTranslocationMoveSoftTabuCriterion : PermutationMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker { 32 32 private TranslocationMoveSoftTabuCriterion tabuChecker; 33 33 protected override IPermutationMoveOperator PermutationMoveOperatorParameter { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveTabuMaker.cs
r4179 r4204 29 29 [Item("AlbaTranslocationMoveTabuMaker", "An operator which makes translocation moves tabu for the Alba representation.")] 30 30 [StorableClass] 31 public sealed class AlbaTranslocationMoveTabuMaker : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuMaker {31 public sealed class AlbaTranslocationMoveTabuMaker : PermutationMoveOperator, IAlbaTranslocationMoveOperator, ITabuMaker { 32 32 private TranslocationMoveTabuMaker moveTabuMaker; 33 33 protected override IPermutationMoveOperator PermutationMoveOperatorParameter {
Note: See TracChangeset
for help on using the changeset viewer.