- Timestamp:
- 07/28/11 14:16:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Tour.cs
r4752 r6607 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Core; 29 using HeuristicLab.Problems.VehicleRouting.Interfaces; 29 30 30 31 namespace HeuristicLab.Problems.VehicleRouting { … … 46 47 this.Stops = new List<int>(original.Stops); 47 48 } 49 50 public double GetTourLength(IVRPProblemInstance instance) { 51 double length = 0; 52 53 if (Stops.Count > 0) { 54 List<int> cities = new List<int>(); 55 cities.Add(0); 56 foreach (int city in Stops) { 57 cities.Add(city); 58 } 59 cities.Add(0); 60 61 for (int i = 1; i < cities.Count; i++) { 62 length += instance.GetDistance(cities[i - 1], cities[i]); 63 } 64 } 65 66 return length; 67 } 48 68 } 49 69 }
Note: See TracChangeset
for help on using the changeset viewer.