- Timestamp:
- 09/09/10 16:24:09 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/TourEncoding.cs
r4365 r4376 71 71 protected IVRPProblemInstance ProblemInstance { get; set; } 72 72 73 public override IDeepCloneable Clone(Cloner cloner) {74 TourEncoding clone = (TourEncoding)base.Clone(cloner);75 76 clone.ProblemInstance = (IVRPProblemInstance)cloner.Clone(ProblemInstance);77 78 return clone;79 }80 81 73 public TourEncoding(IVRPProblemInstance problemInstance) { 82 74 Tours = new ItemList<Tour>(); … … 87 79 [StorableConstructor] 88 80 protected TourEncoding(bool serializing) 89 : base() { 81 : base(serializing) { 82 } 83 84 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution, IVRPProblemInstance problemInstance) { 85 solution.Tours = new ItemList<Tour>(encoding.GetTours()); 86 } 87 88 public static void ConvertFrom(List<int> route, TourEncoding solution) { 89 solution.Tours = new ItemList<Tour>(); 90 91 Tour tour = new Tour(); 92 for (int i = 0; i < route.Count; i++) { 93 if (route[i] == 0) { 94 if (tour.Stops.Count > 0) { 95 solution.Tours.Add(tour); 96 tour = new Tour(); 97 } 98 } else { 99 tour.Stops.Add(route[i]); 100 } 101 } 90 102 } 91 103 }
Note: See TracChangeset
for help on using the changeset viewer.