reinterpretcat / vrp

A Vehicle Routing Problem solver
https://reinterpretcat.github.io/vrp/
Apache License 2.0
331 stars 68 forks source link

Unexpected behavior of required breaks with time aware matrices #145

Open N0fail opened 3 months ago

N0fail commented 3 months ago

Hi @reinterpretcat I found some unexpected behavior using required breaks. I don't really know if this is a bug, but looks like it. Can you please give a comment if this is expected behavior and why if so. Here is minimal examples of problem, that i could get:

Example 1: Here I define two tasks 3188 and 3189, and I want 3189 to start in a very narrow timewindow before 3188 I get solution using this command: vrp-cli solve pragmatic problem.json -o solution.json --log -m matrix_1.json matrix_2.json And solver is always able to produce solution where all tasks are distributed. example1.zip

Example 2: Next i add a required break for time when vehicle is traveling from task 3189 to 3188 I get solution using this command: vrp-cli solve pragmatic problem.json -o solution.json --log -m matrix_1.json matrix_2.json And solver is always unable to place task 3189, it ends up being unassigned example2.zip But when i am using same matrix twice i get the solution (matrix_1 and matrix_0 are the same) Don't really know if this is correct input, but maybe this is related to the problem. vrp-cli solve pragmatic problem.json -o solution.json --log -m matrix_1.json matrix_0.json

Example 3: Next I try to make timewindow of task 3189 larger I get solution using this command: vrp-cli solve pragmatic problem.json -o solution.json --log -m matrix_1.json matrix_2.json And solver is always able to produce solution where all tasks are distributed. And task 3189 is placed inside it's original narrow timewindow. So it seems that it is possible to place it there with this required break. example3.zip

Some additional context, why I am doing this and what trying to achieve: I am running this solver to redistribute tasks every 30 minutes, to assign new tasks that were added during this 30 minutes. I want some timewindow(TW) of vehicle to be static so tasks in this period must stay on their position between different runs and new tasks should not be added. To achieve this I link tasks in this TW to the vehicle using skills and use narrow task start timewindow for tasks to stay where they are. I also place required breaks in this static TW where there are no tasks being done.