Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/24/20 00:58:42 (4 years ago)
Author:
abeham
Message:

#2521: working on VRP (WIP)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Crossovers/GVRCrossover.cs

    r17226 r17698  
    5252    }
    5353
    54     private GVREncoding Crossover(IRandom random, GVREncoding parent1, GVREncoding parent2) {
    55       GVREncoding child = parent1.Clone() as GVREncoding;
     54    private GVREncodedSolution Crossover(IRandom random, GVREncodedSolution parent1, GVREncodedSolution parent2) {
     55      GVREncodedSolution child = parent1.Clone() as GVREncodedSolution;
    5656
    5757      Tour tour = parent2.Tours[random.Next(parent2.Tours.Count)];
     
    9797      } else {
    9898        //special case -> only one tour, whole tour has been chosen as subroute
    99         child = parent1.Clone() as GVREncoding;
     99        child = parent1.Clone() as GVREncodedSolution;
    100100      }
    101101
     
    104104
    105105    public override IOperation InstrumentedApply() {
    106       ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
     106      ItemArray<IVRPEncodedSolution> parents = new ItemArray<IVRPEncodedSolution>(ParentsParameter.ActualValue.Length);
    107107      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
    108         IVRPEncoding solution = ParentsParameter.ActualValue[i];
    109         if (!(solution is GVREncoding)) {
    110           parents[i] = GVREncoding.ConvertFrom(solution, ProblemInstance);
     108        IVRPEncodedSolution solution = ParentsParameter.ActualValue[i];
     109        if (!(solution is GVREncodedSolution)) {
     110          parents[i] = GVREncodedSolution.ConvertFrom(solution, ProblemInstance);
    111111        } else {
    112112          parents[i] = solution;
     
    115115      ParentsParameter.ActualValue = parents;
    116116
    117       ChildParameter.ActualValue = Crossover(RandomParameter.ActualValue, parents[0] as GVREncoding, parents[1] as GVREncoding);
     117      ChildParameter.ActualValue = Crossover(RandomParameter.ActualValue, parents[0] as GVREncodedSolution, parents[1] as GVREncodedSolution);
    118118
    119119      return base.InstrumentedApply();
Note: See TracChangeset for help on using the changeset viewer.