Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Optimizers/LocalUpdate/LinearPriorityDispatching.cs @ 8808

Last change on this file since 8808 was 8808, checked in by svonolfe, 12 years ago

Added symbolic tree dispatching and metaoptimization (#1955)

File size: 2.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Diagnostics;
4using System.Linq;
5using HeuristicLab.Common;
6using HeuristicLab.Core;
7using HeuristicLab.Encodings.RealVectorEncoding;
8using HeuristicLab.Parameters;
9using HeuristicLab.PDPSimulation.DomainModel;
10using HeuristicLab.PDPSimulation.Operators;
11using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
12
13namespace 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}
Note: See TracBrowser for help on using the repository browser.