[8813] | 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("NearestDestinationDispatching", "")]
|
---|
| 15 | [StorableClass]
|
---|
| 16 | public class NearestDestinationDispatching : Dispatching {
|
---|
| 17 | [StorableConstructor]
|
---|
| 18 | protected NearestDestinationDispatching(bool deserializing) : base(deserializing) { }
|
---|
| 19 | protected NearestDestinationDispatching(NearestDestinationDispatching original, Cloner cloner) : base(original, cloner) { }
|
---|
| 20 | public NearestDestinationDispatching() {
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 24 | return new NearestDestinationDispatching(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 => scenario.DistanceMeasure.GetDistance(vehicle.TargetPositionX, vehicle.TargetPositionY,
|
---|
| 29 | IsPickup(o, instance) ? o.PickupXCoord : o.DeliveryXCoord,
|
---|
| 30 | IsPickup(o, instance) ? o.PickupYCoord : o.DeliveryYCoord)).First();
|
---|
| 31 |
|
---|
| 32 | priority = - scenario.DistanceMeasure.GetDistance(vehicle.TargetPositionX, vehicle.TargetPositionY,
|
---|
| 33 | IsPickup(order, instance) ? order.PickupXCoord : order.DeliveryXCoord,
|
---|
| 34 | IsPickup(order, instance) ? order.PickupYCoord : order.DeliveryYCoord);
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 | }
|
---|