mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
replace IllegalStateException with IllegalArgumentException
This commit is contained in:
parent
0815e68bbc
commit
83cc5ef1fc
1 changed files with 42 additions and 42 deletions
|
|
@ -547,7 +547,7 @@ public class SolutionAnalyser {
|
||||||
* @return load at start location of specified route
|
* @return load at start location of specified route
|
||||||
*/
|
*/
|
||||||
public Capacity getLoadAtBeginning(VehicleRoute route){
|
public Capacity getLoadAtBeginning(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, InternalStates.LOAD_AT_BEGINNING,Capacity.class);
|
return stateManager.getRouteState(route, InternalStates.LOAD_AT_BEGINNING,Capacity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -556,7 +556,7 @@ public class SolutionAnalyser {
|
||||||
* @return load at end location of specified route
|
* @return load at end location of specified route
|
||||||
*/
|
*/
|
||||||
public Capacity getLoadAtEnd(VehicleRoute route){
|
public Capacity getLoadAtEnd(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, InternalStates.LOAD_AT_END,Capacity.class);
|
return stateManager.getRouteState(route, InternalStates.LOAD_AT_END,Capacity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -565,7 +565,7 @@ public class SolutionAnalyser {
|
||||||
* @return max load of specified route, i.e. for each capacity dimension the max value.
|
* @return max load of specified route, i.e. for each capacity dimension the max value.
|
||||||
*/
|
*/
|
||||||
public Capacity getMaxLoad(VehicleRoute route){
|
public Capacity getMaxLoad(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, InternalStates.MAXLOAD,Capacity.class);
|
return stateManager.getRouteState(route, InternalStates.MAXLOAD,Capacity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -577,8 +577,8 @@ public class SolutionAnalyser {
|
||||||
* Returns null if no load can be found.
|
* Returns null if no load can be found.
|
||||||
*/
|
*/
|
||||||
public Capacity getLoadRightAfterActivity(TourActivity activity, VehicleRoute route){
|
public Capacity getLoadRightAfterActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
if(activity instanceof Start) return getLoadAtBeginning(route);
|
if(activity instanceof Start) return getLoadAtBeginning(route);
|
||||||
if(activity instanceof End) return getLoadAtEnd(route);
|
if(activity instanceof End) return getLoadAtEnd(route);
|
||||||
verifyThatRouteContainsAct(activity, route);
|
verifyThatRouteContainsAct(activity, route);
|
||||||
|
|
@ -587,7 +587,7 @@ public class SolutionAnalyser {
|
||||||
|
|
||||||
private void verifyThatRouteContainsAct(TourActivity activity, VehicleRoute route) {
|
private void verifyThatRouteContainsAct(TourActivity activity, VehicleRoute route) {
|
||||||
if(!route.getTourActivities().hasActivity(activity)){
|
if(!route.getTourActivities().hasActivity(activity)){
|
||||||
throw new IllegalStateException("specified route does not contain specified activity " + activity);
|
throw new IllegalArgumentException("specified route does not contain specified activity " + activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -597,8 +597,8 @@ public class SolutionAnalyser {
|
||||||
* route. If act is End, it returns the load atEnd of specified route.
|
* route. If act is End, it returns the load atEnd of specified route.
|
||||||
*/
|
*/
|
||||||
public Capacity getLoadJustBeforeActivity(TourActivity activity, VehicleRoute route){
|
public Capacity getLoadJustBeforeActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
if(activity instanceof Start) return getLoadAtBeginning(route);
|
if(activity instanceof Start) return getLoadAtBeginning(route);
|
||||||
if(activity instanceof End) return getLoadAtEnd(route);
|
if(activity instanceof End) return getLoadAtEnd(route);
|
||||||
verifyThatRouteContainsAct(activity, route);
|
verifyThatRouteContainsAct(activity, route);
|
||||||
|
|
@ -615,7 +615,7 @@ public class SolutionAnalyser {
|
||||||
* @return number of pickups picked up on specified route (without load at beginning)
|
* @return number of pickups picked up on specified route (without load at beginning)
|
||||||
*/
|
*/
|
||||||
public Integer getNumberOfPickups(VehicleRoute route){
|
public Integer getNumberOfPickups(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route,stateManager.createStateId(PICKUP_COUNT),Integer.class);
|
return stateManager.getRouteState(route,stateManager.createStateId(PICKUP_COUNT),Integer.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -624,7 +624,7 @@ public class SolutionAnalyser {
|
||||||
* @return number of deliveries delivered on specified route (without load at end)
|
* @return number of deliveries delivered on specified route (without load at end)
|
||||||
*/
|
*/
|
||||||
public Integer getNumberOfDeliveries(VehicleRoute route){
|
public Integer getNumberOfDeliveries(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route,stateManager.createStateId(DELIVERY_COUNT),Integer.class);
|
return stateManager.getRouteState(route,stateManager.createStateId(DELIVERY_COUNT),Integer.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -633,7 +633,7 @@ public class SolutionAnalyser {
|
||||||
* @return picked load (without load at beginning)
|
* @return picked load (without load at beginning)
|
||||||
*/
|
*/
|
||||||
public Capacity getLoadPickedUp(VehicleRoute route){
|
public Capacity getLoadPickedUp(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route,stateManager.createStateId(LOAD_PICKED),Capacity.class);
|
return stateManager.getRouteState(route,stateManager.createStateId(LOAD_PICKED),Capacity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -642,7 +642,7 @@ public class SolutionAnalyser {
|
||||||
* @return delivered laod (without load at end)
|
* @return delivered laod (without load at end)
|
||||||
*/
|
*/
|
||||||
public Capacity getLoadDelivered(VehicleRoute route){
|
public Capacity getLoadDelivered(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route,stateManager.createStateId(LOAD_DELIVERED),Capacity.class);
|
return stateManager.getRouteState(route,stateManager.createStateId(LOAD_DELIVERED),Capacity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -651,7 +651,7 @@ public class SolutionAnalyser {
|
||||||
* @return the capacity violation on this route, i.e. maxLoad - vehicleCapacity
|
* @return the capacity violation on this route, i.e. maxLoad - vehicleCapacity
|
||||||
*/
|
*/
|
||||||
public Capacity getCapacityViolation(VehicleRoute route){
|
public Capacity getCapacityViolation(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
Capacity maxLoad = getMaxLoad(route);
|
Capacity maxLoad = getMaxLoad(route);
|
||||||
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(maxLoad,route.getVehicle().getType().getCapacityDimensions()));
|
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(maxLoad,route.getVehicle().getType().getCapacityDimensions()));
|
||||||
}
|
}
|
||||||
|
|
@ -663,7 +663,7 @@ public class SolutionAnalyser {
|
||||||
* [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
|
* [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
|
||||||
*/
|
*/
|
||||||
public Capacity getCapacityViolationAtBeginning(VehicleRoute route){
|
public Capacity getCapacityViolationAtBeginning(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
Capacity atBeginning = getLoadAtBeginning(route);
|
Capacity atBeginning = getLoadAtBeginning(route);
|
||||||
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(atBeginning,route.getVehicle().getType().getCapacityDimensions()));
|
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(atBeginning,route.getVehicle().getType().getCapacityDimensions()));
|
||||||
}
|
}
|
||||||
|
|
@ -675,7 +675,7 @@ public class SolutionAnalyser {
|
||||||
* [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
|
* [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
|
||||||
*/
|
*/
|
||||||
public Capacity getCapacityViolationAtEnd(VehicleRoute route){
|
public Capacity getCapacityViolationAtEnd(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
Capacity atEnd = getLoadAtEnd(route);
|
Capacity atEnd = getLoadAtEnd(route);
|
||||||
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(atEnd,route.getVehicle().getType().getCapacityDimensions()));
|
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(atEnd,route.getVehicle().getType().getCapacityDimensions()));
|
||||||
}
|
}
|
||||||
|
|
@ -688,8 +688,8 @@ public class SolutionAnalyser {
|
||||||
* [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
|
* [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
|
||||||
*/
|
*/
|
||||||
public Capacity getCapacityViolationAfterActivity(TourActivity activity, VehicleRoute route){
|
public Capacity getCapacityViolationAfterActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
Capacity afterAct = getLoadRightAfterActivity(activity,route);
|
Capacity afterAct = getLoadRightAfterActivity(activity,route);
|
||||||
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(afterAct,route.getVehicle().getType().getCapacityDimensions()));
|
return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(afterAct,route.getVehicle().getType().getCapacityDimensions()));
|
||||||
}
|
}
|
||||||
|
|
@ -699,7 +699,7 @@ public class SolutionAnalyser {
|
||||||
* @return time violation of route, i.e. sum of individual activity time window violations.
|
* @return time violation of route, i.e. sum of individual activity time window violations.
|
||||||
*/
|
*/
|
||||||
public Double getTimeWindowViolation(VehicleRoute route){
|
public Double getTimeWindowViolation(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, too_late_id, Double.class);
|
return stateManager.getRouteState(route, too_late_id, Double.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -709,8 +709,8 @@ public class SolutionAnalyser {
|
||||||
* @return time violation of activity
|
* @return time violation of activity
|
||||||
*/
|
*/
|
||||||
public Double getTimeWindowViolationAtActivity(TourActivity activity, VehicleRoute route){
|
public Double getTimeWindowViolationAtActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
return Math.max(0, activity.getArrTime() - activity.getTheoreticalLatestOperationStartTime());
|
return Math.max(0, activity.getArrTime() - activity.getTheoreticalLatestOperationStartTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -720,7 +720,7 @@ public class SolutionAnalyser {
|
||||||
* activities on the specified route. Returns null if route is null or skill state cannot be found.
|
* activities on the specified route. Returns null if route is null or skill state cannot be found.
|
||||||
*/
|
*/
|
||||||
public Boolean hasSkillConstraintViolation(VehicleRoute route){
|
public Boolean hasSkillConstraintViolation(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, skill_id, Boolean.class);
|
return stateManager.getRouteState(route, skill_id, Boolean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -732,8 +732,8 @@ public class SolutionAnalyser {
|
||||||
* found. If specified activity is Start or End, it returns false.
|
* found. If specified activity is Start or End, it returns false.
|
||||||
*/
|
*/
|
||||||
public Boolean hasSkillConstraintViolationAtActivity(TourActivity activity, VehicleRoute route){
|
public Boolean hasSkillConstraintViolationAtActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
if(activity instanceof Start) return false;
|
if(activity instanceof Start) return false;
|
||||||
if(activity instanceof End) return false;
|
if(activity instanceof End) return false;
|
||||||
verifyThatRouteContainsAct(activity, route);
|
verifyThatRouteContainsAct(activity, route);
|
||||||
|
|
@ -751,7 +751,7 @@ public class SolutionAnalyser {
|
||||||
* state can be found. In latter case try routeChanged(route).
|
* state can be found. In latter case try routeChanged(route).
|
||||||
*/
|
*/
|
||||||
public Boolean hasBackhaulConstraintViolation(VehicleRoute route){
|
public Boolean hasBackhaulConstraintViolation(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route,backhaul_id,Boolean.class);
|
return stateManager.getRouteState(route,backhaul_id,Boolean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -762,8 +762,8 @@ public class SolutionAnalyser {
|
||||||
* Null if specified route does not contain specified activity.
|
* Null if specified route does not contain specified activity.
|
||||||
*/
|
*/
|
||||||
public Boolean hasBackhaulConstraintViolationAtActivity(TourActivity activity, VehicleRoute route){
|
public Boolean hasBackhaulConstraintViolationAtActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
if(activity instanceof Start) return false;
|
if(activity instanceof Start) return false;
|
||||||
if(activity instanceof End) return false;
|
if(activity instanceof End) return false;
|
||||||
verifyThatRouteContainsAct(activity, route);
|
verifyThatRouteContainsAct(activity, route);
|
||||||
|
|
@ -779,7 +779,7 @@ public class SolutionAnalyser {
|
||||||
* @return true if violated, false otherwise. Null if no state can be found or specified route is null.
|
* @return true if violated, false otherwise. Null if no state can be found or specified route is null.
|
||||||
*/
|
*/
|
||||||
public Boolean hasShipmentConstraintViolation(VehicleRoute route){
|
public Boolean hasShipmentConstraintViolation(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route,shipment_id,Boolean.class);
|
return stateManager.getRouteState(route,shipment_id,Boolean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -793,8 +793,8 @@ public class SolutionAnalyser {
|
||||||
* false. Returns null if either specified activity or route is null or route does not containt activity.
|
* false. Returns null if either specified activity or route is null or route does not containt activity.
|
||||||
*/
|
*/
|
||||||
public Boolean hasShipmentConstraintViolationAtActivity(TourActivity activity, VehicleRoute route){
|
public Boolean hasShipmentConstraintViolationAtActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
if(activity instanceof Start) return false;
|
if(activity instanceof Start) return false;
|
||||||
if(activity instanceof End) return false;
|
if(activity instanceof End) return false;
|
||||||
verifyThatRouteContainsAct(activity, route);
|
verifyThatRouteContainsAct(activity, route);
|
||||||
|
|
@ -808,7 +808,7 @@ public class SolutionAnalyser {
|
||||||
* @return operation time of this route, i.e. endTime - startTime of specified route
|
* @return operation time of this route, i.e. endTime - startTime of specified route
|
||||||
*/
|
*/
|
||||||
public Double getOperationTime(VehicleRoute route){
|
public Double getOperationTime(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return route.getEnd().getArrTime() - route.getStart().getEndTime();
|
return route.getEnd().getArrTime() - route.getStart().getEndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -818,7 +818,7 @@ public class SolutionAnalyser {
|
||||||
* Returns null if no waiting time value exists for the specified route
|
* Returns null if no waiting time value exists for the specified route
|
||||||
*/
|
*/
|
||||||
public Double getWaitingTime(VehicleRoute route){
|
public Double getWaitingTime(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, waiting_time_id, Double.class);
|
return stateManager.getRouteState(route, waiting_time_id, Double.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -827,7 +827,7 @@ public class SolutionAnalyser {
|
||||||
* @return total transport time of specified route. Returns null if no time value exists for the specified route.
|
* @return total transport time of specified route. Returns null if no time value exists for the specified route.
|
||||||
*/
|
*/
|
||||||
public Double getTransportTime(VehicleRoute route){
|
public Double getTransportTime(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, transport_time_id, Double.class);
|
return stateManager.getRouteState(route, transport_time_id, Double.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -836,7 +836,7 @@ public class SolutionAnalyser {
|
||||||
* @return total service time of specified route. Returns null if no time value exists for specified route.
|
* @return total service time of specified route. Returns null if no time value exists for specified route.
|
||||||
*/
|
*/
|
||||||
public Double getServiceTime(VehicleRoute route){
|
public Double getServiceTime(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, service_time_id, Double.class);
|
return stateManager.getRouteState(route, service_time_id, Double.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -846,7 +846,7 @@ public class SolutionAnalyser {
|
||||||
* vrp.getTransportCosts().getTransportCost(fromId,toId,...)
|
* vrp.getTransportCosts().getTransportCost(fromId,toId,...)
|
||||||
*/
|
*/
|
||||||
public Double getVariableTransportCosts(VehicleRoute route){
|
public Double getVariableTransportCosts(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
|
|
||||||
return stateManager.getRouteState(route,InternalStates.COSTS,Double.class);
|
return stateManager.getRouteState(route,InternalStates.COSTS,Double.class);
|
||||||
}
|
}
|
||||||
|
|
@ -856,7 +856,7 @@ public class SolutionAnalyser {
|
||||||
* @return fixed costs of route, i.e. fixed costs of employed vehicle on this route.
|
* @return fixed costs of route, i.e. fixed costs of employed vehicle on this route.
|
||||||
*/
|
*/
|
||||||
public Double getFixedCosts(VehicleRoute route){
|
public Double getFixedCosts(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return route.getVehicle().getType().getVehicleCostParams().fix;
|
return route.getVehicle().getType().getVehicleCostParams().fix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -868,8 +868,8 @@ public class SolutionAnalyser {
|
||||||
* If activity is start, it returns 0.. If it is end, it returns .getVariableTransportCosts(route).
|
* If activity is start, it returns 0.. If it is end, it returns .getVariableTransportCosts(route).
|
||||||
*/
|
*/
|
||||||
public Double getVariableTransportCostsAtActivity(TourActivity activity, VehicleRoute route){
|
public Double getVariableTransportCostsAtActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
if(activity instanceof Start) return 0.;
|
if(activity instanceof Start) return 0.;
|
||||||
if(activity instanceof End) return getVariableTransportCosts(route);
|
if(activity instanceof End) return getVariableTransportCosts(route);
|
||||||
verifyThatRouteContainsAct(activity, route);
|
verifyThatRouteContainsAct(activity, route);
|
||||||
|
|
@ -882,8 +882,8 @@ public class SolutionAnalyser {
|
||||||
* @return waiting time at activity
|
* @return waiting time at activity
|
||||||
*/
|
*/
|
||||||
public Double getWaitingTimeAtActivity(TourActivity activity, VehicleRoute route){
|
public Double getWaitingTimeAtActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
double waitingTime = 0.;
|
double waitingTime = 0.;
|
||||||
if(activityPolicy.equals(ActivityTimeTracker.ActivityPolicy.AS_SOON_AS_TIME_WINDOW_OPENS)){
|
if(activityPolicy.equals(ActivityTimeTracker.ActivityPolicy.AS_SOON_AS_TIME_WINDOW_OPENS)){
|
||||||
waitingTime = Math.max(0,activity.getTheoreticalEarliestOperationStartTime()-activity.getArrTime());
|
waitingTime = Math.max(0,activity.getTheoreticalEarliestOperationStartTime()-activity.getArrTime());
|
||||||
|
|
@ -896,7 +896,7 @@ public class SolutionAnalyser {
|
||||||
* @return total distance of route
|
* @return total distance of route
|
||||||
*/
|
*/
|
||||||
public Double getDistance(VehicleRoute route){
|
public Double getDistance(VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
return stateManager.getRouteState(route, distance_id, Double.class);
|
return stateManager.getRouteState(route, distance_id, Double.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -905,8 +905,8 @@ public class SolutionAnalyser {
|
||||||
* @return distance at activity
|
* @return distance at activity
|
||||||
*/
|
*/
|
||||||
public Double getDistanceAtActivity(TourActivity activity, VehicleRoute route){
|
public Double getDistanceAtActivity(TourActivity activity, VehicleRoute route){
|
||||||
if(route == null) throw new IllegalStateException("route is missing.");
|
if(route == null) throw new IllegalArgumentException("route is missing.");
|
||||||
if(activity == null) throw new IllegalStateException("activity is missing.");
|
if(activity == null) throw new IllegalArgumentException("activity is missing.");
|
||||||
if(activity instanceof Start) return 0.;
|
if(activity instanceof Start) return 0.;
|
||||||
if(activity instanceof End) return getDistance(route);
|
if(activity instanceof End) return getDistance(route);
|
||||||
verifyThatRouteContainsAct(activity, route);
|
verifyThatRouteContainsAct(activity, route);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue