TransWikia.com

HERE Fleet Telematics API doesn't really optimize cost

Stack Overflow Asked by Orest on February 16, 2021

According to the official documentation:

Specify the parameter &rollups instead of &rollup, and don’t specify &cost_optimize, to get the route computed within Fleet Telematics API. Fleet Telematics API ignores the shortest/fastest in the mode parameter. Instead, it minimizes the sum of driver_cost, vehicle_cost and toll cost. This yields fully cost optimized routes

But in fact it’s not what I observe after testing. I’ve tried route from Lviv to Berlin, I’ve set driver_cost to 100 euro and vehicle_cost to 0. I received the route which takes 20 hours and costs 43 euros (toll roads). This is not optimal route as the driver cost is really high – 2000 euro.

If I add cost_optimize=0 and change rollups to rollup (which should turn off cost optimization) as a parameter to request I receive bit more expensive route, in terms of toll roads – 54 euro, but the duration is 13 hours, which gives 1300 euro driver cost and lower overall cost.

How so? Is this some kind of a bug?

P.S. I’ve been using official examples to double check my results e.g. this

One Answer

This is the (rather weird) full section of the documentation:

Specify the parameter &rollup and/or &cost_optimize to get the route calculated by Routing API. Routing API itself doesn't cost/toll optimize, but provides a fastest and a shortest route and some more routes with different options. Fleet Telematics API then chooses the route which has the minimum sum of driver_cost, vehicle_cost and toll cost. Hence, a (toll)cost optimized route is usually found, but it is not always guaranteed.

Specify the parameter &rollups instead of &rollup, and don't specify &cost_optimize, to get the route computed within Fleet Telematics API. Fleet Telematics API ignores the shortest/fastest in the mode parameter. Instead, it minimizes the sum of driver_cost, vehicle_cost and toll cost. This yields fully cost optimized routes (within the limitation that routing doesn't consider smallest roads when very far away from way points). But doesn't support all Routing API parameters and can show higher response times.

It says that there's two optimisation engines, one (Fleet Telematics API) that should find the optimal route, one (Routing API) than "usually" (but not always) finds the optimal route. And you need to define tollVehicleType in both cases.

In your first test, if you have cost_optimize=1, it's either the R-API or no optimization (you don't provide your request, so I can't tell). In your second test, I think you're just asking for the fastest route. If you want the FT-API, you have to remove the cost_optimize parameter and use rollups, not rollup.

Answered by Ilya on February 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP