1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

issue #144 - replace deprecated methods

This commit is contained in:
oblonski 2014-12-18 16:21:18 +01:00
parent c083b74ea7
commit 600087fd33
48 changed files with 398 additions and 379 deletions

View file

@ -89,7 +89,7 @@ public class AdditionalDistanceConstraintExample {
}
double getDistance(TourActivity from, TourActivity to){
return costMatrix.getDistance(from.getLocationId(), to.getLocationId());
return costMatrix.getDistance(from.getLocation().getId(), to.getLocation().getId());
}
}
@ -125,7 +125,7 @@ public class AdditionalDistanceConstraintExample {
}
double getDistance(TourActivity from, TourActivity to){
return costsMatrix.getDistance(from.getLocationId(), to.getLocationId());
return costsMatrix.getDistance(from.getLocation().getId(), to.getLocation().getId());
}
}

View file

@ -136,12 +136,12 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstrain
public boolean fulfilled(JobInsertionContext insertionContext) {
Shipment shipment2insert = ((Shipment)insertionContext.getJob());
if(insertionContext.getNewVehicle().getId().equals("v1")){
if(shipment2insert.getPickupCoord().getX() > 15. || shipment2insert.getDeliveryCoord().getX() > 15.){
if(shipment2insert.getPickupLocation().getCoordinate().getX() > 15. || shipment2insert.getDeliveryLocation().getCoordinate().getX() > 15.){
return false;
}
}
if(insertionContext.getNewVehicle().getId().equals("v2")){
if(shipment2insert.getPickupCoord().getX() < 15. || shipment2insert.getDeliveryCoord().getX() < 15.){
if(shipment2insert.getPickupLocation().getCoordinate().getX() < 15. || shipment2insert.getDeliveryLocation().getCoordinate().getX() < 15.){
return false;
}
}

View file

@ -63,15 +63,15 @@ public class SolomonWithSkillsExample {
for(Job job : vrp.getJobs().values()){
Service service = (Service) job;
Service.Builder skillServiceBuilder;
if(service.getCoord().getY()<50.){
if(service.getLocation().getCoordinate().getY()<50.){
skillServiceBuilder = Service.Builder.newInstance(service.getId()+"_skill2").setServiceTime(service.getServiceDuration())
.setCoord(service.getCoord()).setLocationId(service.getLocationId()).setTimeWindow(service.getTimeWindow())
.setCoord(service.getLocation().getCoordinate()).setLocationId(service.getLocation().getId()).setTimeWindow(service.getTimeWindow())
.addSizeDimension(0,service.getSize().get(0));
skillServiceBuilder.addRequiredSkill("skill2");
}
else {
skillServiceBuilder = Service.Builder.newInstance(service.getId()+"_skill1").setServiceTime(service.getServiceDuration())
.setCoord(service.getCoord()).setLocationId(service.getLocationId()).setTimeWindow(service.getTimeWindow())
.setCoord(service.getLocation().getCoordinate()).setLocationId(service.getLocation().getId()).setTimeWindow(service.getTimeWindow())
.addSizeDimension(0,service.getSize().get(0));
skillServiceBuilder.addRequiredSkill("skill1");
}

View file

@ -150,7 +150,7 @@ public class TransportOfDisabledPeople {
Shipment shipment2insert = ((Shipment)insertionContext.getJob());
if(insertionContext.getNewVehicle().getId().equals("wheelchair_bus")){
if(shipment2insert.getSize().get(PASSENGERSEATS_INDEX)>0){
if(shipment2insert.getPickupCoord().getX() > 15. || shipment2insert.getDeliveryCoord().getX() > 15.){
if(shipment2insert.getPickupLocation().getCoordinate().getX() > 15. || shipment2insert.getDeliveryLocation().getCoordinate().getX() > 15.){
return false;
}
}

View file

@ -139,22 +139,22 @@ public class VRPWithBackhaulsExample2 {
System.out.println("timeWindowViolationOnRoute: " + analyser.getTimeWindowViolation(route));
System.out.println("skillConstraintViolatedOnRoute: " + analyser.hasSkillConstraintViolation(route));
System.out.println("dist@" + route.getStart().getLocationId() + ": " + analyser.getDistanceAtActivity(route.getStart(),route));
System.out.println("timeWindowViolation@" + route.getStart().getLocationId() + ": " + analyser.getTimeWindowViolationAtActivity(route.getStart(), route));
System.out.println("dist@" + route.getStart().getLocation().getId() + ": " + analyser.getDistanceAtActivity(route.getStart(),route));
System.out.println("timeWindowViolation@" + route.getStart().getLocation().getId() + ": " + analyser.getTimeWindowViolationAtActivity(route.getStart(), route));
for(TourActivity act : route.getActivities()){
System.out.println("--");
System.out.println("actType: " + act.getName() + " demand: " + act.getSize());
System.out.println("dist@" + act.getLocationId() + ": " + analyser.getDistanceAtActivity(act,route));
System.out.println("load(before)@" + act.getLocationId() + ": " + analyser.getLoadJustBeforeActivity(act,route));
System.out.println("load(after)@" + act.getLocationId() + ": " + analyser.getLoadRightAfterActivity(act, route));
System.out.println("transportCosts@" + act.getLocationId() + ": " + analyser.getVariableTransportCostsAtActivity(act,route));
System.out.println("capViolation(after)@" + act.getLocationId() + ": " + analyser.getCapacityViolationAfterActivity(act,route));
System.out.println("timeWindowViolation@" + act.getLocationId() + ": " + analyser.getTimeWindowViolationAtActivity(act,route));
System.out.println("skillConstraintViolated@" + act.getLocationId() + ": " + analyser.hasSkillConstraintViolationAtActivity(act, route));
System.out.println("dist@" + act.getLocation().getId() + ": " + analyser.getDistanceAtActivity(act,route));
System.out.println("load(before)@" + act.getLocation().getId() + ": " + analyser.getLoadJustBeforeActivity(act,route));
System.out.println("load(after)@" + act.getLocation().getId() + ": " + analyser.getLoadRightAfterActivity(act, route));
System.out.println("transportCosts@" + act.getLocation().getId() + ": " + analyser.getVariableTransportCostsAtActivity(act,route));
System.out.println("capViolation(after)@" + act.getLocation().getId() + ": " + analyser.getCapacityViolationAfterActivity(act,route));
System.out.println("timeWindowViolation@" + act.getLocation().getId() + ": " + analyser.getTimeWindowViolationAtActivity(act,route));
System.out.println("skillConstraintViolated@" + act.getLocation().getId() + ": " + analyser.hasSkillConstraintViolationAtActivity(act, route));
}
System.out.println("--");
System.out.println("dist@" + route.getEnd().getLocationId() + ": " + analyser.getDistanceAtActivity(route.getEnd(),route));
System.out.println("timeWindowViolation@" + route.getEnd().getLocationId() + ": " + analyser.getTimeWindowViolationAtActivity(route.getEnd(),route));
System.out.println("dist@" + route.getEnd().getLocation().getId() + ": " + analyser.getDistanceAtActivity(route.getEnd(),route));
System.out.println("timeWindowViolation@" + route.getEnd().getLocation().getId() + ": " + analyser.getTimeWindowViolationAtActivity(route.getEnd(),route));
}
System.out.println("-----");