Class Shipment.Builder

java.lang.Object
com.graphhopper.jsprit.core.problem.job.Shipment.Builder
Enclosing class:
Shipment

public static class Shipment.Builder extends Object
Builder that builds the shipment.
Author:
schroeder
  • Field Details

    • deliveryTimeWindows

      protected TimeWindowsImpl deliveryTimeWindows
    • userData

      public Object userData
    • maxTimeInVehicle

      public double maxTimeInVehicle
  • Method Details

    • newInstance

      public static Shipment.Builder newInstance(String id)
      Returns new instance of this builder.
      Parameters:
      id - the id of the shipment which must be a unique identifier among all jobs
      Returns:
      the builder
    • setUserData

      public Shipment.Builder setUserData(Object userData)
      Sets user specific domain data associated with the object.

      The user data is a black box for the framework, it only stores it, but never interacts with it in any way.

      Parameters:
      userData - any object holding the domain specific user data associated with the object.
      Returns:
      builder
    • setPickupLocation

      public Shipment.Builder setPickupLocation(Location pickupLocation)
      Sets pickup location.
      Parameters:
      pickupLocation - pickup location
      Returns:
      builder
    • setPickupServiceTime

      public Shipment.Builder setPickupServiceTime(double serviceTime)
      Sets pickupServiceTime.

      ServiceTime is intended to be the time the implied activity takes at the pickup-location.

      Parameters:
      serviceTime - the service time / duration the pickup of the associated shipment takes
      Returns:
      builder
      Throws:
      IllegalArgumentException - if servicTime invalid input: '<' 0.0
    • setPickupTimeWindow

      public Shipment.Builder setPickupTimeWindow(TimeWindow timeWindow)
      Sets the timeWindow for the pickup, i.e. the time-period in which a pickup operation is allowed to START.

      By default timeWindow is [0.0, Double.MAX_VALUE}

      Parameters:
      timeWindow - the time window within the pickup operation/activity can START
      Returns:
      builder
      Throws:
      IllegalArgumentException - if timeWindow is null
    • setDeliveryLocation

      public Shipment.Builder setDeliveryLocation(Location deliveryLocation)
      Sets delivery location.
      Parameters:
      deliveryLocation - delivery location
      Returns:
      builder
    • setDeliveryServiceTime

      public Shipment.Builder setDeliveryServiceTime(double deliveryServiceTime)
      Sets the delivery service-time.

      ServiceTime is intended to be the time the implied activity takes at the delivery-location.

      Parameters:
      deliveryServiceTime - the service time / duration of shipment's delivery
      Returns:
      builder
      Throws:
      IllegalArgumentException - if serviceTime invalid input: '<' 0.0
    • setDeliveryTimeWindow

      public Shipment.Builder setDeliveryTimeWindow(TimeWindow timeWindow)
      Sets the timeWindow for the delivery, i.e. the time-period in which a delivery operation is allowed to start.

      By default timeWindow is [0.0, Double.MAX_VALUE}

      Parameters:
      timeWindow - the time window within the associated delivery is allowed to START
      Returns:
      builder
      Throws:
      IllegalArgumentException - if timeWindow is null
    • addSizeDimension

      public Shipment.Builder addSizeDimension(int dimensionIndex, int dimensionValue)
      Adds capacity dimension.
      Parameters:
      dimensionIndex - the dimension index of the corresponding capacity value
      dimensionValue - the capacity value
      Returns:
      builder
      Throws:
      IllegalArgumentException - if dimVal invalid input: '<' 0
    • addAllSizeDimensions

      public Shipment.Builder addAllSizeDimensions(Capacity size)
    • build

      public Shipment build()
      Builds the shipment.
      Returns:
      shipment
      Throws:
      IllegalArgumentException - if neither pickup-location nor pickup-coord is set or if neither delivery-location nor delivery-coord is set
    • addRequiredSkill

      public Shipment.Builder addRequiredSkill(String skill)
    • addAllRequiredSkills

      public Shipment.Builder addAllRequiredSkills(Collection<String> skills)
    • addAllRequiredSkills

      public Shipment.Builder addAllRequiredSkills(Skills skills)
    • setName

      public Shipment.Builder setName(String name)
    • addDeliveryTimeWindow

      public Shipment.Builder addDeliveryTimeWindow(TimeWindow timeWindow)
    • addDeliveryTimeWindow

      public Shipment.Builder addDeliveryTimeWindow(double earliest, double latest)
    • addAllDeliveryTimeWindows

      public Shipment.Builder addAllDeliveryTimeWindows(Collection<TimeWindow> timeWindow)
    • addPickupTimeWindow

      public Shipment.Builder addPickupTimeWindow(TimeWindow timeWindow)
    • addPickupTimeWindow

      public Shipment.Builder addPickupTimeWindow(double earliest, double latest)
    • addAllPickupTimeWindows

      public Shipment.Builder addAllPickupTimeWindows(Collection<TimeWindow> timeWindow)
    • setPriority

      public Shipment.Builder setPriority(int priority)
      Set priority to shipment. Only 1 (high) to 10 (low) are allowed.

      Default is 2.

      Parameters:
      priority -
      Returns:
      builder
    • setMaxTimeInVehicle

      public Shipment.Builder setMaxTimeInVehicle(double maxTimeInVehicle)
      Sets maximal time the job can be in vehicle.
      Parameters:
      maxTimeInVehicle -
      Returns: