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

Need help on adding Maximum Distance as a constraint. #125

Open
rohitsingh30 opened this issue Mar 22, 2022 · 6 comments
Open

Need help on adding Maximum Distance as a constraint. #125

rohitsingh30 opened this issue Mar 22, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@rohitsingh30
Copy link

Hi,
We are trying to build a network design where we have heterogeneous vehicle combinations with different capacities and costs ($ per km).
Issue 1: However, there is an additional constraint where we want to add maximum distance that a vehicle can travel (similar to duration (int, optional) – Maximum duration of the route. Defaults to None.). We were unable to find any parameter in the API documentation - (https://vrpy.readthedocs.io/en/latest/api.html#api)
Issue 2: Further, can you please help or suggest how to add different maximum distances as a constraint for different vehicle types in the above problem statement
Do let us know if you have any questions about this?

@Kuifje02
Copy link
Owner

Hi,
For issue 1, I suggest you use the maximum duration parameter. You can either convert the distance limit to a time limit, or set the time matrix to the distance matrix, so that the maximum duration refers to the distance matrix.
For issue 2, this is not possible (yet). It would, however, be quite easy to add in a future version.

@Kuifje02 Kuifje02 added the enhancement New feature or request label Mar 22, 2022
@rohitsingh30
Copy link
Author

Cool! For #2, can you give me some high-level guidance on how it can be done? If I succeed, I'll be happy to send a PR!

@Kuifje02
Copy link
Owner

Nice ! The general idea would be to have this paramater as a list, as explained in the docs here.

@rohitsingh30
Copy link
Author

Sorry, I am not able to figure out exactly where I should be looking. While the first function call while building a solution is to the solve() method, the sequence of steps the library follows for building the solution is not clear to me. Can you please provide a high-level overview of the flow/logic?

@ankush981
Copy link

@Kuifje02 I'm stuck with something similar as well. The idea of changing the core sounds daunting (😨) but it might be possible if I have some guidance/direction. 😅

@Kuifje02
Copy link
Owner

Kuifje02 commented Apr 20, 2022

The main idea is to replace the parameter by a list (instead of an integer), just like it is done for the load_capacity parameter :
prob = VehicleRoutingProblem(G, mixed_fleet=True, load_capacity=[10, 15])
So the goal is to have the following:
prob = VehicleRoutingProblem(G, mixed_fleet=True, load_capacity=[10, 15], duration = [50,60])
We need to make sure that the code remains consistent, everywhere where the parameter duration is called. Looking at how it is done for load_ capacity is the best option to get started.

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

3 participants