Skip to content

Commit

Permalink
fixed typo in lower bound tour length for cn11, also added optimal tour
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasWeise committed Oct 19, 2024
1 parent a3256cd commit 8c58509
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
4 changes: 2 additions & 2 deletions moptipyapps/tsp/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
Harbin (哈尔滨), Kunming (昆明), Wuhan (武汉),
Xi'an (西安), Chongqing (重庆), Changsha (长沙),
and Hong Kong (香港), determined using BaiDu Maps on 2024-10-18.
The optimal solution for this instance has length 14441 (km) and visits the
The optimal solution for this instance has length 9547 (km) and visits the
cities in the following order: Shanghai (上海),
Nanjing (南京), Hefei (合肥), Wuhan (武汉), Changsha (长沙),
Hong Kong (香港), Kunming (昆明), Chongqing (重庆),
Expand Down Expand Up @@ -198,7 +198,7 @@
"a280": 2579, "ali535": 202339, "att48": 10628, "att532": 27686,
"bayg29": 1610, "bays29": 2020, "berlin52": 7542, "bier127": 118282,
"br17": 39, "brazil58": 25395, "brd14051": 469385, "brg180": 1950,
"burma14": 3323, "ch130": 6110, "ch150": 6528, "cn11": 14441,
"burma14": 3323, "ch130": 6110, "ch150": 6528, "cn11": 9547,
"d1291": 50801, "d15112": 1573084, "d1655": 62128, "d18512": 645238,
"d198": 15780, "d2103": 80450, "d493": 35002, "d657": 48912,
"dantzig42": 699, "dsj1000": 18660188, "eil101": 629, "eil51": 426,
Expand Down
15 changes: 9 additions & 6 deletions moptipyapps/tsp/known_optima.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
#: the set of known optimal tours
_TOURS: Final[tuple[str, ...]] = (
"a280", "att48", "bayg29", "bays29", "berlin52", "brg180", "ch130",
"ch150", "eil101", "eil51", "eil76", "fri26", "gr120", "gr202", "gr24",
"gr48", "gr666", "gr96", "kroA100", "kroC100", "kroD100", "lin105",
"pcb442", "pr1002", "pr76", "rd100", "st70", "tsp225", "ulysses16",
"ulysses22")
"ch150", "cn11", "eil101", "eil51", "eil76", "fri26", "gr120", "gr202",
"gr24", "gr48", "gr666", "gr96", "kroA100", "kroC100", "kroD100",
"lin105", "pcb442", "pr1002", "pr76", "rd100", "st70", "tsp225",
"ulysses16", "ulysses22")


def _from_stream(stream: TextIO) -> np.ndarray:
Expand Down Expand Up @@ -102,6 +102,9 @@ def opt_tour_from_resource(name: str) -> np.ndarray:
>>> np.array2string(opt_tour_from_resource("ulysses16"))
'[ 0 13 12 11 6 5 14 4 10 8 9 15 2 1 3 7]'
>>> np.array2string(opt_tour_from_resource("cn11"))
'[ 0 2 3 6 9 10 5 8 7 1 4]'
:param name: the name string
:return: the optimal tour
"""
Expand All @@ -117,8 +120,8 @@ def list_resource_tours() -> tuple[str, ...]:
>>> list_resource_tours()
('a280', 'att48', 'bayg29', 'bays29', 'berlin52', 'brg180', 'ch130', \
'ch150', 'eil101', 'eil51', 'eil76', 'fri26', 'gr120', 'gr202', 'gr24', \
'gr48', 'gr666', 'gr96', 'kroA100', 'kroC100', 'kroD100', 'lin105', \
'ch150', 'cn11', 'eil101', 'eil51', 'eil76', 'fri26', 'gr120', 'gr202', \
'gr24', 'gr48', 'gr666', 'gr96', 'kroA100', 'kroC100', 'kroD100', 'lin105', \
'pcb442', 'pr1002', 'pr76', 'rd100', 'st70', 'tsp225', 'ulysses16', \
'ulysses22')
Expand Down
17 changes: 17 additions & 0 deletions moptipyapps/tsp/tsplib/cn11.opt.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
NAME : cn11.opt.tour
TYPE : TOUR
DIMENSION : 11
TOUR_SECTION
1
3
4
7
10
11
6
9
8
2
5
-1
EOF
2 changes: 1 addition & 1 deletion moptipyapps/tsp/tsplib/cn11.tsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
NAME: cn11
TYPE: TSP
COMMENT: The travel distances by car in km between the eleven Chinese cities Shanghai (上海), Beijing (北京), Nanjing (南京), Hefei (合肥), Harbin (哈尔滨), Kunming (昆明), Wuhan (武汉), Xi'an (西安), Chongqing (重庆), Changsha (长沙), and Hong Kong (香港), determined using BaiDu Maps on 2024-10-18.
COMMENT: The travel distances by car in km between the eleven Chinese cities Shanghai (上海), Beijing (北京), Nanjing (南京), Hefei (合肥), Harbin (哈尔滨), Kunming (昆明), Wuhan (武汉), Xi'an (西安), Chongqing (重庆), Changsha (长沙), and Hong Kong (香港), determined using BaiDu Maps on 2024-10-18. The optimal tour length is 9547.
DIMENSION: 11
EDGE_WEIGHT_TYPE: EXPLICIT
EDGE_WEIGHT_FORMAT: UPPER_DIAG_ROW
Expand Down
2 changes: 1 addition & 1 deletion moptipyapps/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""An internal file with the version of the `moptipyapps` package."""
from typing import Final

__version__: Final[str] = "0.8.56"
__version__: Final[str] = "0.8.57"

0 comments on commit 8c58509

Please sign in to comment.