Changeset 14649 for branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpUtils.cs
- Timestamp:
- 02/07/17 10:43:13 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpUtils.cs
r14604 r14649 19 19 DistanceFuncs = new Dictionary<DistanceType, Func<double[,], int, double[,], int, double>>(); 20 20 DistanceFuncs.Add(DistanceType.EUC_2D, (d, i, c, j) => Math.Sqrt(Math.Pow(d[i, 0] - c[j, 0], 2.0) + Math.Pow(d[i, 1] - c[j, 1], 2.0))); 21 DistanceFuncs.Add(DistanceType.CEIL_2D, (d, i, c, j) => Math.Ceiling(DistanceFuncs[DistanceType.EUC_2D](d, i, c, j) ) * 100);21 DistanceFuncs.Add(DistanceType.CEIL_2D, (d, i, c, j) => Math.Ceiling(DistanceFuncs[DistanceType.EUC_2D](d, i, c, j) * 100)); 22 22 } 23 23 … … 135 135 } 136 136 137 public static double[,] GetVrpCoordinates(double[,] depotCoordinates, double[,] customerCoordinates, int depotIdx, int[] customers) {138 var coordinates = new double[ customers.Length + 1, 2];137 public static double[,] GetVrpCoordinates(double[,] depotCoordinates, double[,] customerCoordinates, int[] depots, int[] customers) { 138 var coordinates = new double[depots.Length + customers.Length, 2]; 139 139 140 coordinates[0, 0] = depotCoordinates[depotIdx, 0]; 141 coordinates[0, 1] = depotCoordinates[depotIdx, 1]; 140 for (int i = 0; i < depots.Length; i++) { 141 coordinates[i, 0] = depotCoordinates[depots[i], 0]; 142 coordinates[i, 1] = depotCoordinates[depots[i], 1]; 143 } 142 144 for (int i = 0; i < customers.Length; i++) { 143 coordinates[i + 1, 0] = customerCoordinates[customers[i], 0];144 coordinates[i + 1, 1] = customerCoordinates[customers[i], 1];145 coordinates[i + depots.Length, 0] = customerCoordinates[customers[i], 0]; 146 coordinates[i + depots.Length, 1] = customerCoordinates[customers[i], 1]; 145 147 } 146 148 … … 148 150 } 149 151 150 public static double[,] GetVrpDistances(double[,] depotCoordinates, double[,] customerCoordinates, int depotIdx, int[] customers, DistanceType distanceType) {151 var coordinates = GetVrpCoordinates(depotCoordinates, customerCoordinates, depot Idx, customers);152 public static double[,] GetVrpDistances(double[,] depotCoordinates, double[,] customerCoordinates, int[] depots, int[] customers, DistanceType distanceType) { 153 var coordinates = GetVrpCoordinates(depotCoordinates, customerCoordinates, depots, customers); 152 154 return GetVrpDistances(coordinates, distanceType); 153 155 }
Note: See TracChangeset
for help on using the changeset viewer.