ben-hudson / pylkh Goto Github PK
View Code? Open in Web Editor NEWA super simple Python wrapper for the constrained traveling salesman and vehicle routing problem solver LKH-3.
Home Page: https://pypi.org/project/lkh/
License: Other
A super simple Python wrapper for the constrained traveling salesman and vehicle routing problem solver LKH-3.
Home Page: https://pypi.org/project/lkh/
License: Other
I encountered difficulties when dealing with data for solving VRPTW. IndexError: list index out of range for all VRPTW data
Hi,
I'm wondering if it is possible to set a given tour as the initial tour of the solver (e.g., as the first seed) and if it is possible, how can I do that?
Thanks.
Hello,
trying to solve m-pdtsp( and m1_pdtsp) instances I run into the error: "ParsingError: IntegerField(CAPACITY): func transformer error: invalid literal for int() with base 10: '17\nDEMAND_" so it seems like it reads without recognizing the two lines capacity and demand dimension, it seems also that later it is also having the same parsing problem in the demand section. is m_pdtsp a kind of problem not supported? what should be done differently?
the instance used is:
NAME : m2n30Q17s777c1
TYPE : m-PDTSP
DIMENSION : 30
CAPACITY : 17
DEMAND_DIMENSION : 2
EDGE_WEIGHT_TYPE : EUC_2D
NODE_COORD_SECTION
1 0 0
2 -108 76
3 372 -432
4 -57 388
5 286 409
6 424 169
7 58 -497
8 221 118
9 470 380
10 -431 -422
11 305 -58
12 457 196
13 493 269
14 281 -259
15 -172 -484
16 263 -258
17 -427 153
18 351 314
19 478 120
20 -415 -203
21 20 -92
22 113 237
23 57 447
24 -322 -129
25 253 -27
26 -387 -243
27 -72 212
28 246 -337
29 71 279
30 351 -457
DEMAND_SECTION
1 0 0
2 4 0
3 0 5
4 -6 0
5 0 0
6 -5 0
7 0 -1
8 -1 0
9 0 -10
10 10 0
11 0 -9
12 -1 0
13 0 -3
14 4 0
15 0 8
16 -3 0
17 0 -2
18 3 0
19 0 -6
20 0 0
21 0 -4
22 1 0
23 0 8
24 -1 0
25 0 -5
26 3 0
27 0 9
28 0 0
29 0 10
30 -8 0
DEPOT_SECTION
1
-1
EOF
thank you in advance for any help given
Hi,
I am trying to use Python wrapper for LKH-3. But when I submit my .vrp file to the solver, I got the following error. I dont know how to solve it.
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4328/1102774893.py in <module>
----> 1 lkh.solve(solver_path, problem=problem, runs=10, OUTPUT_TOUR_FILE="vrp_solution.csv")
~\Anaconda3\lib\site-packages\lkh\__init__.py in solve(solver, problem, **params)
21
22 # need dimension of problem to parse solution
---> 23 problem = tsplib.load(params['problem_file'])
24
25 if 'tour_file' not in params:
~\Anaconda3\lib\site-packages\tsplib95\loaders.py in load(filepath, problem_class, special)
14 :rtype: :class:`~Problem`
15 """
---> 16 with open(filepath) as f:
17 return read(f, special=special, problem_class=problem_class)
18
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\...\\AppData\\Local\\Temp\\tmp9p5slr0l'
hi, I installed this package and tried the example code, but the output seems to be a tsp result. Could you please help me out?
the example code is as follow:
'import requests
import lkh
problem_str = requests.get('http://vrp.atd-lab.inf.puc-rio.br/media/com_vrp/instances/A/A-n32-k5.vrp').text
problem = lkh.LKHProblem.parse(problem_str)
solver_path = r'/home/ubuntu/LKH_3/LKH-3.0.7/LKH'
print(lkh.solve(solver_path, problem=problem, max_trials=1000, runs=1, tour_file="./tour.txt"))'
the result is
[[1, 30, 19, 9, 10, 23, 16, 11, 26, 6, 21, 33, 27, 8, 14, 18, 20, 32, 22, 35, 7, 4, 3, 24, 5, 12, 29, 15, 34, 25, 28, 36, 13, 2, 17, 31]]
not like the README file. would you please check if some code was changed ? And how can I fix this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.