-
Notifications
You must be signed in to change notification settings - Fork 43
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
Time windows error and use all vehicles #117
Comments
The following point now is the one that most generates me doubts:
However, the real problem comes when I use |
Hi @orlandoandradeb, thanks for your feedback.
That seems right to me.
Would you have a minimal working example so that we can reproduce the issue ? Are you sure the problem is actually feasible when you do this ?
Note sure I understand your question. The time windows should be entered as described here. Note that we are currently dealing with an issue with the time windows #101.
If you have a minimal working example it would help. But are you sure the solution is suboptimal ? A safe option is to run the code with ortools which is more robust. |
Hello @Kuifje02 thank you for your answer. I will put an example of the data and code here..... The duration matrix that I generate has the following structure, it is in hours. Additionally, in this example I just selected 30 nodes or clients to visit: My lower and upper time windows have the following structure: Lower (with a length of 31 and all nodes with value of 7 simulating 7 am): Upper time windows with a length of 30 and all nodes with a value of 17 simulating 5:00 pm Both impedance matrices I transform to an array in order to use it in the set up of the network which has the following code:
Visualization of the network created: Execution 1 of the model without restrictions:
Results total distances in km and stops sequence: As it can be observed here there is no problem. It tells me 1 vehicle to all the stops Execution 2 of the model with a maximum of stops per vehicle
Results of total distance (km) and sequence of stops: As it can be observed in this case all works good too. The restriction was maximum 10 stops and was there were 30 nodes to visit, so the model proposed the use of 3 vehicles. Execution 3 of the model with time windows = true
Here is where the problem starts. The model that it generates suggest 12 vehicles: In theory, in this case, I would expect that suggestion of just 1 vehicle as it was seem in execution 1 because there are 30 stops and they can be visited with 1 vehicle in the period of time from 7 am to 5 pm, maximum with 2 vehicles. So I don't know if this is an internal problem or maybe it's because of the units, that is why my doubt about the units of the travel time matrix and the upper and lower time windows array. Execution 4 of the model with time windows = true and maximum stops
When I run it with time_windows=true and num_stops= n it generates a better model BUT it still suggests many vehicles. In this case 10 vehicles. I would wait that it suggest 3 vehicles because the maximum of stops is 10 and the total clients are 30. I think that the problem can be in the units or some internal problem in the function. I hope you can help me. Best regards, |
I run now a code with duration which reading the documentation I understand as a restriction of the total time that the vehicle gives service. I give a value of 1 representing 1 hour of service.
In this case, It generates a suggestion of 1 vehicle that I think that is not possible due to 1 vehicle is not going to visit 30 clients in 1 hour. If I add a drop penalty of 5 minutes that in hours will be 0.083 it just don't generate nothing:
In general terms, all the errors that I have show up when I involve time |
Hello @Kuifje02 Did you get a chance to see it? Thank you! |
Hello @orlandoandradeb, not yet. Will do as soon as I find some time. |
@Kuifje02 Thank you ! |
Hi @orlandoandradeb, |
Hello @Kuifje02 Thank you for you answer. I will send you the code, I am working on it to make it smaller and easy to navigate on it, is it ok if I share it with you tomorrow? Best regards, |
I just started to use Vrpy library. I used some of the examples that are in the documentation successfully. In order to generate my own scenarios, I am using Open Route Services to generate the impedance matrix of distance and duration. Using this I have run successfully some cases without time windows restrictions.
However, now that I added this restriction some errors start to appear. I have the following doubts:
Units of the travel matrix and time windows restriction: I assume that these two variables must be in the same units. I generate my travel time matrix in seconds and then pass to hours and the arrays of lower and upper time windows I put it in hours too (now is lower 7 and upper 17 representing 7 am and 17 pm for all the nodes).
When I run my code without time restrictions it works well, when I do it with time restriction but not using a number of vehicles It works more less good. It generates the optimization but it gives me a suggestion of total vehicles very high. In my particular case, there are 45 stops and it suggests 22 vehicles to do the job.
On the other hand, when I add the num_vehicles it simply generates an error " Exception: problem Infeasible"
prob = vrpy.VehicleRoutingProblem(G, time_windows=True, num_vehicles=20, use_all_vehicles=True, num_stops=20) prob.solve(time_limit=30)
I hope someone can help me to understand these mistakes.
Best regards,
Orlando
The text was updated successfully, but these errors were encountered: