2

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

Orest
  • 1,857
  • 5
  • 19
  • 27

1 Answers1

0

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.

Ilya
  • 5,377
  • 2
  • 18
  • 33
  • 1
    The doc doesn't say "put cost_optimize=0 instead of 1", it says "remove the cost_optimize parameter", so I'm not sure what "cost_optimize=0" does. In any case, if you have "rollup" it's either R-API cost-optimization, or shortest, or fastest. For FT-API it's *both* rollups and no cost_optimize. – Ilya Dec 21 '20 at 20:14
  • Please read my original post more carefully. With cost_optimize=0 and rollup instead of rollups I receive cheaper route, which is absurd – Orest Dec 22 '20 at 22:48
  • I didn't say that the result you get is right or wrong (or absurd). I said that according to the documentation, I can't tell what you're asking for in the first case because you're not providing your exact request. Your post doesn't even says if you're using "cost_optimize=1" or "tollVehicleType", and anyway if it's the Route API there's no guarantee it's the optimal route, FT-API can do better as it is an entirely other engine. – Ilya Jan 02 '21 at 14:25