Vehicle Constraints
Overview
Vehicle Constraints
class in Fleet Management RestAPI 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 INT_MAX . |
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 INT_MAX . |
MinDistance | Float | The minimum distance that the vehicle must travel (in the same distance unit as set in ConfigurationParameters ). Default is 0 . |
MaxDistance | Float | The maximum distance that the vehicle can travel (in the same distance unit as set in ConfigurationParameters ). Default is INT_MAX . |
MaxRevenue | Float | The maximum revenue that the vehicle can collect in total from all customers. Default is INT_MAX . |
FuelPrice | Float | The price for 1 liter of fuel or 1 kWh for an electric engine. |
Example Usage
{
"vehiclesConstraints": [
{
"fuelPrice": 1.09,
"startDate": 1596758400000,
"maxNumberOfPackages": 53,
"minNumberOfOrders": 0,
"maxNumberOfOrders": 300,
"minDistance": 0,
"maxDistance": 800,
"maxRevenue": 85
}
]
}
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.