Changeset 4378 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs
- Timestamp:
- 09/10/10 13:00:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs
r4376 r4378 84 84 } 85 85 86 pr otectedVRPEvaluation EvaluateTour(IVRPProblemInstance instance, Tour tour) {86 private VRPEvaluation EvaluateTour(IVRPProblemInstance instance, Tour tour) { 87 87 VRPEvaluation evaluation = CreateTourEvaluation(); 88 88 EvaluateTour(evaluation, instance, tour); … … 92 92 #region IVRPEvaluator Members 93 93 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(); 96 100 97 101 foreach (Tour tour in solution.GetTours()) { 98 if (!Feasible(instance, tour)) { 99 feasible = false; 100 break; 101 } 102 EvaluateTour(evaluation, instance, tour); 102 103 } 103 104 104 return feasible;105 return evaluation; 105 106 } 106 107 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); 123 110 } 124 111
Note: See TracChangeset
for help on using the changeset viewer.