Pricing a Dynamic Fleet Using Simulated Route Optimizations

You can simulate route optimization of the dynamic fleet and choose the correct parameters for optimal pricing.

Description

The core functionality of the Route4Me API is a unique route optimization engine, which substantially reduces route length and gas consumption. It also helps to reduce the manpower needed to fulfill the route and reduce the time needed to find optimal route. With this engine you can find most cost-efficient solution by fine-tuning route parameters and simulating the route optimization.

Consider the following business case: You've been extending your delivery business to a new area and you need to consider two options to improve the cost efficiency: use the existing depot to serve new clients or rent/buy a new depot location. To make a decision on which option is more cost efficient for you, you need to analyze the following factors:

  • Rental/purchase cost for new depot location;
  • Potential change in distance traveled by your delivery fleet and potential change in working time for you delivery drivers team and changes in a number of drivers required. Eventually, you need to calculate and analyze the resulting changes in the overall delivery cost;
  • You may want to consider several different locations, analyzing the above factors for each of potential depot location from your list and then compare them using some quantitative data.

As you can see the above analysis may become quite laborious, if not impossible, if you perform it without the proper tools and expertise. Alternatively, you can use Route4Me to enter all the above parameters in our robust route optimization engine and thoroughly analyze cost consequences coming from the new business opportunities and select the most efficient solutions for your business and eventually minimize your profit

Route4Me Online Tool - Depot Analyzer Simulation

The Route4Me Depot Analyzer app helps you to find the location for your next warehouse by analyzing all the past and projected orders in the vicinity. The tool can accurately define which of your existing depots, or depots you're considering to purchase or rent, would be the most efficient to service a given set of addresses.

You can find the tool here: follow this link to access the tool https://apps.route4me.com/depots/#/ .

Click on the button Create New Depot Analyzer Simulation.

Name Your Simulation. Type in a name for the simulation (e.g. name of the region).

Prepare the Files for Upload. Next, prepare the files for upload. You need to create one file for your depots and another one for your locations to visit. You can download sample files to see the formatting of the spreadsheets. The Depots file can include up to 500 addresses.

Fill the simulation assumptions.

Click on the button Begin Analysis

The optimization will apply to all the depots and multiple routes will be created as a result. Depending on the number of locations, you may get one or multiple routes for each depot. The simulation progress will be displayed on the main page.

Simulated routes will be added to your routes list. You can open and modify each of them as you see any fit.

You can find more details on the optimization results here

Solution

Optimization Parameters

This use case is very specific because it requires using of many parameters. When modeling the route and estimating its cost-effciency, you may want to pay special attention to the following parameters:

Route Parameters:

ParameterTypeDescription
mpgfloatMiles per gallon
gas_pricefloatMiles per gallon
vehicle_capacityintegerHow much cargo can the vehicle carry (cubic meters)
vehicle_max_cargo_weightfloatMaximum weight vehicle can carry
vehicle_max_cargo_volumefloatMaximum cargo volume vehicle can carry
vehicle_max_distance_miintegerMax distance for a single vehicle in this route (always in miles)
subtour_max_revenuefloatMaximum revenue amount from subtour
partsintegerQuantity of the subtours (route parts)
parts_minintegerMinimum quantity of the subtours
max_tour_sizeintegerMaximum quantity of the destinations on a subtour
min_tour_sizeintegerMinimum quantity of the destinations on a subtour

Addresses:

ParameterTypeDescription
weightfloatCargo (package) weight
costfloatService cost for the destination
revenuefloatService reveniu from the destination
cubeintegerCargo (package) volume (cubic meters)
piecesintegerQuantity of the cargo (package) pieces
Note
If your users/drivers are collecting COD (Cash on Delivery), you may want to be sure they do not accumulate more than a certain amount of cash for the route. If you set a maximum of $10,000 in revenue per route, drivers will never be routed to customers where they can exceed total aggregated revenue for the entire route.

Create an Optimization

You can create new optimization for this use case. From the cUrl example bellow you can see that:

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_multi_driver_no_tw_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), with several generated routes.

