- Timestamp:
- 11/19/10 13:54:50 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestVRPSolutionAnalyzer.cs
r4722 r4851 81 81 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 82 82 } 83 public LookupParameter<DoubleValue> BestKnownQualityParameter { 84 get { return (LookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; } 85 } 86 public LookupParameter<VRPSolution> BestKnownSolutionParameter { 87 get { return (LookupParameter<VRPSolution>)Parameters["BestKnownSolution"]; } 88 } 83 89 84 90 [StorableConstructor] … … 97 103 Parameters.Add(new LookupParameter<DoubleArray>("ServiceTime", "The service time of each customer.")); 98 104 105 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance.")); 106 Parameters.Add(new LookupParameter<VRPSolution>("BestKnownSolution", "The best known solution of this VRP instance.")); 107 99 108 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the VRP solutions which should be analyzed.")); 100 109 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Distance", "The distances of the VRP solutions which should be analyzed.")); … … 111 120 } 112 121 122 [StorableHook(HookType.AfterDeserialization)] 123 private void AfterDeserializationHook() { 124 #region Backwards Compatibility 125 if (!Parameters.ContainsKey("BestKnownQuality")) { 126 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance.")); 127 } 128 if (!Parameters.ContainsKey("BestKnownSolution")) { 129 Parameters.Add(new LookupParameter<VRPSolution>("BestKnownSolution", "The best known solution of this VRP instance.")); 130 } 131 #endregion 132 } 133 113 134 public override IOperation Apply() { 114 135 DoubleMatrix coordinates = CoordinatesParameter.ActualValue; … … 121 142 ItemArray<DoubleValue> travelTimes = TravelTimeParameter.ActualValue; 122 143 ItemArray<DoubleValue> vehiclesUtilizations = VehiclesUtilizedParameter.ActualValue; 144 145 DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue; 123 146 124 147 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; … … 159 182 } 160 183 184 if (bestKnownQuality == null || 185 qualities[i].Value < bestKnownQuality.Value) { 186 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value); 187 BestKnownSolutionParameter.ActualValue = (VRPSolution)solution.Clone(); 188 } 189 161 190 return base.Apply(); 162 191 }
Note: See TracChangeset
for help on using the changeset viewer.