Coverage for moptipyapps / tsp / tsplib / __init__.py: 100%
5 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-11 04:40 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-11 04:40 +0000
1"""
2The TSPLib example data for the Traveling Salesperson Problem (TSP).
4This package does not offer anything useful except for holding the TSPLib
5files. You can find the documentation and actual classes for solving and
6playing around with the TSP in package :mod:`~moptipyapps.tsp`.
8The original data of TSPLib can be found at
9<http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/>. Before doing
10anything with these data directly, you should make sure to read the FAQ
11<http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/TSPFAQ.html> and the
12documentation
13<http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/tsp95.pdf>.
151. Gerhard Reinelt. TSPLIB - A Traveling Salesman Problem Library.
16 *ORSA Journal on Computing* 3(4):376-384. November 1991.
17 https://doi.org/10.1287/ijoc.3.4.376.
18 http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/
192. Gerhard Reinelt. *TSPLIB95.* Heidelberg, Germany: Universität
20 Heidelberg, Institut für Angewandte Mathematik. 1995.
21 http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/tsp95.pdf
22"""
24from importlib import resources # nosem
25from typing import TextIO, cast
27from pycommons.io.path import UTF8
30def open_resource_stream(file_name: str) -> TextIO:
31 """
32 Open a TSPLib resource stream.
34 :param file_name: the file name of the resource
35 :return: the stream
36 """
37 return cast("TextIO", resources.files(__package__).joinpath(
38 file_name).open("r", encoding=UTF8))