Skip to content
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

get_weight() inconsistent changing of indexing bug #23

Open
koleckar opened this issue Nov 8, 2021 · 0 comments
Open

get_weight() inconsistent changing of indexing bug #23

koleckar opened this issue Nov 8, 2021 · 0 comments

Comments

@koleckar
Copy link

koleckar commented Nov 8, 2021

  • TSPLIB 95 version: 0.7.1
  • Python version: 3.6
  • Operating System: Win
graph = tsplib95.load('data/gr17.tsp')
print(graph.get_weight(17, 1))  # IndexError: (17, 1) is out of bonuds

graph = tsplib95.load('data/gr120.tsp')
print(graph.get_weight(120, 1))  # ok


graph = tsplib95.load('data/gr17.tsp')
print(graph.get_weight(16, 0))  # ok

graph = tsplib95.load('data/gr120.tsp')
print(graph.get_weight(119, 0))  # IndexError: (118, -1) is out of bonuds

So inside get_weight() for some graphs (with exactly same edge_weight_type/format etc..) there is NONCONSISTENCY
of what the function does with indexing.
Eg.: for gr120.tsp instance there is implicit -1 for index passed into get_weight() but for gr17/24/48 there is not.

The subtracitng 1 issue I found for 'berlin52.tsp', 'pa561.tsp' and 'gr120'.

Btw there is typo in "raise IndexError(f'({i}, {j}) is out of bonuds" as well.

Also for some problems (eg: si_xxx.tsp) there is flipped 'i' and 'j' in "raise IndexError(f'({i}, {j}) is out of bonuds"

graph = tsplib95.load('data/si535.tsp')
print(graph.get_weight(535, 1)) # IndexError: (1, 535) is out of bonuds

Quite annoying bug tbh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant