ben-hudson / pylkh

A super simple Python wrapper for the constrained traveling salesman and vehicle routing problem solver LKH-3.
https://pypi.org/project/lkh/
Other
32 stars 8 forks source link

Cannot solve CVRP problem #4

Closed silent790 closed 2 years ago

silent790 commented 2 years ago

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.

ben-hudson commented 2 years ago

There seems to be a problem with the solution parsing. This commit should work as expected.

ben-hudson commented 2 years ago

5d03d0e573f4c5785667075a05197501fc97fb56 should fix this!