Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/01/11 17:48:53 (13 years ago)
Author:
mkommend
Message:

#1479: Integrated trunk changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs

    r5445 r6618  
    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
     53      bool allowInfeasible = AllowInfeasibleSolutions.Value.Value;
     54
    4355      PotvinEncoding child = parent1.Clone() as PotvinEncoding;
    4456      Tour newTour = new Tour();
     
    6981          child.Unrouted.Add(city);
    7082
    71       if (Feasible(newTour) &&
    72           Repair(random, child, newTour)) {
     83      if (Repair(random, child, newTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible) || allowInfeasible) {
    7384        return child;
    7485      } else {
    75         if (random.NextDouble() < 0.5)
     86         if (random.NextDouble() < 0.5)
    7687          return parent1.Clone() as PotvinEncoding;
    7788        else
    78           return parent2.Clone() as PotvinEncoding;
     89          return parent2.Clone() as PotvinEncoding;   
    7990      }
    8091    }
Note: See TracChangeset for help on using the changeset viewer.