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.
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:
Parameter | Type | Description |
---|---|---|
mpg | float | Miles per gallon |
gas_price | float | Miles per gallon |
vehicle_capacity | integer | How much cargo can the vehicle carry (cubic meters) |
vehicle_max_cargo_weight | float | Maximum weight vehicle can carry |
vehicle_max_cargo_volume | float | Maximum cargo volume vehicle can carry |
vehicle_max_distance_mi | integer | Max distance for a single vehicle in this route (always in miles) |
subtour_max_revenue | float | Maximum revenue amount from subtour |
parts | integer | Quantity of the subtours (route parts) |
parts_min | integer | Minimum quantity of the subtours |
max_tour_size | integer | Maximum quantity of the destinations on a subtour |
min_tour_size | integer | Minimum quantity of the destinations on a subtour |
Addresses:
Parameter | Type | Description |
---|---|---|
weight | float | Cargo (package) weight |
cost | float | Service cost for the destination |
revenue | float | Service reveniu from the destination |
cube | integer | Cargo (package) volume (cubic meters) |
pieces | integer | Quantity 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:
- the endpoint for this task is: https://www.route4me.com/api.v4/optimization_problem.php
- input data is stored in the file single_depot_multi_driver_no_tw_data.json
Parameter | Type | Description |
---|---|---|
api_key | string | API KEY of the user |
input data | POST data | Valid JSON object string. Click here to see the JSON Schema |
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
Attribute | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
optimization_problem_id | string | Optimization problem ID | GET |
See sample RESPONSE JSON data here
System will send a RESPONSE with an array of the addresses which belongs to 11 generated routes.
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
Attribute | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
route_id | string | Route ID | GET |
route_path_output | string | If equal to 'Poitns', you'll get an array of the path points to next address | GET |
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_id | Trip Distance | Travel Time | Service Time | Route Cost | Route Revenue | Net Revenue |
---|---|---|---|---|---|---|
0AE877849C7F45A24B4D19BAC459895C | 15.15 | 0:33:07 | 0:31:40 | 83 | 161 | 5.15 |
1D866267B57AA9FC35D3B2797E14CD51 | 7.5 | 0:22:21 | 0:40:00 | 72 | 145 | 9.73 |
23E4A452491D4AE6929DA07B080F0845 | 11.51 | 0:29:08 | 0:40:00 | 93 | 177 | 7.3 |
4B3431CDBFECD1A6949C9C9B8475F5A3 | 9.1 | 0:30:51 | 0:28:20 | 85 | 168 | 9.12 |
4D674B5A0759B0BC6FCE5B6160FBE5F4 | 6.77 | 0:17:12 | 0:50:00 | 94 | 181 | 12.85 |
662A22F8821F3283F2663F7B1B055FB8 | 27.61 | 1:05:21 | 1:15:00 | 136 | 283 | 5.32 |
6BD568797050B2AA355CC107D1400226 | 18.58 | 0:36:53 | 0:25:00 | 66 | 131 | 3.5 |
900320428AF484F243EEEEA55561D425 | 0 | 0:00:00 | 0:20:00 | 120 | 240 | 0 |
C1D8642253B7B7C52B909961F71E0A67 | 14.26 | 0:38:44 | 1:01:40 | 117 | 234 | 8.2 |
E6C755FBF0D34F8EB50FDAA7FC5EEB70 | 8.11 | 0:20:22 | 0:45:00 | 81 | 161 | 9.86 |
E9215F86ED134496A33C50BBD6AFC433 | 7.71 | 0:17:31 | 0:25:00 | 78 | 157 | 10.25 |
TOTALS | 126.3 | 5:11:30 | 7:21:40 | 1025 | 2038 |
- 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
You can expect this API response:
Move the destinations (route_destination_id = 188936025,188936050,188936065) to #2 route
You can expect this API response:
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 |
You can expect this API response:
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_id | Trip Distance | Travel Time | Service Time | Route Cost | Route Revenue | Net Revenue |
---|---|---|---|---|---|---|
0AE877849C7F45A24B4D19BAC459895C | 15.15 | 0:33:07 | 0:31:40 | 83 | 161 | 5.15 |
1D866267B57AA9FC35D3B2797E14CD51 | 8.97 | 0:27:25 | 0:55:00 | 162 | 325 | 18.17 |
23E4A452491D4AE6929DA07B080F0845 | 11.51 | 0:29:08 | 0:40:00 | 93 | 177 | 7.3 |
4B3431CDBFECD1A6949C9C9B8475F5A3 | 9.63 | 0:32:46 | 0:33:20 | 115 | 228 | 11.73 |
4D674B5A0759B0BC6FCE5B6160FBE5F4 | 6.77 | 0:17:12 | 0:50:00 | 94 | 181 | 12.85 |
662A22F8821F3283F2663F7B1B055FB8 | 27.61 | 1:05:21 | 1:15:00 | 136 | 283 | 5.32 |
6BD568797050B2AA355CC107D1400226 | 18.58 | 0:36:53 | 0:25:00 | 66 | 131 | 3.5 |
C1D8642253B7B7C52B909961F71E0A67 | 14.26 | 0:38:44 | 1:01:40 | 117 | 234 | 8.2 |
E6C755FBF0D34F8EB50FDAA7FC5EEB70 | 8.11 | 0:20:22 | 0:45:00 | 81 | 161 | 9.86 |
E9215F86ED134496A33C50BBD6AFC433 | 7.71 | 0:17:31 | 0:25:00 | 78 | 157 | 10.25 |
TOTALS | 128.3 | 5:18:29 | 7:21:40 | 1025 | 2038 | |
Previous TOTALS | 126.3 | 5:11:30 | 7:21:40 | 1025 | 2038 |
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_id | Trip Distance | Travel Time | Service Time | Route Cost | Route Revenue | Net Revenue | Fuel | Fuel Cost |
---|---|---|---|---|---|---|---|---|
900320428AF484F243EEEEA55561D425 | 5.02 | 0:14:37 | 0:20:00 | 120 | 240 | 25.9 | 0.5 | 1.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 ID | mpg | gas price | vehicle capacity | vehicle max cargo weight | vehicle max cargo volume | vehicle max distance mi | subtour max revenue | parts | parts min | max tour size | min_ tour size |
---|---|---|---|---|---|---|---|---|---|---|---|
All routes | 10 | 2 | 20 | 35 | 150 | 99999 | 10000 | 10 | 1 | 91 | 2 |
You can set different values for different routes:
Route ID | mpg | gas price | vehicle capacity | vehicle max cargo weight | vehicle max cargo volume | vehicle max distance mi | subtour max revenue | parts | parts min | max tour size | min_ tour size |
---|---|---|---|---|---|---|---|---|---|---|---|
0AE877849C7F45A24B4D19BAC459895C | 10 | 2 | 20 | 35 | 150 | 99999 | 10000 | 10 | 1 | 91 | 2 |
1D866267B57AA9FC35D3B2797E14CD51 | 10 | 2 | 20 | 35 | 150 | 99999 | 10000 | 10 | 1 | 91 | 2 |
23E4A452491D4AE6929DA07B080F0845 | 12 | 2 | 25 | 45 | 200 | 99999 | 10000 | 10 | 1 | 91 | 2 |
4B3431CDBFECD1A6949C9C9B8475F5A3 | 18 | 2 | 40 | 60 | 350 | 80000 | 10000 | 10 | 1 | 91 | 2 |
4D674B5A0759B0BC6FCE5B6160FBE5F4 | 10 | 2 | 20 | 35 | 150 | 99999 | 10000 | 10 | 1 | 91 | 2 |
662A22F8821F3283F2663F7B1B055FB8 | 10 | 2 | 20 | 35 | 150 | 99999 | 10000 | 10 | 1 | 91 | 2 |
6BD568797050B2AA355CC107D1400226 | 10 | 2 | 15 | 25 | 100 | 99999 | 10000 | 10 | 1 | 91 | 2 |
C1D8642253B7B7C52B909961F71E0A67 | 10 | 2 | 10 | 35 | 80 | 99999 | 10000 | 10 | 1 | 91 | 2 |
E6C755FBF0D34F8EB50FDAA7FC5EEB70 | 10 | 2 | 20 | 35 | 150 | 99999 | 10000 | 10 | 1 | 91 | 2 |
E9215F86ED134496A33C50BBD6AFC433 | 10 | 2 | 20 | 35 | 150 | 99999 | 10000 | 10 | 1 | 91 | 2 |
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
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
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
See sample RESPONSE JSON data here
Pay attention to these parameters in the response file:
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.
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_id | Trip Distance | Travel Time | Service Time | Route Cost | Route Revenue | Net Revenue |
---|---|---|---|---|---|---|
0B1302EC7CA8FE18C10E9F68A8B48569 | 3.94 | 0:13:57 | 0:20:00 | 120 | 240 | 23.58 |
22E89AA01D3206E66B1A32FF598F5D69 | 8.11 | 0:20:22 | 0:45:00 | 81 | 161 | 9.86 |
5EE1E2D1B6E36792194FAF3369BC0C87 | 7.71 | 0:17:31 | 0:25:00 | 80 | 167 | 11.28 |
74799314B572E6381A0AB7D42853FBFE | 27.61 | 1:05:21 | 1:15:00 | 136 | 283 | 5.32 |
804CA996C1EDBA5128FBD3F679117609 | 18.58 | 0:36:53 | 0:25:00 | 66 | 131 | 3.5 |
87E9ECECE85254BBFAF4598F57DB077D | 11.51 | 0:29:08 | 0:40:00 | 93 | 177 | 7.3 |
9C27B15CD6AC75B6305FD4B70BE321E5 | 14.26 | 0:38:44 | 1:01:40 | 117 | 234 | 8.2 |
9C4BEEF6CC691FC36FB5616E6609D4BF | 9.1 | 0:30:51 | 0:28:20 | 85 | 168 | 9.12 |
9C62E1C31DEE49291DFA308517EF5D2B | 6.77 | 0:17:12 | 0:50:00 | 94 | 181 | 12.85 |
C1CF10FBE454541E0A26FAD5F89762AE | 7.5 | 0:22:21 | 0:40:00 | 72 | 145 | 9.73 |
F9B6621815ED4E8A577ECE701123E4B4 | 7.48 | 0:17:25 | 0:31:40 | 83 | 161 | 10.43 |
TOTALS | 122.57 | 5:09:45 | 7:21:40 | 1027 | 2048 | |
Previous TOTALS | 128.3 | 5:18:29 | 7:21:40 | 1025 | 2038 | |
Previous Previous TOTALS | 126.3 | 5:11:30 | 7:21:40 | 1025 | 2038 |
As you can conclude from the table above, finally we got the most cost-efficient configuration of the routes.