Changeset 4692 for branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Tour.cs
- Timestamp:
- 10/29/10 20:36:25 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Tour.cs
r4174 r4692 32 32 public List<int> Cities { get; private set; } 33 33 34 [StorableConstructor] 35 protected Tour(bool deserializing) : base(deserializing) { } 36 protected Tour(Tour original, Cloner cloner) 37 : base(original, cloner) { 38 Cities = new List<int>(original.Cities); 39 } 34 40 public Tour() { 35 41 Cities = new List<int>(); … … 37 43 38 44 public override IDeepCloneable Clone(Cloner cloner) { 39 Tour clone = base.Clone(cloner) as Tour; 40 clone.Cities = new List<int>(Cities); 41 42 return clone; 45 return new Tour(this, cloner); 43 46 } 44 47 … … 63 66 return eval.Overload < double.Epsilon && eval.Tardiness < double.Epsilon; 64 67 } 65 66 public double GetLength(DoubleMatrix coordinates, 67 ILookupParameter<DoubleMatrix> distanceMatrix, 68 69 public double GetLength(DoubleMatrix coordinates, 70 ILookupParameter<DoubleMatrix> distanceMatrix, 68 71 BoolValue useDistanceMatrix) { 69 72 double length = 0; … … 79 82 for (int i = 1; i < cities.Count; i++) { 80 83 length += VRPUtilities.GetDistance( 81 cities[i - 1], cities[i], coordinates, distanceMatrix, useDistanceMatrix); 84 cities[i - 1], cities[i], coordinates, distanceMatrix, useDistanceMatrix); 82 85 } 83 86 }
Note: See TracChangeset
for help on using the changeset viewer.