Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/29/11 15:51:56 (13 years ago)
Author:
svonolfe
Message:

Added support for multi depot CVRP instances (#1177)

File:
1 edited

Legend:

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

    r6607 r6851  
    4848    }
    4949
    50     public double GetTourLength(IVRPProblemInstance instance) {
     50    public double GetTourLength(IVRPProblemInstance instance, IVRPEncoding solution) {
    5151      double length = 0;
    5252
     
    6060
    6161        for (int i = 1; i < cities.Count; i++) {
    62           length += instance.GetDistance(cities[i - 1], cities[i]);
     62          length += instance.GetDistance(cities[i - 1], cities[i], solution);
    6363        }
    6464      }
     
    6666      return length;
    6767    }
     68
     69    public bool IsEqual(Tour tour) {
     70      bool equal = (tour != null) && (tour.Stops.Count == Stops.Count);
     71      int index = 0;
     72
     73      while (equal && index < Stops.Count) {
     74        equal = equal && tour.Stops[index] == Stops[index];
     75        index++;
     76      }     
     77
     78      return equal;
     79    }
    6880  }
    6981}
Note: See TracChangeset for help on using the changeset viewer.