Planning

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": "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
                }
            ]
        }
    ]
}

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:

IndicadorResultado
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
Indicadores globais da rota

Resposta completa

A resposta completa pode ser conferida abaixo:

{
    "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
    }
}