Class VehicleTypeImpl.Builder

java.lang.Object
com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl.Builder
Enclosing class:
VehicleTypeImpl

public static class VehicleTypeImpl.Builder extends Object
Builder that builds the vehicle-type.
Author:
schroeder
  • Method Details

    • newInstance

      public static VehicleTypeImpl.Builder newInstance(String id)
    • setUserData

      public VehicleTypeImpl.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
    • setMaxVelocity

      public VehicleTypeImpl.Builder setMaxVelocity(double inMeterPerSeconds)
      Sets the maximum velocity this vehicle-type can go [in meter per seconds].
      Parameters:
      inMeterPerSeconds - in m/s
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if velocity is smaller than zero
    • setFixedCost

      public VehicleTypeImpl.Builder setFixedCost(double fixedCost)
      Sets the fixed costs of the vehicle-type.

      by default it is 0.

      Parameters:
      fixedCost - fixed cost of vehicle type
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if fixedCost is smaller than zero
    • setCostPerDistance

      public VehicleTypeImpl.Builder setCostPerDistance(double perDistance)
      Sets the cost per distance unit, for instance € per meter.

      by default it is 1.0

      Parameters:
      perDistance - cost per distance
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if perDistance is smaller than zero
    • setCostPerTime

      @Deprecated public VehicleTypeImpl.Builder setCostPerTime(double perTime)
      Deprecated.
      use .setCostPerTransportTime(..) instead
      Sets cost per time unit, for instance € per second.

      by default it is 0.0

      Parameters:
      perTime - cost per time
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if costPerTime is smaller than zero
    • setCostPerTransportTime

      public VehicleTypeImpl.Builder setCostPerTransportTime(double perTime)
      Sets cost per time unit, for instance € per second.

      by default it is 0.0

      Parameters:
      perTime - cost per time
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if costPerTime is smaller than zero
    • setCostPerWaitingTime

      public VehicleTypeImpl.Builder setCostPerWaitingTime(double perWaitingTime)
      Sets cost per waiting time unit, for instance € per second.

      by default it is 0.0

      Parameters:
      perWaitingTime - cost per waiting time
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if costPerTime is smaller than zero
    • setCostPerServiceTime

      public VehicleTypeImpl.Builder setCostPerServiceTime(double perServiceTime)
    • build

      public VehicleTypeImpl build()
      Builds the vehicle-type.
      Returns:
      VehicleTypeImpl
    • addCapacityDimension

      public VehicleTypeImpl.Builder addCapacityDimension(int dimIndex, int dimVal)
      Adds a capacity dimension.
      Parameters:
      dimIndex - dimension index
      dimVal - dimension value
      Returns:
      the builder
      Throws:
      IllegalArgumentException - if dimVal invalid input: '<' 0
      IllegalArgumentException - if capacity dimension is already set
    • setCapacityDimensions

      public VehicleTypeImpl.Builder setCapacityDimensions(Capacity capacity)
      Sets capacity dimensions.

      Note if you use this you cannot use addCapacityDimension(int dimIndex, int dimVal) anymore. Thus either build your dimensions with addCapacityDimension(int dimIndex, int dimVal) or set the already built dimensions with this method.

      Parameters:
      capacity - capacity of vehicle type
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if capacityDimension has already been added
    • setProfile

      public VehicleTypeImpl.Builder setProfile(String profile)