Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/15/12 10:42:00 (13 years ago)
Author:
svonolfe
Message:

Worked on VRP path relinking (#1331)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/LocalImprovement/AlbaLambdaInterchangeLocalImprovementOperator.cs

    r7259 r7821  
    101101    }
    102102
    103     public static void Apply(AlbaEncoding solution, int maxIterations,
     103    public static void Apply(AlbaEncoding solution, int maxIterations, bool firstImprovement,
    104104      int lambda, int samples, IRandom random, ref double quality, out int evaluatedSolutions,
    105105      DoubleMatrix distanceMatrix, IntValue vehicles, DoubleArray dueTime, DoubleArray serviceTime, DoubleArray readyTime,
     
    110110
    111111      evaluatedSolutions = 0;
     112
     113      if (quality == -1) {
     114        quality = VRPEvaluator.Evaluate(solution, vehicles, dueTime, serviceTime, readyTime,
     115          demand, capacity, fleetUsageFactor, timeFactor, distanceFactor,
     116          overloadPenalty, tardinessPenalty, coordinates,
     117          distanceMatrixParameter, useDistanceMatrix).Quality;
     118        evaluatedSolutions++;
     119      }
    112120
    113121      for (int i = 0; i < maxIterations; i++) {
     
    126134
    127135          evaluatedSolutions++;
    128           if (moveQuality < quality || quality == -1) {
     136          if (moveQuality < quality) {
    129137            quality = moveQuality;
    130138            bestMove = move;
     139
     140            if (firstImprovement)
     141              break;
    131142          }
    132143        }
     
    155166      int evaluatedSolutions;
    156167
    157       Apply(solution, maxIterations, lambda, samples, random, ref quality, out evaluatedSolutions,
     168      Apply(solution, maxIterations, false, lambda, samples, random, ref quality, out evaluatedSolutions,
    158169        problem.DistanceMatrix, problem.Vehicles, problem.DueTime, problem.ServiceTime,
    159170        problem.ReadyTime, problem.Demand, problem.Capacity, problem.Coordinates,
Note: See TracChangeset for help on using the changeset viewer.