Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/12/17 21:07:36 (7 years ago)
Author:
abeham
Message:

#2696, #2790: merged revisions 15072, 15083, 15168 to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.VehicleRouting

  • stable/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs

    r15217 r15219  
    194194
    195195    private void EvalBestKnownSolution() {
    196       if (BestKnownSolution != null) {
     196      if (BestKnownSolution == null) return;
     197      try {
    197198        //call evaluator
    198199        BestKnownQuality = new DoubleValue(ProblemInstance.Evaluate(BestKnownSolution.Solution).Quality);
    199200        BestKnownSolution.Quality = BestKnownQuality;
     201      } catch {
     202        BestKnownQuality = null;
     203        BestKnownSolution = null;
    200204      }
    201205    }
     
    207211    void ProblemInstance_EvaluationChanged(object sender, EventArgs e) {
    208212      BestKnownQuality = null;
    209       EvalBestKnownSolution();
     213      if (BestKnownSolution != null) {
     214        // the tour is not valid if there are more vehicles in it than allowed
     215        if (ProblemInstance.Vehicles.Value < BestKnownSolution.Solution.GetTours().Count) {
     216          BestKnownSolution = null;
     217        } else EvalBestKnownSolution();
     218      }
    210219    }
    211220
Note: See TracChangeset for help on using the changeset viewer.