-
Notifications
You must be signed in to change notification settings - Fork 322
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
Matrix wrapper #57
Comments
Maybe just a hash will do inside the matrix-wrapper class:
At least thats, what has been on my mind for quite some time ... |
Thanks for the input, I guess choosing the way to do it will mostly come down to efficiency. Maybe a simpler filtering might also be sufficient as we "only" want zeros on whole line/columns (https://github.com/VROOM-Project/vroom/blob/master/src/problems/tsp/tsp.cpp#L32-L49). |
If it is only about the zeroes in the diagonal, then yes thats easy to achive: Simply look, if column equal row. |
Now this comes down to not creating a new matrix using vroom/src/problems/tsp/tsp.cpp Line 19 in 897ba57
Costs could be retrieved from the original matrix without a copy by using the indexes matching in Potential concern: I wonder what would be the impact of accessing the original matrix from different threads solving TSP sub-problems in parallel. |
Since the algorithm do not care how the matrix is accessed in the background, i come up with the idea to make The I'm currently implementing the described structure on this branch. |
@PattyDePuh Using I was thinking of just having an object holding a const ref to the original matrix and the list of indices for the sub-problem, as transmitted in the vroom/src/problems/tsp/tsp.cpp Lines 18 to 19 in 87c3091
Then On second though this would not be enough to cover the matrix modifications in the workaround for fixed start/end. After all, I actually wonder if this is worth the trouble for now as it would only impact the TSP code. And we are far from hitting memory/computing times bounds right now, even with big instances. |
The wrapper solution could be implemented easily, if we would abonden the idea to access the matrix with double |
Now that the object model is in place, |
Closing here as I don't think this is worth the trouble for now, especially in the light of the recent code changes introduced by the CVRP approach. |
Currently the
input
class contains all the data to model the problem (jobs, vehicles) and is responsible for computing and storing the matrix.Yet, a copy of the matrix is made at
vroom/src/problems/tsp/tsp.cpp
Line 17 in 9c138af
tsp
instance. This copy is currently mandatory as we don't want to mess the original and as the matrix is modified to handle the forced start and end cases. This comes at a cost on performance and memory requirements, especially for big instances.We should avoid this copy while still allowing the
tsp
class to use a customized version of the matrix, and several different adaptations should be possible (think creating severaltsp
instances to solve sub-problems with different start/end, without copying or modifying the initial matrix).There is probably a good way to do this by designing a wrapper around the current matrix structure. It could hold a reference to the one and only initial matrix and return its values except when start/end adjustments related to a vehicle are to be made.
The text was updated successfully, but these errors were encountered: