Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/12 10:15:50 (13 years ago)
Author:
svonolfe
Message:

Fixed minor issues (#1177)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs

    r6960 r7543  
    130130      PotvinEncoding solution = new PotvinEncoding(instance);
    131131
    132       TourEncoding.ConvertFrom(route, solution);
     132      solution.Tours = new ItemList<Tour>();
     133
     134      Tour tour = new Tour();
     135      int routeIdx = 0;
     136      for (int i = 0; i < route.Count; i++) {
     137        if (route[i] <= 0) {
     138          if (tour.Stops.Count > 0) {
     139            solution.Tours.Add(tour);
     140            tour = new Tour();
     141          }
     142          int vehicle = -route[i];
     143          solution.VehicleAssignment[routeIdx] = vehicle;
     144          routeIdx++;
     145        } else {
     146          tour.Stops.Add(route[i]);
     147        }
     148      }
     149
     150      solution.Repair();
    133151
    134152      return solution;
Note: See TracChangeset for help on using the changeset viewer.