Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/10/10 13:00:54 (14 years ago)
Author:
svonolfe
Message:

Improved performance of PotvinEncoding(#1177)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs

    r4376 r4378  
    8484    }
    8585
    86     protected VRPEvaluation EvaluateTour(IVRPProblemInstance instance, Tour tour) {
     86    private VRPEvaluation EvaluateTour(IVRPProblemInstance instance, Tour tour) {
    8787      VRPEvaluation evaluation = CreateTourEvaluation();
    8888      EvaluateTour(evaluation, instance, tour);
     
    9292    #region IVRPEvaluator Members
    9393
    94     public bool Feasible(IVRPProblemInstance instance, IVRPEncoding solution) {
    95       bool feasible = true;
     94    public bool Feasible(VRPEvaluation evaluation) {
     95      return evaluation.Penalty < double.Epsilon;
     96    }
     97
     98    public VRPEvaluation Evaluate(IVRPProblemInstance instance, IVRPEncoding solution) {
     99      VRPEvaluation evaluation = CreateTourEvaluation();
    96100
    97101      foreach (Tour tour in solution.GetTours()) {
    98         if (!Feasible(instance, tour)) {
    99           feasible = false;
    100           break;
    101         }
     102        EvaluateTour(evaluation, instance, tour);
    102103      }
    103104
    104       return feasible;
     105      return evaluation;
    105106    }
    106107
    107     public bool Feasible(IVRPProblemInstance instance, Tour tour) {
    108       return EvaluateTour(instance, tour).Penalty < double.Epsilon;
    109     }
    110 
    111     public double Evaluate(IVRPProblemInstance instance, IVRPEncoding solution) {
    112       double quality = 0;
    113 
    114       foreach (Tour tour in solution.GetTours()) {
    115         quality += Evaluate(instance, tour);
    116       }
    117 
    118       return quality;
    119     }
    120 
    121     public double Evaluate(IVRPProblemInstance instance, Tour tour) {
    122       return EvaluateTour(instance, tour).Quality;
     108    public VRPEvaluation Evaluate(IVRPProblemInstance instance, Tour tour) {
     109      return EvaluateTour(instance, tour);
    123110    }
    124111
Note: See TracChangeset for help on using the changeset viewer.