Open SuwonLee-KMU opened 2 years ago
Hi Suwon Lee,
nice to learn that you have found VeRyPy.
I added an example script to illustrate .vrp file generation. I had used this script to convert van Breedam VRP problem instances to TSPLIB95 .vrp format. As you can see, the script can be used as an outline for your own .vrp writer. One can encode full distance matrices in .vrp files. See the TSPLIB95 specification for details.
However, if you already have the data in a format that you can provide the distance matrix as a Numpy 2D matrix D and the demands as a Python list d, you can also use the VeRyPy Python API to solve the problems without going through the .vrp file format. There is few alternatives on how to do that. If you want to run only one algorithm, use that init-function directly (e.g., Clarke and Wright savings implementation). Or, if you want to try to solve the problem using all of the algorithms in VeRyPy, one can just pickle problem instance details to a .pickle file using Python pickle module. This is not well documented feature, but VeRyPy is capable of reading such pickled problems (see the relevant code).
VeRyPy reader expects following tuple inside the pickle file:
(N, points, dd_points, **d, D, C**, ewt, K, L, st)
,
Note that only the bold entries are required, others can be None
. Detailed explanations:
N
is the number of customers, (not necessary)points
is None
or the coordinates of the depot (index 0) and customers (index >0).dd_points
is None
or the display coordinates (usually None)d
is a Python list of demands with d[0]=0
as it is the depot.D
is a Numpy 2D matrix of distances, one has to give this!C
is the scalar value of the vehicle capacity (all vehicles have the same capacity)ewt
is for a very special case. Can be anything or 'EXPLICIT'
.
Following three are additonal constraintsK
number of vehicles, can be None
as it is (mostly) ignoredL
maximum route length/duration constraint using the same distance/time measure as D
, usually None
st
stopping times (or parking drive distance) at each customer (same for all), usually None
Hello,
I found an example script which imports a .vrp format file and returns the optimal routing result in this repo.
I want to know how can I write the .vrp file as I want. That is, I want to specify customer nodes positions and so on. Actually, I have opened the .vrp file with a text editor, and I don't understand the syntax.
When I google it with some keywords like
vrp file expansions syntax
but I cannot reach what I want.Thank you in advance!