Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/06/11 13:00:12 (13 years ago)
Author:
svonolfe
Message:

Added support for pickups and deliveries (#1177)

File:
1 edited

Legend:

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

    r6608 r6710  
    2727using System;
    2828using HeuristicLab.Parameters;
     29using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    151152      int city, bool allowInfeasible, out int place) {
    152153      place = -1;
     154
     155      if (tour.Stops.Contains(city))
     156        return false;
     157
    153158      bool bestFeasible = false;
    154159      double minDetour = 0;
    155160
     161      VRPEvaluation eval = ProblemInstance.Evaluate(tour);
     162      double length = eval.Quality;
    156163      for (int i = 0; i <= tour.Stops.Count; i++) {
    157         double length = tour.GetTourLength(ProblemInstance);
    158 
    159164        tour.Stops.Insert(i, city);
    160165
    161         bool feasible = ProblemInstance.Feasible(tour);
     166        eval = ProblemInstance.Evaluate(tour);
     167        bool feasible = ProblemInstance.Feasible(eval);
    162168
    163169        if (feasible || allowInfeasible && !bestFeasible) {
    164           double newLength = tour.GetTourLength(ProblemInstance);
     170          double newLength = eval.Quality;
    165171          double detour = newLength - length;
    166172
Note: See TracChangeset for help on using the changeset viewer.