Changeset 4205
- Timestamp:
- 08/12/10 18:42:54 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3
- Files:
-
- 9 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMove.cs
r4204 r4205 25 25 using HeuristicLab.Common; 26 26 using System.Collections.Generic; 27 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 28 using HeuristicLab.Data; 27 29 28 30 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 29 31 [Item("InversionMove", "Item that describes a lambda move on an Alba VRP representation.")] 30 32 [StorableClass] 31 public class LambdaInterchangeMove: Item {33 public class LambdaInterchangeMove: Item, IVRPMove { 32 34 [Storable] 33 35 public int Tour1 { get; protected set; } … … 83 85 return clone; 84 86 } 87 88 #region IVRPMove Members 89 90 public TourEvaluation GetMoveQuality( 91 IVRPEncoding individual, 92 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 93 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, 94 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, 95 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 96 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 97 return LambdaInterchangeMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this, 98 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 99 coordinates, fleetUsageFactor, timeFactor, distanceFactor, 100 overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix); 101 } 102 103 public void MakeMove(IRandom random, IVRPEncoding individual) { 104 LambdaInterchangeMoveMaker.Apply(individual as AlbaEncoding, this); 105 } 106 107 #endregion 85 108 } 86 109 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMoveEvaluator.cs
r4204 r4205 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba; 27 using HeuristicLab.Data; 27 28 28 29 namespace HeuristicLab.Problems.VehicleRouting { … … 42 43 } 43 44 44 protected override TourEvaluation GetMoveQuality() { 45 LambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue; 46 //perform move 47 AlbaEncoding newSolution = VRPToursParameter.ActualValue.Clone() as AlbaEncoding; 45 public static TourEvaluation GetMoveQuality(AlbaEncoding individual, LambdaInterchangeMove move, 46 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 47 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, 48 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, 49 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 50 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 51 AlbaEncoding newSolution = individual.Clone() as AlbaEncoding; 48 52 LambdaInterchangeMoveMaker.Apply(newSolution, move); 49 53 50 54 return VRPEvaluator.Evaluate( 51 newSolution, 55 newSolution, dueTimeArray, serviceTimeArray, readyTimeArray, 56 demandArray, capacity, fleetUsageFactor, timeFactor, distanceFactor, 57 overloadPenalty, tardinessPenalty, coordinates, distanceMatrix, useDistanceMatrix); 58 } 59 60 protected override TourEvaluation GetMoveQuality() { 61 return GetMoveQuality( 62 VRPToursParameter.ActualValue as AlbaEncoding, LambdaInterchangeMoveParameter.ActualValue, 52 63 DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 53 DemandParameter.ActualValue, CapacityParameter.ActualValue, 54 FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, TardinessPenalty.ActualValue,55 CoordinatesParameter.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);64 DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue, 65 FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, 66 TardinessPenalty.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue); 56 67 } 57 68 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/StochasticLambdaInterchangeSingleMoveGenerator.cs
r4204 r4205 27 27 using HeuristicLab.Parameters; 28 28 using System.Collections.Generic; 29 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 29 30 30 31 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 31 32 [Item("StochasticLambdaInterchangeSingleMoveGenerator", "Generates one random lambda interchange move from a given Alba VRP encoding.")] 32 33 [StorableClass] 33 public sealed class StochasticLambdaInterchangeSingleMoveGenerator : LambdaInterchangeMoveGenerator, IStochasticOperator, ISingleMoveGenerator, IAlbaLambdaInterchangeMoveOperator { 34 public sealed class StochasticLambdaInterchangeSingleMoveGenerator : LambdaInterchangeMoveGenerator, 35 IStochasticOperator, ISingleMoveGenerator, IAlbaLambdaInterchangeMoveOperator, IMultiVRPMoveGenerator { 36 #region IMultiVRPMoveOperator Members 37 38 public ILookupParameter VRPMoveParameter { 39 get { return (ILookupParameter)Parameters["LambdaInterchangeMove"]; } 40 } 41 42 #endregion 43 34 44 public ILookupParameter<IRandom> RandomParameter { 35 45 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch/SimpleLocalSearchMove.cs
r4204 r4205 24 24 using HeuristicLab.Encodings.PermutationEncoding; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 27 using HeuristicLab.Data; 26 28 27 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 28 30 [Item("InversionMove", "Item that describes a simple local search move on an Alba VRP representation.")] 29 31 [StorableClass] 30 public class SimpleLocalSearchMove : TwoIndexMove {32 public class SimpleLocalSearchMove : TwoIndexMove, IVRPMove { 31 33 public SimpleLocalSearchMove() 32 34 : base() { … … 51 53 return clone; 52 54 } 55 56 #region IVRPMove Members 57 58 public TourEvaluation GetMoveQuality( 59 IVRPEncoding individual, 60 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 61 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, 62 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, 63 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 64 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 65 return SimpleLocalSearchMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this, 66 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 67 coordinates, fleetUsageFactor, timeFactor, distanceFactor, 68 overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix); 69 } 70 71 public void MakeMove(IRandom random, IVRPEncoding individual) { 72 SimpleLocalSearchMoveMaker.Apply(individual as AlbaEncoding, this); 73 } 74 75 #endregion 53 76 } 54 77 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch/SimpleLocalSearchMoveEvaluator.cs
r4204 r4205 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba; 27 using HeuristicLab.Data; 27 28 28 29 namespace HeuristicLab.Problems.VehicleRouting { … … 42 43 } 43 44 44 protected override TourEvaluation GetMoveQuality() { 45 SimpleLocalSearchMove move = SimpleLocalSearchMoveParameter.ActualValue; 46 //perform move 47 AlbaEncoding newSolution = VRPToursParameter.ActualValue.Clone() as AlbaEncoding; 45 public static TourEvaluation GetMoveQuality(AlbaEncoding individual, SimpleLocalSearchMove move, 46 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 47 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, 48 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, 49 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 50 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 51 AlbaEncoding newSolution = individual.Clone() as AlbaEncoding; 48 52 SimpleLocalSearchMoveMaker.Apply(newSolution, move); 49 53 50 54 return VRPEvaluator.Evaluate( 51 newSolution, 55 newSolution, dueTimeArray, serviceTimeArray, readyTimeArray, 56 demandArray, capacity, fleetUsageFactor, timeFactor, distanceFactor, 57 overloadPenalty, tardinessPenalty, coordinates, distanceMatrix, useDistanceMatrix); 58 } 59 60 protected override TourEvaluation GetMoveQuality() { 61 return GetMoveQuality( 62 VRPToursParameter.ActualValue as AlbaEncoding, SimpleLocalSearchMoveParameter.ActualValue, 52 63 DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 53 DemandParameter.ActualValue, CapacityParameter.ActualValue, 54 FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, TardinessPenalty.ActualValue,55 CoordinatesParameter.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);64 DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue, 65 FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, 66 TardinessPenalty.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue); 56 67 } 57 68 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch/StochasticSimpleLocalSearchSingleMoveGenerator.cs
r4204 r4205 27 27 using HeuristicLab.Parameters; 28 28 using System.Collections.Generic; 29 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 29 30 30 31 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 31 32 [Item("StochasticSimpleLocalSearchSingleMoveGenerator", "Generates one random simple local search move from a given Alba VRP encoding.")] 32 33 [StorableClass] 33 public sealed class StochasticSimpleLocalSearchSingleMoveGenerator : SimpleLocalSearchMoveGenerator, IStochasticOperator, ISingleMoveGenerator, IAlbaSimpleLocalSearchMoveOperator { 34 public sealed class StochasticSimpleLocalSearchSingleMoveGenerator : SimpleLocalSearchMoveGenerator, 35 IStochasticOperator, ISingleMoveGenerator, IAlbaSimpleLocalSearchMoveOperator, IMultiVRPMoveGenerator { 36 #region IMultiVRPMoveOperator Members 37 38 public ILookupParameter VRPMoveParameter { 39 get { return (ILookupParameter)Parameters["SimpleLocalSearchMove"]; } 40 } 41 42 #endregion 43 34 44 public ILookupParameter<IRandom> RandomParameter { 35 45 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/HeuristicLab.Problems.VehicleRouting-3.3.csproj
r4204 r4205 134 134 <Compile Include="Encodings\General\Crossovers\MultiVRPCrossover.cs" /> 135 135 <Compile Include="Encodings\General\Creators\RandomCreator.cs" /> 136 <Compile Include="Encodings\General\Moves\Interfaces\IMultiVRPMoveGenerator.cs" /> 137 <Compile Include="Encodings\General\Moves\Interfaces\IVRPMove.cs" /> 138 <Compile Include="Encodings\General\Moves\Interfaces\IMultiVRPMoveOperator.cs" /> 139 <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveEvaluator.cs" /> 140 <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveMaker.cs" /> 141 <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveGenerator.cs" /> 136 142 <Compile Include="Encodings\Potvin\Crossovers\SequenceBasedCrossover2.cs" /> 137 143 <Compile Include="Encodings\Potvin\Crossovers\RouteBasedCrossover.cs" />
Note: See TracChangeset
for help on using the changeset viewer.