- Timestamp:
- 08/23/10 14:06:43 (14 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/IntraRouteInversionMove.cs
r4268 r4287 31 31 [StorableClass] 32 32 public class IntraRouteInversionMove : TwoIndexMove, IVRPMove { 33 public IVRPEncoding Individual { get { return Permutation as AlbaEncoding; } } 34 33 35 public IntraRouteInversionMove() 34 36 : base() { … … 41 43 public IntraRouteInversionMove(int index1, int index2, AlbaEncoding permutation) 42 44 : base(index1, index2, permutation) { 45 this.Permutation = permutation.Clone() as AlbaEncoding; 43 46 } 44 47 … … 57 60 58 61 public TourEvaluation GetMoveQuality( 59 I VRPEncoding individual, IntValue vehicles,62 IntValue vehicles, 60 63 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 61 64 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, … … 63 66 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 64 67 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 65 return IntraRouteInversionMoveEvaluator.GetMoveQuality( individualas AlbaEncoding, this, vehicles,68 return IntraRouteInversionMoveEvaluator.GetMoveQuality(Permutation as AlbaEncoding, this, vehicles, 66 69 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 67 70 coordinates, fleetUsageFactor, timeFactor, distanceFactor, … … 69 72 } 70 73 71 public void MakeMove(IRandom random, IVRPEncoding individual) { 72 IntraRouteInversionMoveMaker.Apply(individual as AlbaEncoding, this); 74 public IVRPEncoding MakeMove(IRandom random) { 75 IntraRouteInversionMoveMaker.Apply(Individual as AlbaEncoding, this); 76 77 return Individual; 73 78 } 74 79 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/ExhaustiveLambdaInterchangeMoveGenerator.cs
r4230 r4287 55 55 for(int index2 = 0; index2 < tour2.Cities.Count - length2 + 1; index2++) { 56 56 moves.Add(new LambdaInterchangeMove(tour1Index, index1, length1, 57 tour2Index, index2, length2 ));57 tour2Index, index2, length2, individual)); 58 58 } 59 59 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMove.cs
r4268 r4287 33 33 public class LambdaInterchangeMove: Item, IVRPMove { 34 34 [Storable] 35 public IVRPEncoding Individual { get; protected set; } 36 37 [Storable] 35 38 public int Tour1 { get; protected set; } 36 39 … … 58 61 Position2 = -1; 59 62 Length2 = -1; 63 64 Individual = null; 60 65 } 61 66 62 67 public LambdaInterchangeMove(int tour1, int position1, int length1, 63 int tour2, int position2, int length2 ) {68 int tour2, int position2, int length2, AlbaEncoding permutation) { 64 69 Tour1 = tour1; 65 70 Position1 = position1; … … 69 74 Position2 = position2; 70 75 Length2 = length2; 76 77 this.Individual = permutation.Clone() as AlbaEncoding; 71 78 } 72 79 … … 82 89 clone.Length2 = Length2; 83 90 91 if (Individual != null) 92 clone.Individual = (AlbaEncoding)cloner.Clone(Individual); 93 84 94 cloner.RegisterClonedObject(this, clone); 85 95 return clone; … … 89 99 90 100 public TourEvaluation GetMoveQuality( 91 I VRPEncoding individual, IntValue vehicles,101 IntValue vehicles, 92 102 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 93 103 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, … … 95 105 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 96 106 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 97 return LambdaInterchangeMoveEvaluator.GetMoveQuality( individual as AlbaEncoding, this,vehicles,107 return LambdaInterchangeMoveEvaluator.GetMoveQuality(Individual as AlbaEncoding, this, vehicles, 98 108 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 99 109 coordinates, fleetUsageFactor, timeFactor, distanceFactor, … … 101 111 } 102 112 103 public void MakeMove(IRandom random, IVRPEncoding individual) { 104 LambdaInterchangeMoveMaker.Apply(individual as AlbaEncoding, this); 113 public IVRPEncoding MakeMove(IRandom random) { 114 LambdaInterchangeMoveMaker.Apply(Individual as AlbaEncoding, this); 115 116 return Individual; 105 117 } 106 118 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/StochasticLambdaInterchangeSingleMoveGenerator.cs
r4286 r4287 74 74 int index2 = rand.Next(route2.Cities.Count - length2 + 1); 75 75 76 return new LambdaInterchangeMove(route1Index, index1, length1, route2Index, index2, length2 );76 return new LambdaInterchangeMove(route1Index, index1, length1, route2Index, index2, length2, individual); 77 77 } 78 78 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/Interfaces/IVRPMove.cs
r4268 r4287 27 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { 28 28 public interface IVRPMove : IItem { 29 TourEvaluation GetMoveQuality(I VRPEncoding individual, IntValue vehicles,29 TourEvaluation GetMoveQuality(IntValue vehicles, 30 30 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, 31 31 DoubleValue capacity,DoubleMatrix coordinates, … … 34 34 ILookupParameter<DoubleMatrix> distanceMatrix, BoolValue useDistanceMatrix); 35 35 36 void MakeMove(IRandom random, IVRPEncoding individual);36 IVRPEncoding MakeMove(IRandom random); 37 37 } 38 38 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveEvaluator.cs
r4268 r4287 46 46 47 47 return move.GetMoveQuality( 48 VRPToursParameter.ActualValue,49 48 VehiclesParameter.ActualValue, 50 49 DueTimeParameter.ActualValue, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveMaker.cs
r4205 r4287 114 114 115 115 //perform move 116 move.MakeMove(RandomParameter.ActualValue, VRPToursParameter.ActualValue);116 VRPToursParameter.ActualValue = move.MakeMove(RandomParameter.ActualValue); 117 117 118 118 quality.Value = moveQuality.Value;
Note: See TracChangeset
for help on using the changeset viewer.