java.lang.Object
com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute

public class VehicleRoute extends Object
Contains the tour, i.e. a number of activities, a vehicle servicing the tour and a driver.
Author:
stefan
  • Method Details

    • copyOf

      public static VehicleRoute copyOf(VehicleRoute route)
      Returns a deep copy of this vehicleRoute.
      Parameters:
      route - route to copy
      Returns:
      copied route
      Throws:
      IllegalArgumentException - if route is null
    • emptyRoute

      public static VehicleRoute emptyRoute()
      Returns an empty route.

      An empty route has an empty list of tour-activities, no driver (DriverImpl.noDriver()) and no vehicle (VehicleImpl.createNoVehicle()).

      Returns:
      empty route
    • getIndex

      public int getIndex()
    • setIndex

      public void setIndex(int index)
    • getActivities

      public List<TourActivity> getActivities()
      Returns an unmodifiable list of activities on this route (without start/end).
      Returns:
      list of tourActivities
    • getTourActivities

      public TourActivities getTourActivities()
      Returns TourActivities.
      Returns:
      TourActivities
    • getVehicle

      public Vehicle getVehicle()
      Returns the vehicle operating this route.
      Returns:
      Vehicle
    • getDriver

      public Driver getDriver()
      Returns the driver operating this route.
      Returns:
      Driver
    • setVehicleAndDepartureTime

      public void setVehicleAndDepartureTime(Vehicle vehicle, double vehicleDepTime)
      Sets the vehicle and its departureTime from vehicle.getStartLocationId().

      This implies the following:
      if start and end are null, new start and end activities are created.

      startActivity is initialized with the start-location of the specified vehicle (vehicle.getStartLocationId()). the time-window of this activity is initialized such that [startActivity.getTheoreticalEarliestOperationStartTime() = vehicle.getEarliestDeparture()][startActivity.getTheoreticalLatestOperationStartTime() = vehicle.getLatestArrival()]

      endActivity is initialized with the end-location of the specified vehicle (vehicle.getEndLocationId()). The time-window of the endActivity is initialized such that [endActivity.getTheoreticalEarliestOperationStartTime() = vehicle.getEarliestDeparture()][endActivity.getTheoreticalLatestOperationStartTime() = vehicle.getLatestArrival()]

      startActivity.endTime (startActivity.getEndTime()) is set to max{vehicle.getEarliestDeparture(), vehicleDepTime}. thus, vehicle.getEarliestDeparture() is a physical constraint that has to be met.

      Parameters:
      vehicle - to be employed
      vehicleDepTime - of employed vehicle
    • getDepartureTime

      public double getDepartureTime()
      Returns the departureTime of this vehicle in this route.
      Returns:
      departureTime
      Throws:
      IllegalArgumentException - if start is null
    • isEmpty

      public boolean isEmpty()
      Returns tour if tour-activity-sequence is empty, i.e. to activity on the tour yet.
      Returns:
      true if route is empty
    • hasVehicle

      public boolean hasVehicle()
      Returns true if this route has a vehicle assigned. Use this instead of route.getVehicle() instanceof VehicleImpl.NoVehicle checks.
      Returns:
      true if a vehicle is assigned, false otherwise
    • getStart

      public Start getStart()
      Returns start-activity of this route.
      Returns:
      start
    • getEnd

      public End getEnd()
      Returns end-activity of this route.
      Returns:
      end
    • toString

      public String toString()
      Overrides:
      toString in class Object