- Timestamp:
- 12/17/10 13:42:53 (14 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
- Files:
-
- 20 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Moves/VRPMoveEvaluator.cs
r4752 r5127 44 44 get { return (ILookupParameter<DoubleValue>)Parameters["MoveQuality"]; } 45 45 } 46 public ILookupParameter<DoubleValue> MovePenaltyParameter { 47 get { return (ILookupParameter<DoubleValue>)Parameters["MovePenalty"]; } 48 } 46 49 47 50 [StorableConstructor] … … 52 55 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the solution.")); 53 56 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move.")); 57 Parameters.Add(new LookupParameter<DoubleValue>("MovePenalty", "The penalty applied to the move.")); 54 58 } 55 59 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Moves/VRPMoveMaker.cs
r4752 r5127 42 42 get { return (ILookupParameter<DoubleValue>)Parameters["MoveQuality"]; } 43 43 } 44 public ILookupParameter<DoubleValue> MovePenaltyParameter { 45 get { return (ILookupParameter<DoubleValue>)Parameters["MovePenalty"]; } 46 } 44 47 45 48 [StorableConstructor] … … 50 53 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the solution.")); 51 54 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move.")); 55 Parameters.Add(new LookupParameter<DoubleValue>("MovePenalty", "The penalty applied to the move.")); 52 56 } 53 57 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/TourEncoding.cs
r4899 r5127 39 39 #region IVRPEncoding Members 40 40 public virtual List<Tour> GetTours() { 41 List<Tour> result = new List<Tour>(Tours); 41 List<Tour> result = new List<Tour>(); 42 43 foreach(Tour tour in Tours) { 44 if (tour.Stops.Count > 0) 45 result.Add(tour); 46 } 42 47 43 48 while (result.Count > ProblemInstance.Vehicles.Value) { -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs
r4752 r5127 39 39 public List<int> Unrouted { get; set; } 40 40 41 [Storable] 42 public double PenaltyFactor { get; set; } 43 41 44 public PotvinEncoding(IVRPProblemInstance instance) 42 45 : base(instance) { 43 46 Unrouted = new List<int>(); 47 PenaltyFactor = 1; 44 48 } 45 49 … … 56 60 : base(original, cloner) { 57 61 this.Unrouted = new List<int>(original.Unrouted); 62 this.PenaltyFactor = original.PenaltyFactor; 58 63 } 59 64 … … 72 77 73 78 return solution; 79 } 80 81 public double EvaluateTour(Tour tour) { 82 return ProblemInstance.Evaluate(tour); 74 83 } 75 84 … … 91 100 92 101 return length; 102 } 103 104 public int FindBestInsertionPlace(Tour tour, int city) { 105 int place = -1; 106 double minQuality = -1; 107 108 for (int i = 0; i <= tour.Stops.Count; i++) { 109 tour.Stops.Insert(i, city); 110 111 double quality = EvaluateTour(tour); 112 113 if (place < 0 || quality < minQuality) { 114 place = i; 115 minQuality = quality; 116 } 117 118 tour.Stops.RemoveAt(i); 119 } 120 121 if (place == -1) 122 place = 0; 123 124 return place; 93 125 } 94 126
Note: See TracChangeset
for help on using the changeset viewer.