Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed number of vehicles #93

Closed
piaulous opened this issue May 17, 2021 · 7 comments
Closed

fixed number of vehicles #93

piaulous opened this issue May 17, 2021 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@piaulous
Copy link

piaulous commented May 17, 2021

Having an option to force the number of vehicles is something I would be interested in.
This could be done by extending the num_vehicles command with something like use_all, or setting up min / max values for the number of vehicles.

@Kuifje02 Kuifje02 self-assigned this May 17, 2021
@Kuifje02 Kuifje02 added the enhancement New feature or request label May 17, 2021
Kuifje02 pushed a commit that referenced this issue Jun 5, 2021
@Kuifje02
Copy link
Owner

Kuifje02 commented Jun 5, 2021

The feature has been added. The argument is called use_all_vehicles (example in the docs here). Will make new relase by tomorow.

@Kuifje02 Kuifje02 closed this as completed Jun 5, 2021
@piaulous
Copy link
Author

piaulous commented Jun 8, 2021

Thank your very much!

@piaulous
Copy link
Author

in some cases I now get an 'empty' route: ['Source', 'Sink']

@Kuifje02
Copy link
Owner

Aha, this is interesting...re opening.

@Kuifje02 Kuifje02 reopened this Jun 30, 2021
@Kuifje02
Copy link
Owner

Kuifje02 commented Jul 5, 2021

Ortools users have ran into this problem already : google/or-tools#1351 :

This is generally a bad idea to add min values to cumul vars (e.g., number of used vehicles).
You can easily run into infeasible problems. It would be better to constraint the max number of visits per vehicle.

If you want to model fairness, it should be reflected in the objective, not in hard constraints.

So @lperron basically suggests 3 options:

  1. Constrain the number of stops per routes in order to force the required number of vehicles. It can be tricky to find this value (the good number of stops).
  2. Use "fairness": minimize the maximum difference of duration between two routes. You can do this with the minimize_global_span argument:
    minimize_global_span (bool, optional):

    But this changes the formulation and may lead to slower convergence.
  3. Add an "empty route" cost. I think this option may be the best (easy to implement, and not a hard constraint).

@Kuifje02 Kuifje02 closed this as completed Jul 5, 2021
@Kuifje02
Copy link
Owner

Kuifje02 commented Jul 5, 2021

We can hard code the use_all option to enforce at least one visit with a warning that it is probably a bad approach and may lead to infeasible configurations. Or add an empty route cost, I think this is the way to go.

@Kuifje02
Copy link
Owner

@piaulous routes ["Source","Sink"] how have a very high cost and should not be part of the solution. I am closing the issue for now. Feel free to re open it if the next release is not satisfactory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants