Exemplo 1 – Operações com um único veículo
Descrição do problema
Neste exemplo, temos uma requisição para Planning API resolver um problema logístico de 1 veículo e 2 operações, partindo do centro de distribuição.
Requisição completa
A requisição completa pode ser conferida abaixo:
{
"optimizationProfile": "BRAZIL46",
"tripsProfile": "MAPLINKBR",
"startDate": 1513750219000,
"legislationProfiles": [
{
"name": "DEFAULT"
}
],
"logisticConstraints": [
{
"name": "P1Pickup",
"siteLoadingFixedTime": 900
},
{
"name": "P1Delivery",
"siteUnloadingFixedTime": 600
}
],
"products": [
{
"name": "DEFAULT"
}
],
"sites": [
{
"name": "Cliente1",
"coordinates": {
"latitude": -23.507608,
"longitude": -46.587145
},
"logisticConstraints": "P1Delivery"
},
{
"name": "Cliente2",
"coordinates": {
"latitude": -23.621059,
"longitude": -46.756193
},
"logisticConstraints": "P1Delivery"
}
],
"depots": [
{
"name": "CD",
"coordinates": {
"latitude": -23.503939,
"longitude": -46.498419
},
"logisticConstraints": "P1Pickup"
}
],
"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
}
]
}
]
}
Solução do problema logístico
A resposta da API retornará no formato json com o melhor sequenciamento das operações de entrega para cada veículo.
Os seguintes indicadores globais são retornados, assim como a sequência temporal das atividades realizadas pelo veículo:
| Indicador | Resultado |
| Tempo total de serviço: | 00:35:00 |
| Tempo total de entrega: | 00:20:00 |
| Tempo total de trabalho diurno: | 02:25:13 |
| Tempo total de trabalho noturno: | 00:00:00 |
| Tempo total de descarregamento: | 00:00:00 |
| Tempo total de trabalho: | 02:25:13 |
| Tempo total de coleta: | 00:00:00 |
| Número de janelas de horário: | 1 |
| Tempo total de condução: | 01:50:13 |
| Tempo total de carregamento: | 00:15:00 |
| Tempo total: | 02:25:13 |
| Distância total: | 74.21 km |
| Taxa de ocupação média em Volume: | 35 |
| Taxa de ocupação média em Peso: | 29.17 |
| Número de rejeições: | 0 |
| Tempo total de espera: | 00:00:00 |
| Tempo total de descanso: | 00:00:00 |
| Número de rotas: | 1 |
Resposta completa
A resposta completa pode ser conferida abaixo:
{
"id": "60942de8d7cb173bfb2b78c7",
"clientId": "0wfdGfgEOFpME1RcsrBj4U5yAAJjeqFG",
"vehicleRoutes": [
{
"routes": [
{
"id": "NewRoute_1_1",
"activities": [
{
"activity": "ROUTE_START",
"timeWindow": {
"start": 1513754558000,
"end": 1513754558000
},
"type": "SITE",
"site": "CD",
"operations": []
},
{
"activity": "LOADING",
"timeWindow": {
"start": 1513754558000,
"end": 1513755458000
},
"type": "SITE",
"site": "CD",
"fixedTimeSite": 900,
"operations": [
"P2",
"P1"
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": 1513755458000,
"end": 1513756800000
},
"type": "DRIVING",
"operations": [],
"arrivalSite": "Cliente1",
"departureSite": "CD",
"distance": 13245,
"nominalDuration": 1342
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": 1513756800000,
"end": 1513757400000
},
"type": "SITE",
"site": "Cliente1",
"fixedTimeSite": 600,
"operations": [
"P1"
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": 1513757400000,
"end": 1513759758000
},
"type": "DRIVING",
"operations": [],
"arrivalSite": "Cliente2",
"departureSite": "Cliente1",
"distance": 27131,
"nominalDuration": 2358
},
{
"activity": "DELIVERY",
"timeWindow": {
"start": 1513759758000,
"end": 1513760358000
},
"type": "SITE",
"site": "Cliente2",
"fixedTimeSite": 600,
"operations": [
"P2"
]
},
{
"activity": "DRIVING",
"timeWindow": {
"start": 1513760358000,
"end": 1513763263000
},
"type": "DRIVING",
"operations": [],
"arrivalSite": "CD",
"departureSite": "Cliente2",
"distance": 34920,
"nominalDuration": 2905
},
{
"activity": "ROUTE_END",
"timeWindow": {
"start": 1513763263000,
"end": 1513763263000
},
"type": "SITE",
"site": "CD",
"operations": []
}
],
"status": null,
"violationConstraints": null,
"compartmentConfiguration": null
}
],
"vehicle": "VUC_1",
"period": {
"timeWindow": {
"start": 1513753200000,
"end": 1513796400000
},
"departureSite": "CD",
"arrivalSite": "CD",
"maxRoutesNumber": null,
"maxWorkingTime": null,
"maxDrivingTime": null
}
}
],
"rejectOperations": [],
"indicators": {
"totalServiceTime": 2100,
"totalDeliveringTime": 1200,
"dayWorkingTotalTime": 8705,
"nightWorkingTotalTime": 0,
"totalUnloadingTime": 0,
"totalWorkingTime": 8705,
"totalCollectingTime": 0,
"timeWindowNumber": 1,
"totalDrivingTime": 6605,
"totalLoadingTime": 900,
"totalTime": 8705,
"totalDistance": 75296,
"averageOccupancyRateVolume": 35.0,
"averageOccupancyRateWeight": 29.17,
"rejectOperationsNumber": 0,
"totalWaitingTime": 0,
"totalRestTime": 0,
"routesNumber": 1
}
}