Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1955_DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Optimizers/LocalUpdate/EarliestDueTimeDispatching.cs @ 17578

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

Added earliest due time and nearest destination dispatching (#1955)

File size: 1.5 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("EarliestDueTimeDispatching", "")]
15  [StorableClass]
16  public class EarliestDueTimeDispatching : Dispatching {
17    [StorableConstructor]
18    protected EarliestDueTimeDispatching(bool deserializing) : base(deserializing) { }
19    protected EarliestDueTimeDispatching(EarliestDueTimeDispatching original, Cloner cloner) : base(original, cloner) { }
20    public EarliestDueTimeDispatching() {
21    }
22
23    public override IDeepCloneable Clone(Cloner cloner) {
24      return new EarliestDueTimeDispatching(this, cloner);
25    }
26
27    protected override void GetHighestPriorityOrder(DynPDPProblemInstance instance, Vehicle vehicle, IEnumerable<Order> orders, out Order order, out double priority) {
28      order = orders.OrderBy(o => IsPickup(o, instance) ? o.PickupDueTime : o.DeliveryDueTime).First();
29      priority = - scenario.DistanceMeasure.GetDistance(vehicle.TargetPositionX, vehicle.TargetPositionY,
30        IsPickup(order, instance) ? order.PickupXCoord : order.DeliveryXCoord, IsPickup(order, instance) ? order.PickupYCoord : order.DeliveryYCoord);
31    }
32  }
33}
Note: See TracBrowser for help on using the repository browser.