Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/20/11 13:36:49 (13 years ago)
Author:
svonolfe
Message:

Improved performance of many VRP operators by optimizing the parameter lookup (#1561)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs

    r5445 r6449  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Data;
    2526
    2627namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    4142
    4243    protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) {
     44      BoolValue useDistanceMatrix = UseDistanceMatrixParameter.ActualValue;
     45      DoubleMatrix coordinates = CoordinatesParameter.ActualValue;
     46      DistanceMatrix distMatrix = VRPUtilities.GetDistanceMatrix(coordinates, DistanceMatrixParameter, useDistanceMatrix);
     47      DoubleArray dueTime = DueTimeParameter.ActualValue;
     48      DoubleArray readyTime = ReadyTimeParameter.ActualValue;
     49      DoubleArray serviceTime = ServiceTimeParameter.ActualValue;
     50      DoubleArray demand = DemandParameter.ActualValue;
     51      DoubleValue capacity = CapacityParameter.ActualValue;
     52
    4353      PotvinEncoding child = parent1.Clone() as PotvinEncoding;
    4454      Tour newTour = new Tour();
     
    6979          child.Unrouted.Add(city);
    7080
    71       if (Feasible(newTour) &&
    72           Repair(random, child, newTour)) {
     81      if (Repair(random, child, newTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity)) {
    7382        return child;
    7483      } else {
    75         if (random.NextDouble() < 0.5)
     84         if (random.NextDouble() < 0.5)
    7685          return parent1.Clone() as PotvinEncoding;
    7786        else
    78           return parent2.Clone() as PotvinEncoding;
     87          return parent2.Clone() as PotvinEncoding;   
    7988      }
    8089    }
Note: See TracChangeset for help on using the changeset viewer.