Coverage for moptipyapps / tsp / __init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-11 04:40 +0000

1""" 

2Experiments with the Traveling Salesperson Problem (TSP). 

3 

4A Traveling Salesperson Problem (TSP) is defined as a fully-connected graph 

5with :attr:`~moptipyapps.tsp.instance.Instance.n_cities` nodes. Each edge in 

6the graph has a weight, which identifies the distance between the nodes. The 

7goal is to find the *shortest* tour that visits every single node in the graph 

8exactly once and then returns back to its starting node. Then nodes are 

9usually called cities. In this file, we present methods for loading instances 

10of the TSP as distance matrices `A`. In other words, the value at `A[i, j]` 

11identifies the travel distance from `i` to `j`. Such instance data can be 

12loaded via class :mod:`~moptipyapps.tsp.instance`. 

13 

14In this package, we provide the following tools: 

15 

16- :mod:`~moptipyapps.tsp.instance` allows you to load instance data in the 

17 TSPLib format and it provides several instances from TSPLib as resources. 

18- :mod:`~moptipyapps.tsp.known_optima` provides known optimal solutions for 

19 some of the TSPLib instances. These should mainly be used for testing 

20 purposes. 

21- :mod:`~moptipyapps.tsp.tour_length` is an objective function that can 

22 efficiently computed the length of a tour in path representation. 

23- :mod:`~moptipyapps.tsp.tsplib` is just a dummy package holding the actual 

24 TSPLib data resources. 

25 

26Important initial work on this code has been contributed by Mr. Tianyu LIANG 

27(梁天宇), <liangty@stu.hfuu.edu.cn> a Master's student at the Institute of 

28Applied Optimization (应用优化研究所) of the School 

29of Artificial Intelligence and Big Data (人工智能与大数据学院) at Hefei 

30University (合肥大学) in Hefei, Anhui, China (中国安徽省合肥市) under the 

31supervision of Prof. Dr. Thomas Weise (汤卫思教授). 

32"""