Planning

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.

Parameters used

  • "optimizationProfile": "BRAZIL46" – The BRAZIL46 optimization profile was used for this simulation. For the types available, check out optimizationProfile.
  • "tripsProfile": "MAPLINK" – We used the profile that contains the most up-to-date map and configured it to use the calculation mode to use faster routes.
  • "startDate": 1513750219000 – Reference start time for calculating logistics optimization.
  • "legislationProfiles" – Parameter with the name of the profile that applies to driving time, length of a working day or break. In this case there are no defined characteristics.
  • "logisticConstraints" – Logistical constraints used to determine the fixed time for loading and unloading cargo. In this example, 900 seconds (15 minutes) was used for the loading time of the truck and 600 seconds (10 minutes) for unloading at the delivery.
  • "products" – Name to refer to the product.
  • "sites" – Location where the delivery activities will take place, with definition of the name and the logistical restriction with the delivery time.
  • "depots" – Location of the distribution center, with definition of the name and the logistical restriction with truck loading time.
  • "vehicleTypes" – This parameter specifies the load capacity of the vehicles in the fleet, such as maximum volume and weight and size within a range of 1 to 9, and the name of the type.
  • "vehicles" – The vehicles that are available to run the route have been specified. In this example, a VUC-type vehicle. It also defines the working period and the legislation profile applicable to the driver. It was decided that the vehicle would leave and return to the Distribution Center.
  • "operations" – These are the characteristics of delivery operations, defining the location, weight and volume, product, type of activity, distribution center from which the product originates and the time the customer will receive it. In this example, there are 2 operations.

Complete request

The full request can be seen below:

{
    "optimizationProfile": "BRAZIL46",
    "tripsProfile": "MAPLINK",
    "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
                }
            ]
        }
    ]
}

Solving the logistics problem

The API response will be returned in json format with the best sequencing of delivery operations for each vehicle.

The following global indicators are returned, as well as the time sequence of the activities carried out by the vehicle:

IndicatorResults
Total service time:00:35:00
Total delivery time:00:20:00
Total daytime working time:02:25:13
Total time worked at night:00:00:00
Total unloading time:00:00:00
Total working time:02:25:13
Total collection time:00:00:00
Number of time windows:1
Total driving time:01:50:13
Total charging time:00:15:00
Total time:02:25:13
Total distance:74.21 km
Average occupancy rate in Volume:35
Average occupancy rate in Peso:29.17
Number of rejections:0
Total waiting time:00:00:00
Total rest time:00:00:00
Number of routes:1
Global route indicators

Full response

The full response can be found below:

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