[8808] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Diagnostics;
|
---|
| 4 | using System.Linq;
|
---|
| 5 | using HeuristicLab.Common;
|
---|
| 6 | using HeuristicLab.Core;
|
---|
| 7 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
| 8 | using HeuristicLab.Parameters;
|
---|
| 9 | using HeuristicLab.PDPSimulation.DomainModel;
|
---|
| 10 | using HeuristicLab.PDPSimulation.Operators;
|
---|
| 11 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 12 |
|
---|
| 13 | namespace HeuristicLab.PDPSimulation {
|
---|
| 14 | [Item("LinearPriorityDispatching", "")]
|
---|
| 15 | [StorableClass]
|
---|
| 16 | public class LinearPriorityDispatching : PriorityDispatching {
|
---|
| 17 |
|
---|
| 18 | public IValueLookupParameter<RealVector> WeightsParameter {
|
---|
| 19 | get { return (IValueLookupParameter<RealVector>)Parameters["Weights"]; }
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | [StorableConstructor]
|
---|
| 23 | protected LinearPriorityDispatching(bool deserializing) : base(deserializing) { }
|
---|
| 24 | protected LinearPriorityDispatching(PriorityDispatching original, Cloner cloner) : base(original, cloner) { }
|
---|
| 25 | public LinearPriorityDispatching() {
|
---|
| 26 | Parameters.Add(new ValueLookupParameter<RealVector>("Weights", "The weights for the individual priorities."));
|
---|
| 27 | WeightsParameter.Value = new RealVector(new double[] {
|
---|
| 28 | 100.000, 100.000, 22.349, 74.573, 18.424, 28.913, 0.331, 91.323, 36.969, 44.992, 64.892, 30.736, 23.113, 36.458, 6.178, 99.065, 100.0, 100.0
|
---|
| 29 | });
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 33 | return new LinearPriorityDispatching(this, cloner);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | protected override double CalculatePriority(IDictionary<string, double> variables) {
|
---|
| 37 | var weights = WeightsParameter.Value;
|
---|
| 38 |
|
---|
| 39 | double prio = weights[0] * variables["DueDate"]
|
---|
| 40 | + weights[1] * variables["StartDate"]
|
---|
| 41 | + weights[2] * variables["PickupOrdersAtTarget"]
|
---|
| 42 | + weights[3] * variables["Distance"]
|
---|
| 43 | + weights[4] * variables["AverageDistanceToDestinations"]
|
---|
| 44 | + weights[5] * variables["MinimumDistanceToDestinations"]
|
---|
| 45 | + weights[6] * variables["MaximumDistanceToDestinations"]
|
---|
| 46 | + weights[7] * variables["NumberOfOtherCouriersToTarget"]
|
---|
| 47 | + weights[8] * variables["AverageDistanceToOtherCouriers"]
|
---|
| 48 | + weights[9] * variables["EarliestTimeOfArrival"]
|
---|
| 49 | + weights[10] * variables["DeliveryOrdersAtTarget"]
|
---|
| 50 | + weights[11] * variables["PickupOrderItemsAtTarget"]
|
---|
| 51 | + weights[12] * variables["DeliveryOrderItemsAtTarget"]
|
---|
| 52 | + weights[13] * variables["MinimumDistanceToOtherCouriers"]
|
---|
| 53 | + weights[14] * variables["MaximumDistanceToOtherCouriers"]
|
---|
| 54 | + weights[15] * variables["DemandSize"]
|
---|
| 55 | + weights[16] * variables["EDD"]
|
---|
| 56 | + weights[17] * variables["LeadTime"];
|
---|
| 57 |
|
---|
| 58 | return prio;
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 | }
|
---|