- Timestamp:
- 09/03/10 11:15:22 (14 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances
- Files:
-
- 5 added
- 1 deleted
- 1 edited
- 5 copied
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluation.cs
r4362 r4363 4 4 using System.Text; 5 5 6 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances .Evaluation{6 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 7 7 public class CVRPEvaluation: VRPEvaluation { 8 8 public double Overload { get; set; } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs
r4362 r4363 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.VehicleRouting. Interfaces.Variants;33 using HeuristicLab.Problems.VehicleRouting.Variants; 34 34 35 35 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { … … 37 37 [StorableClass] 38 38 public class CVRPProblemInstance: SingleDepotVRPProblemInstance, ICapacitatedProblemInstance { 39 protected ValueParameter<DoubleValue> CapacityParameter {40 get { return ( ValueParameter<DoubleValue>)Parameters["Capacity"]; }39 protected IValueParameter<DoubleValue> CapacityParameter { 40 get { return (IValueParameter<DoubleValue>)Parameters["Capacity"]; } 41 41 } 42 p ublicIValueParameter<DoubleValue> OverloadPenaltyParameter {42 protected IValueParameter<DoubleValue> OverloadPenaltyParameter { 43 43 get { return (IValueParameter<DoubleValue>)Parameters["EvalOverloadPenalty"]; } 44 44 } … … 59 59 } 60 60 } 61 62 protected override IVRPEvaluator Evaluator { 63 get { 64 return new CVRPEvaluator(); 65 } 66 } 61 67 62 68 [StorableConstructor] -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluation.cs
r4362 r4363 4 4 using System.Text; 5 5 6 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances .Evaluation{6 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 7 7 public class CVRPTWEvaluation: CVRPEvaluation { 8 8 public double Tardiness { get; set; } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs
r4362 r4363 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.VehicleRouting. Interfaces.Variants;33 using HeuristicLab.Problems.VehicleRouting.Variants; 34 34 35 35 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { … … 37 37 [StorableClass] 38 38 public class CVRPTWProblemInstance: CVRPProblemInstance, ITimeWindowedProblemInstance { 39 protected ValueParameter<DoubleArray> ReadyTimeParameter {40 get { return ( ValueParameter<DoubleArray>)Parameters["ReadyTime"]; }39 protected IValueParameter<DoubleArray> ReadyTimeParameter { 40 get { return (IValueParameter<DoubleArray>)Parameters["ReadyTime"]; } 41 41 } 42 protected ValueParameter<DoubleArray> DueTimeParameter {43 get { return ( ValueParameter<DoubleArray>)Parameters["DueTime"]; }42 protected IValueParameter<DoubleArray> DueTimeParameter { 43 get { return (IValueParameter<DoubleArray>)Parameters["DueTime"]; } 44 44 } 45 protected ValueParameter<DoubleArray> ServiceTimeParameter {46 get { return ( ValueParameter<DoubleArray>)Parameters["ServiceTime"]; }45 protected IValueParameter<DoubleArray> ServiceTimeParameter { 46 get { return (IValueParameter<DoubleArray>)Parameters["ServiceTime"]; } 47 47 } 48 48 … … 81 81 } 82 82 } 83 84 protected override IVRPEvaluator Evaluator { 85 get { 86 return new CVRPTWEvaluator(); 87 } 88 } 83 89 84 90 [StorableConstructor] -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPEvaluator.cs
r4362 r4363 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.VehicleRouting. Interfaces.Variants;33 using HeuristicLab.Problems.VehicleRouting.Variants; 34 34 using HeuristicLab.Problems.VehicleRouting.Encodings; 35 using HeuristicLab.Problems.VehicleRouting.DomainModel;36 35 37 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances.Evaluation { 36 37 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 38 [Item("SingleDepotVRPEvaluator", "Represents a single depot VRP evaluator.")] 39 39 [StorableClass] 40 40 public class SingleDepotVRPEvaluator: VRPEvaluator { 41 41 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour) { 42 double distance = 0.0; 43 double quality = 0.0; 42 44 45 //simulate a tour, start and end at depot 46 for (int i = 0; i <= tour.Stops.Count; i++) { 47 int start = 0; 48 if (i > 0) 49 start = tour.Stops[i - 1]; 50 int end = 0; 51 if (i < tour.Stops.Count) 52 end = tour.Stops[i]; 53 54 //drive there 55 double currentDistace = instance.GetDistance(start, end); 56 distance += currentDistace; 57 } 58 59 //Fleet usage 60 quality += instance.FleetUsageFactor.Value; 61 //Distance 62 quality += instance.DistanceFactor.Value * distance; 63 64 eval.Distance = distance; 65 eval.VehicleUtilization = 1; 66 67 eval.Quality = quality; 43 68 } 44 69 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPProblemInstance.cs
r4362 r4363 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.VehicleRouting.Interfaces.Variants; 34 using HeuristicLab.Problems.VehicleRouting.ProblemInstances.Evaluation; 33 using HeuristicLab.Problems.VehicleRouting.Variants; 35 34 36 35 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluation.cs
r4362 r4363 4 4 using System.Text; 5 5 6 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances .Evaluation{6 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 7 7 public class VRPEvaluation { 8 8 public double Quality { get; set; } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs
r4362 r4363 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.VehicleRouting. Interfaces.Variants;33 using HeuristicLab.Problems.VehicleRouting.Variants; 34 34 using HeuristicLab.Problems.VehicleRouting.Encodings; 35 using HeuristicLab.Problems.VehicleRouting.DomainModel;36 35 37 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances .Evaluation{36 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 37 [Item("VRPEvaluator", "Represents a VRP evaluator.")] 39 38 [StorableClass] … … 44 43 45 44 #region ISingleObjectiveEvaluator Members 46 47 45 public ILookupParameter<DoubleValue> QualityParameter { 48 46 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } 49 47 } 48 #endregion 50 49 51 50 public ILookupParameter<DoubleValue> DistanceParameter { … … 55 54 get { return (ILookupParameter<DoubleValue>)Parameters["VehiclesUtilized"]; } 56 55 } 57 58 public ILookupParameter<DoubleValue> FleetUsageFactor {59 get { return (ILookupParameter<DoubleValue>)Parameters["EvalFleetUsageFactor"]; }60 }61 public ILookupParameter<DoubleValue> DistanceFactor {62 get { return (ILookupParameter<DoubleValue>)Parameters["EvalDistanceFactor"]; }63 }64 65 #endregion66 56 67 57 [StorableConstructor] … … 70 60 public VRPEvaluator() { 71 61 Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated.")); 72 73 Parameters.Add(new LookupParameter<DoubleValue>("EvalFleetUsageFactor", "The fleet usage factor considered in the evaluation."));74 Parameters.Add(new LookupParameter<DoubleValue>("EvalDistanceFactor", "The distance factor considered in the evaluation."));75 62 76 63 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The evaluated quality of the VRP solution.")); … … 85 72 protected abstract void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour); 86 73 87 protected VRPEvaluation EvaluateTour(IVRPProblemInstance instance, Tour tour) {88 VRPEvaluation evaluation = CreateTourEvaluation();89 EvaluateTour(evaluation, instance, tour);90 return evaluation;91 }92 93 74 protected virtual void InitResultParameters() { 94 75 QualityParameter.ActualValue = new DoubleValue(0); … … 101 82 VehcilesUtilizedParameter.ActualValue.Value += tourEvaluation.VehicleUtilization; 102 83 DistanceParameter.ActualValue.Value += tourEvaluation.Distance; 84 } 85 86 protected VRPEvaluation EvaluateTour(IVRPProblemInstance instance, Tour tour) { 87 VRPEvaluation evaluation = CreateTourEvaluation(); 88 EvaluateTour(evaluation, instance, tour); 89 return evaluation; 103 90 } 104 91 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs
r4362 r4363 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.VehicleRouting.DomainModel;34 33 35 34 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
Note: See TracChangeset
for help on using the changeset viewer.