using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Encodings.RealVectorEncoding; using HeuristicLab.Parameters; using HeuristicLab.PDPSimulation.DomainModel; using HeuristicLab.PDPSimulation.Operators; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.PDPSimulation { [Item("EarliestDueTimeDispatching", "")] [StorableClass] public class EarliestDueTimeDispatching : Dispatching { [StorableConstructor] protected EarliestDueTimeDispatching(bool deserializing) : base(deserializing) { } protected EarliestDueTimeDispatching(EarliestDueTimeDispatching original, Cloner cloner) : base(original, cloner) { } public EarliestDueTimeDispatching() { } public override IDeepCloneable Clone(Cloner cloner) { return new EarliestDueTimeDispatching(this, cloner); } protected override void GetHighestPriorityOrder(DynPDPProblemInstance instance, Vehicle vehicle, IEnumerable orders, out Order order, out double priority) { order = orders.OrderBy(o => IsPickup(o, instance) ? o.PickupDueTime : o.DeliveryDueTime).First(); priority = - scenario.DistanceMeasure.GetDistance(vehicle.TargetPositionX, vehicle.TargetPositionY, IsPickup(order, instance) ? order.PickupXCoord : order.DeliveryXCoord, IsPickup(order, instance) ? order.PickupYCoord : order.DeliveryYCoord); } } }