Class SolutionAnalyser

java.lang.Object
com.graphhopper.jsprit.core.analysis.SolutionAnalyser

public class SolutionAnalyser extends Object
Calculates a set of statistics for a solution.
  • Constructor Details

  • Method Details

    • getLoadAtBeginning

      public Capacity getLoadAtBeginning(VehicleRoute route)
      Parameters:
      route - to get the load at beginning from
      Returns:
      load at start location of specified route
    • getLoadAtEnd

      public Capacity getLoadAtEnd(VehicleRoute route)
      Parameters:
      route - to get the load at the end from
      Returns:
      load at end location of specified route
    • getMaxLoad

      public Capacity getMaxLoad(VehicleRoute route)
      Parameters:
      route - to get max load from
      Returns:
      max load of specified route, i.e. for each capacity dimension the max value.
    • getLoadRightAfterActivity

      public Capacity getLoadRightAfterActivity(TourActivity activity, VehicleRoute route)
      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

      public Capacity getLoadJustBeforeActivity(TourActivity activity, VehicleRoute route)
      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

      public Integer getNumberOfPickups(VehicleRoute route)
      Parameters:
      route - to get number of pickups from
      Returns:
      number of pickups picked up on specified route (without load at beginning)
    • getNumberOfDeliveries

      public Integer getNumberOfDeliveries(VehicleRoute route)
      Parameters:
      route - to get number of deliveries from
      Returns:
      number of deliveries delivered on specified route (without load at end)
    • getLoadPickedUp

      public Capacity getLoadPickedUp(VehicleRoute route)
      Parameters:
      route - to get the picked load from
      Returns:
      picked load (without load at beginning)
    • getLoadDelivered

      public Capacity getLoadDelivered(VehicleRoute route)
      Parameters:
      route - to get delivered load from
      Returns:
      delivered laod (without load at end)
    • getCapacityViolation

      public Capacity getCapacityViolation(VehicleRoute route)
      Parameters:
      route - to get the capacity violation from
      Returns:
      the capacity violation on this route, i.e. maxLoad - vehicleCapacity
    • getCapacityViolationAtBeginning

      public Capacity getCapacityViolationAtBeginning(VehicleRoute route)
      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

      public Capacity getCapacityViolationAtEnd(VehicleRoute route)
      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

      public Capacity getCapacityViolationAfterActivity(TourActivity activity, VehicleRoute route)
      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

      public Double getTimeWindowViolation(VehicleRoute route)
      Parameters:
      route - to get the time window violation from
      Returns:
      time violation of route, i.e. sum of individual activity time window violations.
    • getTimeWindowViolationAtActivity

      public Double getTimeWindowViolationAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to get the time window violation from
      route - where activity needs to be part of
      Returns:
      time violation of activity
    • hasSkillConstraintViolation

      public Boolean hasSkillConstraintViolation(VehicleRoute route)
      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

      public Boolean hasSkillConstraintViolationAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to check skill constraint
      route - 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

      public Boolean hasBackhaulConstraintViolation(VehicleRoute route)
      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

      public Boolean hasBackhaulConstraintViolationAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to check backhaul violation
      route - 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

      public Boolean hasShipmentConstraintViolation(VehicleRoute route)
      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

      public Boolean hasShipmentConstraintViolationAtActivity(TourActivity activity, VehicleRoute route)
      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 constraint
      route - 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

      public Double getOperationTime(VehicleRoute route)
      Parameters:
      route - to get the total operation time from
      Returns:
      operation time of this route, i.e. endTime - startTime of specified route
    • getWaitingTime

      public Double getWaitingTime(VehicleRoute route)
      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

      public Double getTransportTime(VehicleRoute route)
      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

      public Double getServiceTime(VehicleRoute route)
      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

      public Double getVariableTransportCosts(VehicleRoute route)
      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

      public Double getFixedCosts(VehicleRoute route)
      Parameters:
      route - to get the fixed costs from
      Returns:
      fixed costs of route, i.e. fixed costs of employed vehicle on this route.
    • getVariableTransportCostsAtActivity

      public Double getVariableTransportCostsAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to get the variable transport costs from
      route - 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

      public Double getTransportTimeAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to get the transport time from
      route - 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

      public Double getLastTransportTimeAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to get the last transport time from
      route - where the activity should be part of
      Returns:
      The transport time from the previous activity to this one.
    • getLastTransportDistanceAtActivity

      public Double getLastTransportDistanceAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to get the last transport distance from
      route - where the activity should be part of
      Returns:
      The transport distance from the previous activity to this one.
    • getLastTransportCostAtActivity

      public Double getLastTransportCostAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to get the last transport cost from
      route - where the activity should be part of
      Returns:
      The transport cost from the previous activity to this one.
    • getWaitingTimeAtActivity

      public Double getWaitingTimeAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - to get the waiting from
      route - where activity should be part of
      Returns:
      waiting time at activity
    • getDistance

      public Double getDistance(VehicleRoute route)
      Parameters:
      route - to get the distance from
      Returns:
      total distance of route
    • getDistanceAtActivity

      public Double getDistanceAtActivity(TourActivity activity, VehicleRoute route)
      Parameters:
      activity - at which is distance of the current route is measured
      Returns:
      distance at activity
    • getNumberOfPickups

      public Integer getNumberOfPickups()
      Returns:
      number of pickups in specified solution (without load at beginning of each route)
    • getNumberOfPickupsAtBeginning

      public Integer getNumberOfPickupsAtBeginning(VehicleRoute route)
      Parameters:
      route - to get the number of pickups at beginning from
      Returns:
      number of pickups at beginning
    • getNumberOfPickupsAtBeginning

      public Integer getNumberOfPickupsAtBeginning()
      Returns:
      number of pickups in specified solution at beginning of each route
    • getNumberOfDeliveries

      public Integer getNumberOfDeliveries()
      Returns:
      number of deliveries in specified solution (without load at end of each route)
    • getNumberOfDeliveriesAtEnd

      public Integer getNumberOfDeliveriesAtEnd()
      Returns:
      number of deliveries in specified solution at end of each route
    • getNumberOfDeliveriesAtEnd

      public Integer getNumberOfDeliveriesAtEnd(VehicleRoute route)
      Parameters:
      route - to get the number of deliveries at end from
      Returns:
      number of deliveries at end of specified route
    • getLoadPickedUp

      public Capacity getLoadPickedUp()
      Returns:
      load picked up in solution (without load at beginning of each route)
    • getLoadAtBeginning

      public Capacity getLoadAtBeginning()
      Returns:
      load picked up in solution at beginning of each route
    • getLoadDelivered

      public Capacity getLoadDelivered()
      Returns:
      load delivered in solution (without load at end of each route)
    • getLoadAtEnd

      public Capacity getLoadAtEnd()
      Returns:
      load delivered in solution at end of each route
    • getDistance

      public Double getDistance()
      Returns:
      total distance for specified solution
    • getOperationTime

      public Double getOperationTime()
      Returns:
      total operation time for specified solution
    • getMaxOperationTime

      public Double getMaxOperationTime()
    • getWaitingTime

      public Double getWaitingTime()
      Returns:
      total waiting time for specified solution
    • getTransportTime

      public Double getTransportTime()
      Returns:
      total transportation time
    • getTimeWindowViolation

      public Double getTimeWindowViolation()
      Returns:
      total time window violation for specified solution
    • getCapacityViolation

      public Capacity getCapacityViolation()
      Returns:
      total capacity violation for specified solution
    • getServiceTime

      public Double getServiceTime()
      Returns:
      total service time for specified solution
    • getFixedCosts

      public Double getFixedCosts()
      Returns:
      total fixed costs for specified solution
    • getVariableTransportCosts

      public Double getVariableTransportCosts()
      Returns:
      total variable transport costs for specified solution
    • getTotalCosts

      public Double getTotalCosts()
      Returns:
      total costs defined by solutionCostCalculator
    • hasShipmentConstraintViolation

      public Boolean hasShipmentConstraintViolation()
      Returns:
      true if at least one route in specified solution has shipment constraint violation
    • hasBackhaulConstraintViolation

      public Boolean hasBackhaulConstraintViolation()
      Returns:
      true if at least one route in specified solution has backhaul constraint violation
    • hasSkillConstraintViolation

      public Boolean hasSkillConstraintViolation()
      Returns:
      true if at least one route in specified solution has skill constraint violation