View the Optimization details

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 SET url=https://www.route4me.com/api.v4/optimization_problem.php
3 SET apikey=11111111111111111111111111111111
4 SET optprobid=C2831D56008E8F6EA5B8FFDEA11883AF
5 
6 ECHO ON
7 curl -o file1.txt -g -X GET -k "%URL%?api_key=%apikey%&optimization_problem_id=%optprobid%"
8 
9 timeout /t 30

See sample RESPONSE JSON data here

System will send a RESPONSE with an array of the addresses which belongs to 11 generated routes.

"optimization_problem_id": "C2831D56008E8F6EA5B8FFDEA11883AF"
"route_id": "0AE877849C7F45A24B4D19BAC459895C"
"route_id": "1D866267B57AA9FC35D3B2797E14CD51"
"route_id": "23E4A452491D4AE6929DA07B080F0845"
"route_id": "4B3431CDBFECD1A6949C9C9B8475F5A3"
"route_id": "4D674B5A0759B0BC6FCE5B6160FBE5F4"
"route_id": "662A22F8821F3283F2663F7B1B055FB8"
"route_id": "6BD568797050B2AA355CC107D1400226"
"route_id": "900320428AF484F243EEEEA55561D425"
"route_id": "C1D8642253B7B7C52B909961F71E0A67"
"route_id": "E6C755FBF0D34F8EB50FDAA7FC5EEB70"
"route_id": "E9215F86ED134496A33C50BBD6AFC433"

Details of the Optimized Routes

