Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/07/17 10:43:13 (8 years ago)
Author:
jkarder
Message:

#2205: worked on optimization networks

  • added lrp network 3
  • fixed bug in distance calculation
  • renamed FLP.mod to FLP_1.mod
  • activated cma analyzer per default
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpUtils.cs

    r14604 r14649  
    1919      DistanceFuncs = new Dictionary<DistanceType, Func<double[,], int, double[,], int, double>>();
    2020      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));
    2222    }
    2323
     
    135135    }
    136136
    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];
    139139
    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      }
    142144      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];
    145147      }
    146148
     
    148150    }
    149151
    150     public static double[,] GetVrpDistances(double[,] depotCoordinates, double[,] customerCoordinates, int depotIdx, int[] customers, DistanceType distanceType) {
    151       var coordinates = GetVrpCoordinates(depotCoordinates, customerCoordinates, depotIdx, customers);
     152    public static double[,] GetVrpDistances(double[,] depotCoordinates, double[,] customerCoordinates, int[] depots, int[] customers, DistanceType distanceType) {
     153      var coordinates = GetVrpCoordinates(depotCoordinates, customerCoordinates, depots, customers);
    152154      return GetVrpDistances(coordinates, distanceType);
    153155    }
Note: See TracChangeset for help on using the changeset viewer.