Route solution never uses more than one vehicle

Hi,
I’m using cuOpt for the first time and I’m overall a beginner with routing problems. I have a problem where I have 3 depots and want to service a few hundred clients from them. The main question is which depot to assign to each client, but a good route is great too.

  • I call add_cost_matrix() to set up the map. Everything is accessible from everywhere.
  • I call set_vehicle_locations() to set the depot locations. I set the same 3 locations for start and return locations.
  • I call set_order_locations() to set the client locations.

The solution I get looks nice, but only uses one depot. I realized that the default objective function puts the vehicle count first, so I tried changing that to TRAVEL_TIME or CUMUL_PACKAGE_TIME but it’s still only using one depot.

My preferred objective would be to minimize the maximum of the total cost assigned to a depot. So the depot (vehicle) with the largest cost has as little cost as possible. But I’d be happy with anything that splits up the clients between the vehicles. Why is it only using one vehicle?

The objective function gets used after initial phase where the optimization happens to use minimum vehicles. Since there is no time restriction on when the order needs to be delivered, a single vehicle is being used to deliver all. May be you can try using min_vehicles options. In that case you will get a solution with minimum vehicles being used. Another option would be max cost per vehicle, with which you can limit cost per vehicle.

Awesome, thanks! Check out my routes!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.