Class SolutionAnalyser
java.lang.Object
com.graphhopper.jsprit.core.analysis.SolutionAnalyser
Calculates a set of statistics for a solution.
-
Constructor Summary
ConstructorsConstructorDescriptionSolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, TransportDistance distanceCalculator) SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, SolutionCostCalculator solutionCostCalculator, TransportDistance distanceCalculator) -
Method Summary
Modifier and TypeMethodDescriptiongetCapacityViolation(VehicleRoute route) getCapacityViolationAfterActivity(TourActivity activity, VehicleRoute route) getDistance(VehicleRoute route) getDistanceAtActivity(TourActivity activity, VehicleRoute route) getFixedCosts(VehicleRoute route) getLastTransportCostAtActivity(TourActivity activity, VehicleRoute route) getLastTransportDistanceAtActivity(TourActivity activity, VehicleRoute route) getLastTransportTimeAtActivity(TourActivity activity, VehicleRoute route) getLoadAtBeginning(VehicleRoute route) getLoadAtEnd(VehicleRoute route) getLoadDelivered(VehicleRoute route) getLoadJustBeforeActivity(TourActivity activity, VehicleRoute route) getLoadPickedUp(VehicleRoute route) getLoadRightAfterActivity(TourActivity activity, VehicleRoute route) getMaxLoad(VehicleRoute route) getNumberOfPickups(VehicleRoute route) getOperationTime(VehicleRoute route) getServiceTime(VehicleRoute route) getTimeWindowViolationAtActivity(TourActivity activity, VehicleRoute route) getTransportTime(VehicleRoute route) getTransportTimeAtActivity(TourActivity activity, VehicleRoute route) getVariableTransportCostsAtActivity(TourActivity activity, VehicleRoute route) getWaitingTime(VehicleRoute route) getWaitingTimeAtActivity(TourActivity activity, VehicleRoute route) Returns true if backhaul constraint is violated (false otherwise).hasBackhaulConstraintViolationAtActivity(TourActivity activity, VehicleRoute route) Returns true, if shipment constraint is violated.hasShipmentConstraintViolationAtActivity(TourActivity activity, VehicleRoute route) Returns true if shipment constraint is violated, i.e.hasSkillConstraintViolationAtActivity(TourActivity activity, VehicleRoute route)
-
Constructor Details
-
SolutionAnalyser
public SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, TransportDistance distanceCalculator) -
SolutionAnalyser
public SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, SolutionCostCalculator solutionCostCalculator, TransportDistance distanceCalculator)
-
-
Method Details
-
getLoadAtBeginning
- Parameters:
route- to get the load at beginning from- Returns:
- load at start location of specified route
-
getLoadAtEnd
- Parameters:
route- to get the load at the end from- Returns:
- load at end location of specified route
-
getMaxLoad
- Parameters:
route- to get max load from- Returns:
- max load of specified route, i.e. for each capacity dimension the max value.
-
getLoadRightAfterActivity
- Parameters:
activity- to get the load from (after activity)- Returns:
- load right after the specified activity. If act is Start, it returns the load atBeginning of the specified route. If act is End, it returns the load atEnd of specified route. Returns null if no load can be found.
-
getLoadJustBeforeActivity
- Parameters:
activity- to get the load from (before activity)- Returns:
- load just before the specified activity. If act is Start, it returns the load atBeginning of the specified route. If act is End, it returns the load atEnd of specified route.
-
getNumberOfPickups
- Parameters:
route- to get number of pickups from- Returns:
- number of pickups picked up on specified route (without load at beginning)
-
getNumberOfDeliveries
- Parameters:
route- to get number of deliveries from- Returns:
- number of deliveries delivered on specified route (without load at end)
-
getLoadPickedUp
- Parameters:
route- to get the picked load from- Returns:
- picked load (without load at beginning)
-
getLoadDelivered
- Parameters:
route- to get delivered load from- Returns:
- delivered laod (without load at end)
-
getCapacityViolation
- Parameters:
route- to get the capacity violation from- Returns:
- the capacity violation on this route, i.e. maxLoad - vehicleCapacity
-
getCapacityViolationAtBeginning
- Parameters:
route- to get the capacity violation from (at beginning of the route)- Returns:
- violation, i.e. all dimensions and their corresponding violation. For example, if vehicle has two capacity dimension with dimIndex=0 and dimIndex=1 and dimIndex=1 is violated by 4 units then this method returns [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
-
getCapacityViolationAtEnd
- Parameters:
route- to get the capacity violation from (at end of the route)- Returns:
- violation, i.e. all dimensions and their corresponding violation. For example, if vehicle has two capacity dimension with dimIndex=0 and dimIndex=1 and dimIndex=1 is violated by 4 units then this method returns [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
-
getCapacityViolationAfterActivity
- Parameters:
route- to get the capacity violation from (at activity of the route)- Returns:
- violation, i.e. all dimensions and their corresponding violation. For example, if vehicle has two capacity dimension with dimIndex=0 and dimIndex=1 and dimIndex=1 is violated by 4 units then this method returns [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
-
getTimeWindowViolation
- Parameters:
route- to get the time window violation from- Returns:
- time violation of route, i.e. sum of individual activity time window violations.
-
getTimeWindowViolationAtActivity
- Parameters:
activity- to get the time window violation fromroute- where activity needs to be part of- Returns:
- time violation of activity
-
hasSkillConstraintViolation
- Parameters:
route- to check skill constraint- Returns:
- true if skill constraint is violated, i.e. if vehicle does not have the required skills to conduct all activities on the specified route. Returns null if route is null or skill state cannot be found.
-
hasSkillConstraintViolationAtActivity
- Parameters:
activity- to check skill constraintroute- that must contain specified activity- Returns:
- true if vehicle does not have the skills to conduct specified activity, false otherwise. Returns null if specified route or activity is null or if route does not contain specified activity or if skill state connot be found. If specified activity is Start or End, it returns false.
-
hasBackhaulConstraintViolation
Returns true if backhaul constraint is violated (false otherwise). Backhaul constraint is violated if either a pickupService, serviceActivity (which is basically modeled as pickupService) or a pickupShipment occur before a deliverService activity or - to put it in other words - if a depot bounded delivery occurs after a pickup, thus the backhaul ensures depot bounded delivery activities first.- Parameters:
route- to check backhaul constraint- Returns:
- true if backhaul constraint for specified route is violated. returns null if route is null or no backhaul state can be found. In latter case try routeChanged(route).
-
hasBackhaulConstraintViolationAtActivity
- Parameters:
activity- to check backhaul violationroute- that must contain the specified activity- Returns:
- true if backhaul constraint is violated, false otherwise. Null if either specified route or activity is null. Null if specified route does not contain specified activity.
-
hasShipmentConstraintViolation
Returns true, if shipment constraint is violated. Two activities are associated to a shipment: pickupShipment and deliverShipment. If both shipments are not in the same route OR deliverShipment occurs before pickupShipment then the shipment constraint is violated.- Parameters:
route- to check the shipment constraint.- Returns:
- true if violated, false otherwise. Null if no state can be found or specified route is null.
-
hasShipmentConstraintViolationAtActivity
Returns true if shipment constraint is violated, i.e. if activity is deliverShipment but no pickupShipment can be found before OR activity is pickupShipment and no deliverShipment can be found afterwards.- Parameters:
activity- to check the shipment constraintroute- that must contain specified activity- Returns:
- true if shipment constraint is violated, false otherwise. If activity is either Start or End, it returns false. Returns null if either specified activity or route is null or route does not containt activity.
-
getOperationTime
- Parameters:
route- to get the total operation time from- Returns:
- operation time of this route, i.e. endTime - startTime of specified route
-
getWaitingTime
- Parameters:
route- to get the total waiting time from- Returns:
- total waiting time of this route, i.e. sum of waiting times at activities. Returns null if no waiting time value exists for the specified route
-
getTransportTime
- Parameters:
route- to get the total transport time from- Returns:
- total transport time of specified route. Returns null if no time value exists for the specified route.
-
getServiceTime
- Parameters:
route- to get the total service time from- Returns:
- total service time of specified route. Returns null if no time value exists for specified route.
-
getVariableTransportCosts
- Parameters:
route- to get the transport costs from- Returns:
- total variable transport costs of route, i.e. sum of transport costs specified by vrp.getTransportCosts().getTransportCost(fromId,toId,...)
-
getFixedCosts
- Parameters:
route- to get the fixed costs from- Returns:
- fixed costs of route, i.e. fixed costs of employed vehicle on this route.
-
getVariableTransportCostsAtActivity
- Parameters:
activity- to get the variable transport costs fromroute- where the activity should be part of- Returns:
- variable transport costs at activity, i.e. sum of transport costs from start of route to the specified activity If activity is start, it returns 0.. If it is end, it returns .getVariableTransportCosts(route).
-
getTransportTimeAtActivity
- Parameters:
activity- to get the transport time fromroute- where the activity should be part of- Returns:
- transport time at the activity, i.e. the total time spent driving since the start of the route to the specified activity.
-
getLastTransportTimeAtActivity
- Parameters:
activity- to get the last transport time fromroute- where the activity should be part of- Returns:
- The transport time from the previous activity to this one.
-
getLastTransportDistanceAtActivity
- Parameters:
activity- to get the last transport distance fromroute- where the activity should be part of- Returns:
- The transport distance from the previous activity to this one.
-
getLastTransportCostAtActivity
- Parameters:
activity- to get the last transport cost fromroute- where the activity should be part of- Returns:
- The transport cost from the previous activity to this one.
-
getWaitingTimeAtActivity
- Parameters:
activity- to get the waiting fromroute- where activity should be part of- Returns:
- waiting time at activity
-
getDistance
- Parameters:
route- to get the distance from- Returns:
- total distance of route
-
getDistanceAtActivity
- Parameters:
activity- at which is distance of the current route is measured- Returns:
- distance at activity
-
getNumberOfPickups
- Returns:
- number of pickups in specified solution (without load at beginning of each route)
-
getNumberOfPickupsAtBeginning
- Parameters:
route- to get the number of pickups at beginning from- Returns:
- number of pickups at beginning
-
getNumberOfPickupsAtBeginning
- Returns:
- number of pickups in specified solution at beginning of each route
-
getNumberOfDeliveries
- Returns:
- number of deliveries in specified solution (without load at end of each route)
-
getNumberOfDeliveriesAtEnd
- Returns:
- number of deliveries in specified solution at end of each route
-
getNumberOfDeliveriesAtEnd
- Parameters:
route- to get the number of deliveries at end from- Returns:
- number of deliveries at end of specified route
-
getLoadPickedUp
- Returns:
- load picked up in solution (without load at beginning of each route)
-
getLoadAtBeginning
- Returns:
- load picked up in solution at beginning of each route
-
getLoadDelivered
- Returns:
- load delivered in solution (without load at end of each route)
-
getLoadAtEnd
- Returns:
- load delivered in solution at end of each route
-
getDistance
- Returns:
- total distance for specified solution
-
getOperationTime
- Returns:
- total operation time for specified solution
-
getMaxOperationTime
-
getWaitingTime
- Returns:
- total waiting time for specified solution
-
getTransportTime
- Returns:
- total transportation time
-
getTimeWindowViolation
- Returns:
- total time window violation for specified solution
-
getCapacityViolation
- Returns:
- total capacity violation for specified solution
-
getServiceTime
- Returns:
- total service time for specified solution
-
getFixedCosts
- Returns:
- total fixed costs for specified solution
-
getVariableTransportCosts
- Returns:
- total variable transport costs for specified solution
-
getTotalCosts
- Returns:
- total costs defined by solutionCostCalculator
-
hasShipmentConstraintViolation
- Returns:
- true if at least one route in specified solution has shipment constraint violation
-
hasBackhaulConstraintViolation
- Returns:
- true if at least one route in specified solution has backhaul constraint violation
-
hasSkillConstraintViolation
- Returns:
- true if at least one route in specified solution has skill constraint violation
-