Changeset 4205 for trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch
- Timestamp:
- 08/12/10 18:42:54 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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"]; }
Note: See TracChangeset
for help on using the changeset viewer.