From 20d69a84c0c9e92f64d8fe1c3d676607e5b0e8c3 Mon Sep 17 00:00:00 2001 From: oblonski <4sschroeder@gmail.com> Date: Thu, 15 May 2014 13:56:48 +0200 Subject: [PATCH] bugfix #96 - modified core.problem.vehicle.VehicleFleetManagerImpl according to changes in core.problem.vehicle.VehicleTypeKey --- .../problem/vehicle/VehicleFleetManagerImpl.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java index 8e1d303e..ec29d991 100644 --- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java +++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java @@ -29,10 +29,6 @@ import jsprit.core.problem.vehicle.VehicleImpl.NoVehicle; import org.apache.log4j.Logger; - - - - class VehicleFleetManagerImpl implements VehicleFleetManager { public VehicleFleetManagerImpl newInstance(Collection vehicles){ @@ -132,11 +128,11 @@ class VehicleFleetManagerImpl implements VehicleFleetManager { } String typeId = v.getType().getTypeId(); if(v.getType() instanceof PenaltyVehicleType){ - VehicleTypeKey typeKey = new VehicleTypeKey(typeId, v.getStartLocationId(), v.getEndLocationId()); + VehicleTypeKey typeKey = new VehicleTypeKey(typeId, v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival()); penaltyVehicles.put(typeKey, v); } else{ - VehicleTypeKey typeKey = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId()); + VehicleTypeKey typeKey = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival()); if(!typeMapOfAvailableVehicles.containsKey(typeKey)){ typeMapOfAvailableVehicles.put(typeKey, new TypeContainer(typeKey)); } @@ -147,7 +143,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager { private void removeVehicle(Vehicle v){ //it might be better to introduce a class PenaltyVehicle if(!(v.getType() instanceof PenaltyVehicleType)){ - VehicleTypeKey key = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId()); + VehicleTypeKey key = new VehicleTypeKey(v.getType().getTypeId(), v.getStartLocationId(), v.getEndLocationId(), v.getEarliestDeparture(), v.getLatestArrival()); if(typeMapOfAvailableVehicles.containsKey(key)){ typeMapOfAvailableVehicles.get(key).remove(v); } @@ -192,7 +188,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager { @Deprecated public Collection getAvailableVehicles(String withoutThisType, String withThisLocationId) { List vehicles = new ArrayList(); - VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType, withThisLocationId, withThisLocationId); + VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType, withThisLocationId, withThisLocationId, 0., 0.); for(VehicleTypeKey key : typeMapOfAvailableVehicles.keySet()){ if(key.equals(thisKey)) continue; if(!typeMapOfAvailableVehicles.get(key).isEmpty()){ @@ -212,7 +208,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager { @Override public Collection getAvailableVehicles(Vehicle withoutThisType) { List vehicles = new ArrayList(); - VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType.getType().getTypeId(), withoutThisType.getStartLocationId(), withoutThisType.getEndLocationId()); + VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType.getType().getTypeId(), withoutThisType.getStartLocationId(), withoutThisType.getEndLocationId(), withoutThisType.getEarliestDeparture(), withoutThisType.getLatestArrival()); for(VehicleTypeKey key : typeMapOfAvailableVehicles.keySet()){ if(key.equals(thisKey)) continue; if(!typeMapOfAvailableVehicles.get(key).isEmpty()){