Example 1 – Operations with a single vehicle
Description of the problem
In this example, we have a request for the Planning API to solve a logistics problem involving 1 vehicle and 2 operations, starting from the distribution center.

Request
The full request can be seen below:
{
"optimizationProfile": "BRAZIL46",
"startDate": 1513750219000,
"legislationProfiles": [
{
"name": "DEFAULT"
}
],
"logisticConstraints": [
{
"name": "DEFAULT",
"siteLoadingFixedTime": 900,
"siteUnloadingFixedTime": 600
}
],
"products": [
{
"name": "DEFAULT"
}
],
"sites": [
{
"name": "Cliente1",
"coordinates": {
"latitude": -23.507608,
"longitude": -46.587145
},
"logisticConstraints": "DEFAULT"
},
{
"name": "Cliente2",
"coordinates": {
"latitude": -23.621059,
"longitude": -46.756193
},
"logisticConstraints": "DEFAULT"
}
],
"depots": [
{
"name": "CD",
"coordinates": {
"latitude": -23.503939,
"longitude": -46.498419
},
"logisticConstraints": "DEFAULT"
}
],
"vehicleTypes": [
{
"name": "VUC",
"maxVolume": 20,
"maxWeight": 1200,
"size": 1
}
],
"vehicles": [
{
"name": "VUC_1",
"vehicleType": "VUC",
"legislationProfile": "DEFAULT",
"availablePeriods": [
{
"departureSite": "CD",
"arrivalSite": "CD",
"timeWindow": {
"start": 1513753200000,
"end": 1513796400000
}
}
]
}
],
"operations": [
{
"id": "P1",
"weight": 100,
"volume": 2,
"product": "DEFAULT",
"type": "DELIVERY",
"depotSite": "CD",
"customerSite": "Cliente1",
"customerTimeWindows": [
{
"start": 1513756800000,
"end": 1513771200000
}
]
},
{
"id": "P2",
"weight": 250,
"volume": 5,
"product": "DEFAULT",
"type": "DELIVERY",
"depotSite": "CD",
"customerSite": "Cliente2",
"customerTimeWindows": [
{
"start": 1513756800000,
"end": 1513771200000
}
]
}
]
}
Solution to the logistics problem
The API response will be returned in json format with the best sequencing of delivery operations for each vehicle.

Response
The full response can be found below:
{
"id": "69e65d09afbd64087ee1e08f",
"clientId": "maplink",
"vehicleRoutes": [
{
"routes": [
{
"id": "NewRoute_1_1",
"activities": [
{
"activity": "ROUTE_START",
"timeWindow": {
"start": 1513754569000,
"end": 1513754569000
},
"type": "SITE",
"site": "CD",
"operations": []
},
{
"activity": "LOADING",
"timeWindow": {
"start": 1513754569000,
"end": 1513755469000
},
"type": "SITE",
"site": "CD",
"fixedTimeSite": 900,
"volume": 7.0,
"weight": 350.0,
"operations": [
"P2",
"P1"
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": 1513755469000,
"end": 1513756800000
},
"type": "DRIVING",
"operations": [],
"arrivalSite": "Cliente1",
"departureSite": "CD",
"distance": 13410,
"nominalDuration": 1331
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": 1513756800000,
"end": 1513757400000
},
"type": "SITE",
"site": "Cliente1",
"fixedTimeSite": 600,
"volume": 2.0,
"weight": 100.0,
"operations": [
"P1"
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": 1513757400000,
"end": 1513759737000
},
"type": "DRIVING",
"operations": [],
"arrivalSite": "Cliente2",
"departureSite": "Cliente1",
"distance": 26603,
"nominalDuration": 2337
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": 1513759737000,
"end": 1513760337000
},
"type": "SITE",
"site": "Cliente2",
"fixedTimeSite": 600,
"volume": 5.0,
"weight": 250.0,
"operations": [
"P2"
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": 1513760337000,
"end": 1513763220000
},
"type": "DRIVING",
"operations": [],
"arrivalSite": "CD",
"departureSite": "Cliente2",
"distance": 34654,
"nominalDuration": 2883
},
{
"activity": "ROUTE_END",
"timeWindow": {
"start": 1513763220000,
"end": 1513763220000
},
"type": "SITE",
"site": "CD",
"operations": []
}
]
}
],
"vehicle": "VUC_1",
"period": {
"timeWindow": {
"start": 1513753200000,
"end": 1513796400000
},
"departureSite": "CD",
"arrivalSite": "CD"
}
}
],
"indicators": {
"totalServiceTime": 2100,
"totalDeliveringTime": 1200,
"dayWorkingTotalTime": 8651,
"nightWorkingTotalTime": 0,
"totalUnloadingTime": 0,
"totalWorkingTime": 8651,
"totalCollectingTime": 0,
"timeWindowNumber": 1,
"totalDrivingTime": 6551,
"totalLoadingTime": 900,
"totalTime": 8651,
"totalDistance": 74667,
"averageOccupancyRateVolume": 35.0,
"averageOccupancyRateWeight": 29.17,
"rejectOperationsNumber": 0,
"totalWaitingTime": 0,
"totalRestTime": 0,
"routesNumber": 1
}
}