Vehicle Constraints
Vehicle Constraints class in Fleet Management Rest API define the limitations and requirements applied to a vehicle during the route optimization process. These constraints ensure that the vehicle operates within its capabilities, such as capacity, distance, and revenue limits. Properly configuring these constraints ensures that the optimization algorithm generates feasible and efficient routes for the vehicle.
Vehicle Constraints Structure
Each Vehicle Constraint consists of:
| Name | Type | Description |
|---|---|---|
| StartDate | Integer | The date when the vehicle starts its route. Default is the current UTC time. |
| MaxNumberOfPackages | Integer | The maximum number of packages that the vehicle can carry. Default is |
| MinNumberOfOrders | Integer | The minimum number of orders that the vehicle must visit. Default is 0. |
| MaxNumberOfOrders | Integer | The maximum number of orders that the vehicle can visit. Default is |
| MinDistance | Float | The minimum distance that the vehicle must travel (in the same distance unit as set in |
| MaxDistance | Float | The maximum distance that the vehicle can travel (in the same distance unit as set in |
| MaxRevenue | Float | The maximum revenue that the vehicle can collect in total from all customers. Default is |
| FuelPrice | Float | The price for 1 liter of fuel or 1 kWh for an electric engine. |
Example Usage
- Schema View
- JSON Example
- JSON View
fuelPrice(float)The price for 1 liter of fuel or 1 kWh for an electric engine.startDate(integer)The date when the vehicle starts its route. Default is the current UTC time.maxNumberOfPackages(integer)The maximum number of packages that the vehicle can carry. Default is INT_MAX.
Not available for optimizations with e-bikesminNumberOfOrders(integer)The minimum number of orders that the vehicle must visit. Default is 0.maxNumberOfOrders(integer)The maximum number of orders that the vehicle can visit. Default is INT_MAX.
Not available for optimizations with e-bikesminDistance(number)The minimum distance that the vehicle must travel (in the same distance unit as set in ConfigurationParameters). Default is 0.
Not available for optimizations with e-bikesmaxDistance(number)The maximum distance that the vehicle can travel (in the same distance unit as set in ConfigurationParameters).
Not available for optimizations with e-bikesmaxRevenue(number)The maximum revenue that the vehicle can collect in total from all customers. Default is INT_MAX.
Not available for optimizations with e-bikes
{
"vehicleConstraints": [
{
"fuelPrice": 1.09,
"startDate": 1596758400000,
"maxNumberOfPackages": 53,
"minNumberOfOrders": 0,
"maxNumberOfOrders": 300,
"minDistance": 0,
"maxDistance": 800,
"maxRevenue": 85
}
]
}
{
"vehicleConstraints": [
{
"fuelPrice": 0,
"startDate": 0,
"maxNumberOfPackages": 0,
"minNumberOfOrders": 0,
"maxNumberOfOrders": 0,
"minDistance": 0,
"maxDistance": 0,
"maxRevenue": 0
}
]
}
Explanation
This setup configures a vehicle with the following vehicleConstraints:
- Start time – The vehicle begins its route at the specified
startDate(timestamp: 1596758400000, in UTC). - Maximum of 53 packages – The vehicle can carry up to 53 packages.
- Minimum of 0 orders – The vehicle is not required to visit any minimum number of orders.
- Maximum of 300 orders – The vehicle can visit up to 300 orders.
- Minimum distance of 0 units – There is no minimum travel distance required.
- Maximum distance of 800 units – The vehicle cannot travel more than 800 units.
- Maximum revenue of 85 – The total revenue collected from all customers must not exceed 85.
- Fuel price of 1.09 – The cost of fuel is set at 1.09 per unit (liter or kWh, depending on engine type).
These constraints ensure that the vehicle operates within its defined limits, allowing the optimization algorithm to generate feasible and efficient routes.