Closed leonlan closed 11 months ago
I made a start for writing instances.
instance
which attributes should be written?See http://www.bernabe.dorronsoro.es/vrp/index.html?/Problem_Instances/VRPLIBDesc.html for the original VRPLIB descrption.
LKH-3 is very well maintained, so I think it's good to support reading those files as well (perhaps long term but not now?)
The VRPLIB format consists of a problem specification part and a data part.
DEMAND_SECTION
), then $n$ rows of the corresponding data.EOF
.Both for reading and writing files, we should follow the LKH-3 VRPLIB format.
But the Solomon and GH instances on CVRPLIB do not follow the VRPLIB format. What do I want to do with that? The LKH3 instances do follow the VRPLIB format.
https://www.sintef.no/projectweb/top/vrptw/100-customers/
LKH-3 calls this "Sintef solution style"
I have removed the write
module because this wasn't ready yet, and I want to speed up the release of V1. So this is an open issue again.
See this commit for the (removed) write module https://github.com/leonlan/VRPLIB/commit/885f9cce19bb5440a6c4c1ee899754d3b0c42728#diff-6fa8cb67482a47a8390d40bcd32b10d53f6ffd7a723f412d71a486039267557f.
This is periodically useful for the PyVRP instances as well (I'm running into this now with multi-depot VRP). Do you want to be really strict about what's written? A simple dict -> specification/section type writer is easy enough: every value that's iterable becomes a section, and every value that's not becomes a specification. The onus would then be on the user to ensure that data encodes a valid VRPLIB instances, but to be fair, that's on the user anyway when they're writing instances.
Yeah that seems like a good solution to me. I'll try to make this feature later this week.
@N-Wouda I implemented the write_instance
and write_solution
functions. Hopefully, they are useful!
It would be nice to have a function that could also write VRP instances. This was provided in the EURO-NeurIPS competition.