{"id":2531,"date":"2023-12-12T20:17:25","date_gmt":"2023-12-12T20:17:25","guid":{"rendered":"https:\/\/developers.maplink.global\/example-1-operations-with-a-single-vehicle\/"},"modified":"2026-04-13T22:00:59","modified_gmt":"2026-04-13T22:00:59","slug":"example-1-operations-with-a-single-vehicle","status":"publish","type":"post","link":"https:\/\/developers.maplink.global\/en\/example-1-operations-with-a-single-vehicle\/","title":{"rendered":"Example 1 &#8211; Operations with a single vehicle"},"content":{"rendered":"\n<ul class=\"wp-block-list\">\n<li><a href=\"#descricao\" data-type=\"internal\" data-id=\"#descricao\">Description of the problem<\/a><\/li>\n\n\n\n<li><a href=\"#requisicao\" data-type=\"internal\" data-id=\"#requisicao\">Request<\/a><\/li>\n\n\n\n<li><a href=\"#solucao\" data-type=\"internal\" data-id=\"#solucao\">Solution of the logistic problem<\/a><\/li>\n\n\n\n<li><a href=\"#resposta\" data-type=\"internal\" data-id=\"#resposta\">Response<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"descricao\">Description of the problem<\/h3>\n\n\n\n<p>In this example, we have a request for the Planning API to solve a <strong>logistics problem involving 1 vehicle and 2 operations, starting from the distribution center<\/strong>.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/5uooMHRJeaGLLCR5m9ChVzZzljxCQeKzZWNZpBTyKePBux54Yge1NZYQVsGJ25_gxdLnwWElUuyfLiOM31c1aY-_mRWlvTxHhokobhdOIf9HdOQLhwQ_QovRT9F3BYjD8NTZxMjqkfCV_4PTPsiRtmk\" width=\"703\" height=\"319\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"requisicao\">Request<\/h3>\n\n\n\n<p>The full request can be seen below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"optimizationProfile\": \"BRAZIL46\",\n    \"tripsProfile\": \"MAPLINK\",\n    \"startDate\": 1513750219000,\n    \"legislationProfiles\": [\n        {\n            \"name\": \"DEFAULT\"\n        }\n    ],\n    \"logisticConstraints\": [\n        {\n            \"name\": \"P1Pickup\",\n            \"siteLoadingFixedTime\": 900\n        },\n        {\n            \"name\": \"P1Delivery\",\n            \"siteUnloadingFixedTime\": 600\n        }\n    ],\n    \"products\": [\n        {\n            \"name\": \"DEFAULT\"\n        }\n    ],\n    \"sites\": [\n        {\n            \"name\": \"Cliente1\",\n            \"coordinates\": {\n                \"latitude\": -23.507608,\n                \"longitude\": -46.587145\n            },\n            \"logisticConstraints\": \"P1Delivery\"\n        },\n        {\n            \"name\": \"Cliente2\",\n            \"coordinates\": {\n                \"latitude\": -23.621059,\n                \"longitude\": -46.756193\n            },\n            \"logisticConstraints\": \"P1Delivery\"\n        }\n    ],\n    \"depots\": [\n        {\n            \"name\": \"CD\",\n            \"coordinates\": {\n                \"latitude\": -23.503939,\n                \"longitude\": -46.498419\n            },\n            \"logisticConstraints\": \"P1Pickup\"\n        }\n    ],\n    \"vehicleTypes\": [\n        {\n            \"name\": \"VUC\",\n            \"maxVolume\": 20,\n            \"maxWeight\": 1200,\n            \"size\": 1\n        }\n    ],\n    \"vehicles\": [\n        {\n            \"name\": \"VUC_1\",\n            \"vehicleType\": \"VUC\",\n            \"legislationProfile\": \"DEFAULT\",\n            \"availablePeriods\": [\n                {\n                    \"departureSite\": \"CD\",\n                    \"arrivalSite\": \"CD\",\n                    \"timeWindow\": {\n                        \"start\": 1513753200000,\n                        \"end\": 1513796400000\n                    }\n                }\n            ]\n        }\n    ],\n    \"operations\": [\n        {\n            \"id\": \"P1\",\n            \"weight\": 100,\n            \"volume\": 2,\n            \"product\": \"DEFAULT\",\n            \"type\": \"DELIVERY\",\n            \"depotSite\": \"CD\",\n            \"customerSite\": \"Cliente1\",\n            \"customerTimeWindows\": [\n                {\n                    \"start\": 1513756800000,\n                    \"end\": 1513771200000\n                }\n            ]\n        },\n        {\n            \"id\": \"P2\",\n            \"weight\": 250,\n            \"volume\": 5,\n            \"product\": \"DEFAULT\",\n            \"type\": \"DELIVERY\",\n            \"depotSite\": \"CD\",\n            \"customerSite\": \"Cliente2\",\n            \"customerTimeWindows\": [\n                {\n                    \"start\": 1513756800000,\n                    \"end\": 1513771200000\n                }\n            ]\n        }\n    ]\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"solucao\"><strong>Solution of the logistic problem<\/strong><\/h3>\n\n\n\n<p>The API response will be returned in <em>json<\/em> format with the best sequencing of delivery operations for each vehicle.  <\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/3lZ9byKkcpx8KWMFfCu2g69lP_vFM4kRrPHh43ks7NRmA-WybXul9s4e5zuMXLoij8nd466ShgAfSHp_DbtnoLZQIcj2ELb6PL-Y0Zn_R0TtYax5lhcS5IF_byY_cVL8xON9qGfLb-5NCNmfcx04mgM\" width=\"703\" height=\"320\"><\/p>\n\n\n\n<p>The following global indicators are returned, as well as the time sequence of the activities carried out by the vehicle:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Indicator<\/strong><\/td><td><strong>Results<\/strong><\/td><\/tr><tr><td><strong>Total service time:<\/strong><\/td><td>00:35:00<\/td><\/tr><tr><td><strong>Total delivery time:<\/strong><\/td><td>00:20:00<\/td><\/tr><tr><td><strong>Total daytime working time:<\/strong><\/td><td>02:25:13<\/td><\/tr><tr><td><strong>Total time worked at night:<\/strong><\/td><td>00:00:00<\/td><\/tr><tr><td><strong>Total unloading time:<\/strong><\/td><td>00:00:00<\/td><\/tr><tr><td><strong>Total working time:<\/strong><\/td><td>02:25:13<\/td><\/tr><tr><td><strong>Total collection time:<\/strong><\/td><td>00:00:00<\/td><\/tr><tr><td><strong>Number of time windows:<\/strong><\/td><td>1<\/td><\/tr><tr><td><strong>Total driving time:<\/strong><\/td><td>01:50:13<\/td><\/tr><tr><td><strong>Total charging time:<\/strong><\/td><td>00:15:00<\/td><\/tr><tr><td><strong>Total time:<\/strong><\/td><td>02:25:13<\/td><\/tr><tr><td><strong>Total distance:<\/strong><\/td><td>74.21 km<\/td><\/tr><tr><td><strong>Average occupancy rate in Volume:<\/strong><\/td><td>35<\/td><\/tr><tr><td><strong>Average occupancy rate in Peso:<\/strong><\/td><td>29.17<\/td><\/tr><tr><td><strong>Number of rejections:<\/strong><\/td><td>0<\/td><\/tr><tr><td><strong>Total waiting time:<\/strong><\/td><td>00:00:00<\/td><\/tr><tr><td><strong>Total rest time:<\/strong><\/td><td>00:00:00<\/td><\/tr><tr><td><strong>Number of routes:<\/strong><\/td><td>1<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Global route indicators<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"resposta\">Response<\/h3>\n\n\n\n<p>The full response can be found below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"id\": \"60942de8d7cb173bfb2b78c7\",\n    \"clientId\": \"0wfdGfgEOFpME1RcsrBj4U5yAAJjeqFG\",\n    \"vehicleRoutes\": [\n        {\n            \"routes\": [\n                {\n                    \"id\": \"NewRoute_1_1\",\n                    \"activities\": [\n                        {\n                            \"activity\": \"ROUTE_START\",\n                            \"timeWindow\": {\n                                \"start\": 1513754558000,\n                                \"end\": 1513754558000\n                            },\n                            \"type\": \"SITE\",\n                            \"site\": \"CD\",\n                            \"operations\": []\n                        },\n                        {\n                            \"activity\": \"LOADING\",\n                            \"timeWindow\": {\n                                \"start\": 1513754558000,\n                                \"end\": 1513755458000\n                            },\n                            \"type\": \"SITE\",\n                            \"site\": \"CD\",\n                            \"fixedTimeSite\": 900,\n                            \"operations\": [\n                                \"P2\",\n                                \"P1\"\n                            ]\n                        },\n                        {\n                            \"activity\": \"DRIVING\",\n                            \"timeWindow\": {\n                                \"start\": 1513755458000,\n                                \"end\": 1513756800000\n                            },\n                            \"type\": \"DRIVING\",\n                            \"operations\": [],\n                            \"arrivalSite\": \"Cliente1\",\n                            \"departureSite\": \"CD\",\n                            \"distance\": 13245,\n                            \"nominalDuration\": 1342\n                        },\n                        {\n                            \"activity\": \"DELIVERY\",\n                            \"timeWindow\": {\n                                \"start\": 1513756800000,\n                                \"end\": 1513757400000\n                            },\n                            \"type\": \"SITE\",\n                            \"site\": \"Cliente1\",\n                            \"fixedTimeSite\": 600,\n                            \"operations\": [\n                                \"P1\"\n                            ]\n                        },\n                        {\n                            \"activity\": \"DRIVING\",\n                            \"timeWindow\": {\n                                \"start\": 1513757400000,\n                                \"end\": 1513759758000\n                            },\n                            \"type\": \"DRIVING\",\n                            \"operations\": [],\n                            \"arrivalSite\": \"Cliente2\",\n                            \"departureSite\": \"Cliente1\",\n                            \"distance\": 27131,\n                            \"nominalDuration\": 2358\n                        },\n                        {\n                            \"activity\": \"DELIVERY\",\n                            \"timeWindow\": {\n                                \"start\": 1513759758000,\n                                \"end\": 1513760358000\n                            },\n                            \"type\": \"SITE\",\n                            \"site\": \"Cliente2\",\n                            \"fixedTimeSite\": 600,\n                            \"operations\": [\n                                \"P2\"\n                            ]\n                        },\n                        {\n                            \"activity\": \"DRIVING\",\n                            \"timeWindow\": {\n                                \"start\": 1513760358000,\n                                \"end\": 1513763263000\n                            },\n                            \"type\": \"DRIVING\",\n                            \"operations\": [],\n                            \"arrivalSite\": \"CD\",\n                            \"departureSite\": \"Cliente2\",\n                            \"distance\": 34920,\n                            \"nominalDuration\": 2905\n                        },\n                        {\n                            \"activity\": \"ROUTE_END\",\n                            \"timeWindow\": {\n                                \"start\": 1513763263000,\n                                \"end\": 1513763263000\n                            },\n                            \"type\": \"SITE\",\n                            \"site\": \"CD\",\n                            \"operations\": []\n                        }\n                    ],\n                    \"status\": null,\n                    \"violationConstraints\": null,\n                    \"compartmentConfiguration\": null\n                }\n            ],\n            \"vehicle\": \"VUC_1\",\n            \"period\": {\n                \"timeWindow\": {\n                    \"start\": 1513753200000,\n                    \"end\": 1513796400000\n                },\n                \"departureSite\": \"CD\",\n                \"arrivalSite\": \"CD\",\n                \"maxRoutesNumber\": null,\n                \"maxWorkingTime\": null,\n                \"maxDrivingTime\": null\n            }\n        }\n    ],\n    \"rejectOperations\": [],\n    \"indicators\": {\n        \"totalServiceTime\": 2100,\n        \"totalDeliveringTime\": 1200,\n        \"dayWorkingTotalTime\": 8705,\n        \"nightWorkingTotalTime\": 0,\n        \"totalUnloadingTime\": 0,\n        \"totalWorkingTime\": 8705,\n        \"totalCollectingTime\": 0,\n        \"timeWindowNumber\": 1,\n        \"totalDrivingTime\": 6605,\n        \"totalLoadingTime\": 900,\n        \"totalTime\": 8705,\n        \"totalDistance\": 75296,\n        \"averageOccupancyRateVolume\": 35.0,\n        \"averageOccupancyRateWeight\": 29.17,\n        \"rejectOperationsNumber\": 0,\n        \"totalWaitingTime\": 0,\n        \"totalRestTime\": 0,\n        \"routesNumber\": 1\n    }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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: Solution of the logistic problem The API response will be returned in json format with the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[160],"tags":[],"class_list":["post-2531","post","type-post","status-publish","format-standard","hentry","category-planning-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/comments?post=2531"}],"version-history":[{"count":2,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2531\/revisions"}],"predecessor-version":[{"id":3743,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2531\/revisions\/3743"}],"wp:attachment":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/media?parent=2531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/categories?post=2531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/tags?post=2531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}