You can get more details of these routes (see below the one route example, you can also get details of the rest 10 routes using the same method by adjusting 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 SET url=https://www.route4me.com/api.v4/route.php
3 SET apikey=11111111111111111111111111111111
4 SET routeid=0AE877849C7F45A24B4D19BAC459895C
5 SET rpo=Points
6 
7 ECHO ON
8 
9 curl -o file1.txt -g -k -X GET "%url%?route_id=%routeid%&api_key=%apikey%&route_path_output=%rpo%"
10 
11 timeout /t 30

See sample RESPONSE JSON data here

Note
System will send a RESPONSE with an array of the fields path_to_next. Those will be used to draw routes on a map, exactly as they generated by Route4Me API.

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

You can draw all 11 generated routes as:

Estimating of the Routes

You can analyze the generated routes.

Route_idTrip DistanceTravel TimeService TimeRoute CostRoute RevenueNet Revenue
0AE877849C7F45A24B4D19BAC459895C15.150:33:070:31:40831615.15
1D866267B57AA9FC35D3B2797E14CD517.50:22:210:40:00721459.73
23E4A452491D4AE6929DA07B080F084511.510:29:080:40:00931777.3
4B3431CDBFECD1A6949C9C9B8475F5A39.10:30:510:28:20851689.12
4D674B5A0759B0BC6FCE5B6160FBE5F46.770:17:120:50:009418112.85
662A22F8821F3283F2663F7B1B055FB827.611:05:211:15:001362835.32
6BD568797050B2AA355CC107D140022618.580:36:530:25:00661313.5
900320428AF484F243EEEEA55561D42500:00:000:20:001202400
C1D8642253B7B7C52B909961F71E0A6714.260:38:441:01:401172348.2
E6C755FBF0D34F8EB50FDAA7FC5EEB708.110:20:220:45:00811619.86
E9215F86ED134496A33C50BBD6AFC4337.710:17:310:25:007815710.25
TOTALS126.35:11:307:21:4010252038
Note
Net Revenue is a route net revenue per distance unit. Travel Time and Service Time are in hh:mm:ss format.

Resolve the Failed Route Problem

Let's model another configuration of the routes. You can notice that one route has null Travel Time value. If you inspect route data file (see the file here), you'll notice that this route is missing path_to_next parameters. That means you can't draw it on a map as Route4Me API direct output, but you can connect the addresses of this route by other engine (for example, using OSM engine). You can see this route on a map as:

You can draw and estimate routes #2 and #4 on the map as well:

As you may notice that it's possible to move selected destination from the route #8 to route #4. 3 other destinations of the route #8 move to route #2. Finally you can remove failed route #8.

The endpoint: https://www.route4me.com/actions/route/move_route_destination.php

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
route_id string Route ID GET
to_route_id string Recipient Route ID POST
to_route_id string Recipient route ID POST
route_destination_id integer Route destination ID to be moved POST
after_destination_id integer Route destination ID in recipent route after which will be inserted moved destination POST


Move the destination (route_destination_id = 188936049) to #4 route

1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/actions/route/move_route_destination.php
4 SET apikey=11111111111111111111111111111111
5 
6 :: address recipient route ID
7 SET trid=4B3431CDBFECD1A6949C9C9B8475F5A3
8 
9 :: The destination to be moved - address "434 N 26TH STREET #2, Louisville, KY, 40212" in the route "4B3431CDBFECD1A6949C9C9B8475F5A3", sequence # = 2
10 SET rdi=188936049
11 
12 :: ID of the destination in recipient route, after which the moved destination should be inserted. "117 FOUNT LANDING CT, Louisville, KY, 40212"
13 SET adi=188936068
14 
15 ECHO ON
16 
17 curl -o file1.txt -g -X POST -k -H "Content-Type: multipart/form-data;" -F "to_route_id=%trid%" -F "route_destination_id=%rdi%" -F "after_destination_id=%adi%" "%url%?api_key=%apikey%"
18 
19 timeout /t 30

You can expect this API response:

{
"success":true
}

Move the destinations (route_destination_id = 188936025,188936050,188936065) to #2 route

1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/actions/route/move_route_destination.php
4 SET apikey=11111111111111111111111111111111
5 
6 :: address recipient route ID
7 SET trid=1D866267B57AA9FC35D3B2797E14CD51
8 
9 SET rdi_1=188936025
10 SET rdi_3=188936050
11 SET rdi_4=188936065
12 
13 SET adi_3=188936078
14 
15 SET adi_1=188936051
16 SET adi_4=188936025
17 
18 ECHO ON
19 
20 curl -o file3.txt -g -X POST -k -H "Content-Type: multipart/form-data;" -F "to_route_id=%trid%" -F "route_destination_id=%rdi_3%" -F "after_destination_id=%adi_3%" "%url%?api_key=%apikey%"
21 
22 START /WAIT curl -o file1.txt -g -X POST -k -H "Content-Type: multipart/form-data;" -F "to_route_id=%trid%" -F "route_destination_id=%rdi_1%" -F "after_destination_id=%adi_1%" "%url%?api_key=%apikey%"
23 
24 START /WAIT curl -o file4.txt -g -X POST -k -H "Content-Type: multipart/form-data;" -F "to_route_id=%trid%" -F "route_destination_id=%rdi_4%" -F "after_destination_id=%adi_4%" "%url%?api_key=%apikey%"
25 
26 timeout /t 30

You can expect this API response:

{
"success":true
}

You can run script for getting the details of the optimization problem (see the response JSON file here) and check that the problematic #8 route has no addresses anymore.

Remove empty #8 route

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

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
route_id string Route ID GET


1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/route.php
4 SET apikey=11111111111111111111111111111111
5 SET "routeid=900320428AF484F243EEEEA55561D425"
6 
7 ECHO ON
8 
9 :: Example demonstrates the process of deleting specified routes by ids sent with HTTP DELETE data
10 
11 curl -o file1.txt -g -k -X DELETE "%url%?api_key=%apikey%&route_id=%routeid%"
12 
13 timeout /t 30

You can expect this API response:

{
"deleted": true,
"route_id": "900320428AF484F243EEEEA55561D425",
"route_ids": ["900320428AF484F243EEEEA55561D425"]
}

You can run script again for getting the details of the optimization problem (see the response JSON file here) and check that the problematic route doesn't exist anymore and there are only 10 routes available in the optimization problem.

Get details of the #2 and #4 routes

You can run the script described above for getting the route details and inspect route #2 (see the response JSON file here) and route #4 (see the response JSON file here).

Routes #2 and #4 can be drawn on the map as:

Let us estimate the routes again:

Route_idTrip DistanceTravel TimeService TimeRoute CostRoute RevenueNet Revenue
0AE877849C7F45A24B4D19BAC459895C15.150:33:070:31:40831615.15
1D866267B57AA9FC35D3B2797E14CD518.970:27:250:55:0016232518.17
23E4A452491D4AE6929DA07B080F084511.510:29:080:40:00931777.3
4B3431CDBFECD1A6949C9C9B8475F5A39.630:32:460:33:2011522811.73
4D674B5A0759B0BC6FCE5B6160FBE5F46.770:17:120:50:009418112.85
662A22F8821F3283F2663F7B1B055FB827.611:05:211:15:001362835.32
6BD568797050B2AA355CC107D140022618.580:36:530:25:00661313.5
C1D8642253B7B7C52B909961F71E0A6714.260:38:441:01:401172348.2
E6C755FBF0D34F8EB50FDAA7FC5EEB708.110:20:220:45:00811619.86
E9215F86ED134496A33C50BBD6AFC4337.710:17:310:25:007815710.25
TOTALS128.35:18:297:21:4010252038
Previous TOTALS126.35:11:307:21:4010252038

At first glance it seems that last configuration is less cost-efficient than the previous one. That is because the data of the failed route #8 was inserted into the new route configuration. If #8 route were correct one (see calculations in this folder), there would have been the following data:

Route_idTrip DistanceTravel TimeService TimeRoute CostRoute RevenueNet RevenueFuelFuel Cost
900320428AF484F243EEEEA55561D4255.020:14:370:20:0012024025.90.51.0

Having the the Route Cost And Route Revenue were presented in failed route's row too, you can conclude that you may create a more cost-effective routes' configuration by moving some of destinations.

Change Routes' Parameters

Let us change route's parameters and analyze results.

As it was described above, all routes have similar parameters:

Route IDmpggas pricevehicle capacityvehicle max cargo weightvehicle max cargo volumevehicle max distance misubtour max revenuepartsparts minmax tour sizemin_ tour size
All routes10220351509999910000101912

You can set different values for different routes:

Route IDmpggas pricevehicle capacityvehicle max cargo weightvehicle max cargo volumevehicle max distance misubtour max revenuepartsparts minmax tour sizemin_ tour size
0AE877849C7F45A24B4D19BAC459895C10220351509999910000101912
1D866267B57AA9FC35D3B2797E14CD5110220351509999910000101912
23E4A452491D4AE6929DA07B080F084512225452009999910000101912
4B3431CDBFECD1A6949C9C9B8475F5A318240603508000010000101912
4D674B5A0759B0BC6FCE5B6160FBE5F410220351509999910000101912
662A22F8821F3283F2663F7B1B055FB810220351509999910000101912
6BD568797050B2AA355CC107D140022610215251009999910000101912
C1D8642253B7B7C52B909961F71E0A671021035809999910000101912
E6C755FBF0D34F8EB50FDAA7FC5EEB7010220351509999910000101912
E9215F86ED134496A33C50BBD6AFC43310220351509999910000101912

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

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
route_id string Route ID GET
Route Parameters object Valid JSON object string. Click here to see the JSON Schema GET
Addresses array Valid JSON string of the Address objects. Click here to see the JSON Schema GET


See sample INPUT JSON data here

1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/route.php
4 SET apikey=11111111111111111111111111111111
5 SET routeid=4B3431CDBFECD1A6949C9C9B8475F5A3
6 SET opt_type=Time
7 SET disable_optimization=0
8 
9 ECHO ON
10 
11 curl -o file1.txt -g -k -X PUT -H "Content-Type: application/json" -d "@update_route_data.json" "%url%?api_key=%apikey%&route_id=%routeid%&disable_optimization=%disable_optimization%&optimize=%opt_type%"
12 
13 timeout /t 30

See sample RESPONSE JSON data here

You can repeat above described steps for all the routes to be changed.

Changing the Details of a Specific Destination

You can change the details of a specific address and reoptimize a route, for example, you can change sequence of a destination.

Manually re-sequence the destinations

Let us manually re-sequence destinations of the 1-st route:

The selected destination has sequence number 6. Let's set it to 1.

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

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
route_id string Route ID GET
route_destination_id integer Route destination ID GET
Addresses array Valid JSON string of the Address objects with defined sequence_no. Click here to see the JSON Schema GET


See sample INPUT JSON data here

1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/route.php
4 SET apikey=11111111111111111111111111111111
5 SET routeid=F9B6621815ED4E8A577ECE701123E4B4
6 SET routedestinationid=188936066
7 
8 ECHO ON
9 
10 curl -o file1.txt -g -k -X PUT -H "Content-Type: application/json" -d "@update_address_sequence_in_route_data.json" "%url%?api_key=%apikey%&route_id=%routeid%&route_destination_id=%routedestinationid%"
11 
12 timeout /t 30

See sample RESPONSE JSON data here

Change parameters of destination

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

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
route_id string Route ID GET
route_destination_id integer Route destination ID GET
Address object Valid JSON string of an Address object with defined parameters Click here to see the JSON Schema GET


See sample INPUT JSON data here

1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/address.php
4 
5 SET apikey=11111111111111111111111111111111
6 SET routeid=5EE1E2D1B6E36792194FAF3369BC0C87
7 SET routedestinationid=188936088
8 
9 ECHO ON
10 
11 curl -o file1.txt -g -k -X PUT -H "Content-Type: application/json" -d "@update_route_destination_parameters_data.json" "%url%?api_key=%apikey%&route_id=%routeid%&route_destination_id=%routedestinationid%"
12 
13 timeout /t 30

See sample RESPONSE JSON data here

Pay attention to these parameters in the response file:

"weight": 3,
"cost": 20,
"revenue": 45,
"cube": 2,
"pieces": 6

Re-optimize the Optimization Problem

Now you can reoptimize the optimization problem.

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

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
optimization_problem_id string Optimization problem ID GET
reoptimize integer If equal to 1, the optimization problem will be reoptimized GET
Route Parameters object Valid JSON object string. Click here to see the JSON Schema GET
Addresses array Valid JSON string of the Address objects. Click here to see the JSON Schema GET


Note
After re-optimization the parameter route_id of the routes could be changed.
1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/optimization_problem.php
4 SET apikey=11111111111111111111111111111111
5 SET optprobid=C2831D56008E8F6EA5B8FFDEA11883AF
6 
7 ECHO ON
8 curl -o file1.txt -g -X PUT -k "%url%?api_key=%apikey%&optimization_problem_id=%optprobid%&reoptimize=1"
9 
10 timeout /t 30

See sample RESPONSE JSON data here

Review the Remodeling Results

You can do above described steps:

  • View the Optimization details (See sample RESPONSE JSON data here);
  • Details of the Optimized Routes (see get_route_path_points_2_RESPONSE_1.json ... get_route_path_points_2_RESPONSE_11.json files in the folder here);
  • Estimating of the Routes.

Please find below the new set of cost-efficiency indicators of the generated routes:

Route_idTrip DistanceTravel TimeService TimeRoute CostRoute RevenueNet Revenue
0B1302EC7CA8FE18C10E9F68A8B485693.940:13:570:20:0012024023.58
22E89AA01D3206E66B1A32FF598F5D698.110:20:220:45:00811619.86
5EE1E2D1B6E36792194FAF3369BC0C877.710:17:310:25:008016711.28
74799314B572E6381A0AB7D42853FBFE27.611:05:211:15:001362835.32
804CA996C1EDBA5128FBD3F67911760918.580:36:530:25:00661313.5
87E9ECECE85254BBFAF4598F57DB077D11.510:29:080:40:00931777.3
9C27B15CD6AC75B6305FD4B70BE321E514.260:38:441:01:401172348.2
9C4BEEF6CC691FC36FB5616E6609D4BF9.10:30:510:28:20851689.12
9C62E1C31DEE49291DFA308517EF5D2B6.770:17:120:50:009418112.85
C1CF10FBE454541E0A26FAD5F89762AE7.50:22:210:40:00721459.73
F9B6621815ED4E8A577ECE701123E4B47.480:17:250:31:408316110.43
TOTALS122.575:09:457:21:4010272048
Previous TOTALS128.35:18:297:21:4010252038
Previous Previous TOTALS126.35:11:307:21:4010252038

As you can conclude from the table above, finally we got the most cost-efficient configuration of the routes.