Changeset 6751 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMoveMaker.cs
- Timestamp:
- 09/13/11 15:59:26 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.