semvec/pypi-packages huggingface dataset:
tsp-tools 0.3.2
`tsp-tools` is a package for Traveling Salesman Problem for Python.
License: Apache-2.0
Requires Python: >=3.12

`tsp-tools` is a package for Traveling Salesman Problem for Python.

## Usage

```python
import tsp_tools
t = tsp_tools.tsp([(0,0), (0,1), (1,0), (1,1)])
print(t)  # distance, node index list
>>>
(4.0, [0, 2, 3, 1])
```

```python
mat = [
    [  0,   1, 1, 1.5],
    [  1,   0, 1.5, 1],
    [  1, 1.5,   0, 1],
    [1.5,   1,   1, 0],
]  # Distance Matrix
r = range(len(mat))
# Dictionary of distance
dist = {(i, j): mat[i][j] for i in r for j in r}
print(tsp_tools.tsp(r, dist))
>>>
(4.0, [0, 2, 3, 1])
```

Note: When large size, `ortoolpy.ortools_vrp` may be efficient.

See also https://pypi.org/project/ortoolpy/

## Requirements

* Python 3
* more-itertools

## Setup

```sh
$ pip install tsp-tools
```

## History

* 0.0.1 (2015-10-2): first release
range-digit 0.3.1
`range-digit` is library of decimal digit which has `low` and `sup`.
License: Apache-2.0
Requires Python: >=3.12

## description

`range-digit` is library of decimal digit which has `low` and `sup`.

```
from range_digit import RangeDigit
from decimal import Decimal

d = RangeDigit("1.240")
print(d)  # 1.240
print(d - Decimal("1.2"))  # 0.040
print(d / 2)  # 0.620
print(d.low)  # 1.2395
print(d.sup)  # 1.2405
print(d.tostr())  # <RangeDigit [1.2395 - 1.2405)>
```