Consolidate Orders According to Vehicle Capacity

See files for this Use Case on GitHub here

Consolidate orders according to vehicle capacity.

Description

Vehicles can only carry up to a certain capacity. If cargo volume has to be distributed between several vehicles, it is important to set the correct parameters for each vehicle's capacity.

Solution

Optimization Parameters and Addresses

To provide correct information for this Use Case, you need to pay attention to the following parameters:

ParameterDescription
vehicle_capacityHow much cargo can the vehicle carry (in units, e.g. cubic meters)
vehicle_max_cargo_weightMaximum cargo weight the vehicle can carry
vehicle_max_cargo_volumeMaximum cargo volume the vehicle can carry
vehicle_max_distance_miMaximum distance for a single vehicle in a route (always in miles)
subtour_max_revenueMaximum revenue per route
route_max_durationMaximum number of seconds it takes to complete a route
partsNumber of vehicles
parts_minMinimum number of vehicles
limited_weight_tIf travel_mode = "Trucking", specifies the truck weight (required)

Addresses are without time windows and you can see them on the map as:

Create an Optimization

The cURL example below shows you how to create new optimized routes for this Use Case:

ParameterTypeDescription
api_keystringAPI KEY of the user
input dataPOST dataValid JSON object string. Click here to see the JSON Schema
1 @ECHO OFF
2 :: Single Depot, Multiple Driver, No Time Window
3 
4 ::See video tutorial here: http://support.route4me.com/route-planning-help.php?id=manual0:tutorial2:chapter2:subchapter1
5 
6 SET URL=https://www.route4me.com/api.v4/optimization_problem.php
7 SET apikey=11111111111111111111111111111111
8 SET route_path_output=Points
9 
10 ECHO ON
11 
12 curl -o file1.txt -g -X POST -k -d "@single_depot_multiple_driver_notime_window_data.json" "%URL%?api_key=%apikey%&route_path_output=%route_path_output%"
13 
14 timeout /t 30

You can expect an Optimization Problem (see link), which has generated some routes already.

View the Optimization details

You can get more details from the newly created Optimization Problem.

The endpoint: https://www.route4me.com/api.v4/optimization_problem.php

HTTP Parameters

AttributeTypeDescriptionHTTP
method
api_keystringAPI KEY of the userGET
optimization_problem_idstringOptimization Problem IDGET


1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/optimization_problem.php
4 SET apikey=11111111111111111111111111111111
5 SET optprobid=38D4E661BB49089B92C7722F86ED7181
6 
7 ECHO ON
8 
9 curl -o file1.txt -g -X GET -k "%url%?api_key=%apikey%&optimization_problem_id=%optprobid%"
10 
11 timeout /t 30

See sample RESPONSE JSON data here

In the RESPONSE you can see an array of the addresses, which belongs to 5 generated routes.

Details of the Optimized Routes

Below is an example for one route; you can get the details of the remaining routes by using the same method and changing the parameter route_id.

The endpoint: https://www.route4me.com/api.v4/route.php

HTTP Parameters

AttributeTypeDescriptionHTTP
method
api_keystringAPI KEY of the userGET
route_idstringRoute IDGET
route_path_outputstringIf equal to 'Poitns', you'll get an array of the path points to next addressGET


1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/route.php
4 SET apikey=11111111111111111111111111111111
5 SET routeid=43F55835F1E76003FF980547F77338BD
6 SET rpo=Points
7 
8 ECHO ON
9 
10 curl -o file1.txt -g -k -X GET "%url%?route_id=%routeid%&api_key=%apikey%&route_path_output=%rpo%"
11 
12 timeout /t 30

See sample RESPONSE JSON data here

Note
In the RESPONSE you can see the array of the fields path_to_next and use them to draw routes on a map, exactly as they are generated by the Route4Me API.

You can see a route on the map drawn by the Route4Me API as:

You can draw all five generated routes as:

Same case on the Route4Me official website

You can try this Optimization Problem on Route4Me's official website.

You can get this result on a map:

The results seem to be a little different. This is because the parameter-choosing options are different, and the drawing tools are different as well.