Changeset 6751 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
- Timestamp:
- 09/13/11 15:59:26 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/LambdaInterchange/AlbaStochasticLambdaInterchangeMutliMoveGenerator.cs
r6607 r6751 73 73 74 74 protected override AlbaLambdaInterchangeMove[] GenerateMoves(AlbaEncoding individual, IVRPProblemInstance problemInstance, int lambda) { 75 return GenerateAllMoves(individual, problemInstance, lambda, SampleSizeParameter. Value.Value, RandomParameter.ActualValue);75 return GenerateAllMoves(individual, problemInstance, lambda, SampleSizeParameter.ActualValue.Value, RandomParameter.ActualValue); 76 76 } 77 77 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMove.cs
r5127 r6751 30 30 31 31 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 32 [Item(" AlbaLambdaInterchangeMove", "Item that describes a lambda move on a VRP representation. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")]32 [Item("PotvinCustomerRelocationMove", "Item that describes a relocation move on a VRP representation.")] 33 33 [StorableClass] 34 34 public class PotvinCustomerRelocationMove: Item, IVRPMove { -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMoveEvaluator.cs
r5867 r6751 76 76 77 77 PotvinEncoding newSolution = CustomerRelocationMoveParameter.ActualValue.Individual.Clone() as PotvinEncoding; 78 PotvinCustomerRelocationMoveMaker.Apply(newSolution, move );78 PotvinCustomerRelocationMoveMaker.Apply(newSolution, move, ProblemInstance); 79 79 80 80 UpdateEvaluation(newSolution); … … 91 91 if (additionFrequency.ContainsKey(attr)) { 92 92 int frequency = additionFrequency[attr].Value; 93 double quality = MoveQualityParameter.ActualValue.Value - MovePenaltyParameter.ActualValue.Value;93 double quality = MoveQualityParameter.ActualValue.Value; 94 94 95 95 MoveQualityParameter.ActualValue.Value += 96 LambdaParameter.Value.Value * quality * frequency * System.Math.Sqrt(ProblemInstance.Cities.Value * ProblemInstance.Vehicles.Value);96 LambdaParameter.Value.Value * quality * frequency; 97 97 } 98 98 } 99 99 } 100 101 //Apply constraint relaxation102 MoveQualityParameter.ActualValue.Value += MovePenaltyParameter.ActualValue.Value * (newSolution.PenaltyFactor - 1.0);103 100 } 104 101 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMoveMaker.cs
r6607 r6751 28 28 using HeuristicLab.Common; 29 29 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 30 using HeuristicLab.Problems.VehicleRouting.Interfaces; 31 using HeuristicLab.Problems.VehicleRouting.Variants; 30 32 31 33 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 39 41 public override ILookupParameter VRPMoveParameter { 40 42 get { return CustomerRelocationMoveParameter; } 41 }42 43 public IValueParameter<DoubleValue> SigmaParameter {44 get { return (IValueParameter<DoubleValue>)Parameters["Sigma"]; }45 }46 47 public IValueParameter<DoubleValue> MinPenaltyFactorParameter {48 get { return (IValueParameter<DoubleValue>)Parameters["MinPenaltyFactor"]; }49 }50 51 public IValueParameter<DoubleValue> MaxPenaltyFactorParameter {52 get { return (IValueParameter<DoubleValue>)Parameters["MaxPenaltyFactor"]; }53 43 } 54 44 … … 67 57 : base() { 68 58 Parameters.Add(new LookupParameter<PotvinCustomerRelocationMove>("PotvinCustomerRelocationMove", "The moves that should be made.")); 69 Parameters.Add(new ValueParameter<DoubleValue>("Sigma", "The sigma applied to the penalty factor.", new DoubleValue(0.5)));70 Parameters.Add(new ValueParameter<DoubleValue>("MinPenaltyFactor", "The minimum penalty factor.", new DoubleValue(-1000.0)));71 Parameters.Add(new ValueParameter<DoubleValue>("MaxPenaltyFactor", "The maximum penalty factor.", new DoubleValue(1000.0)));72 59 73 60 Parameters.Add(new LookupParameter<VariableCollection>("Memories", "The TS memory collection.")); … … 83 70 } 84 71 85 public static void Apply(PotvinEncoding solution, PotvinCustomerRelocationMove move ) {72 public static void Apply(PotvinEncoding solution, PotvinCustomerRelocationMove move, IVRPProblemInstance problemInstance) { 86 73 if (move.Tour >= solution.Tours.Count) 87 74 solution.Tours.Add(new Tour()); … … 94 81 95 82 int place = solution.FindBestInsertionPlace(tour, move.City); 96 97 83 tour.Stops.Insert(place, move.City); 98 84 } … … 102 88 103 89 PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding; 104 Apply(newSolution, move );90 Apply(newSolution, move, ProblemInstance); 105 91 VRPToursParameter.ActualValue = newSolution; 106 92 … … 108 94 VRPEvaluation eval = ProblemInstance.Evaluate(newSolution); 109 95 MoveQualityParameter.ActualValue.Value = eval.Quality; 110 111 //update penalty factor112 double sigma = SigmaParameter.Value.Value;113 if (ProblemInstance.Feasible(eval)) {114 newSolution.PenaltyFactor /= (1 + sigma);115 if (newSolution.PenaltyFactor < MinPenaltyFactorParameter.Value.Value)116 newSolution.PenaltyFactor = MinPenaltyFactorParameter.Value.Value;117 } else {118 newSolution.PenaltyFactor *= (1 + sigma);119 if (newSolution.PenaltyFactor > MaxPenaltyFactorParameter.Value.Value)120 newSolution.PenaltyFactor = MaxPenaltyFactorParameter.Value.Value;121 }122 96 123 97 //update memory
Note: See TracChangeset
for help on using the changeset viewer.