Skip to main content
This code is to solve traveling salesman problem by using simulated annealing meta heuristic.

```
import numpy
import pytspsa


solver = pytspsa.Tsp_sa()
c = [
[0, 0],
[0, 1],
[0, 2],
[0, 3]
]
c = numpy.asarray(c, dtype=numpy.float32)
solver.set_num_nodes(4)
solver.add_by_coordinates(c)
solver.set_t_v_factor(4.0)

# solver.sa() or sa_auto_parameter() will solve the problem.
solver.sa_auto_parameter(12)

# getting result
solution = solver.getBestSolution()

print('Length={}'.format(solution.getlength()))
print('Path= {}'.format(solution.getRoute()))
```

See github page.

Release files for pytspsa 0.1.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytspsa 0.1.14
File Size Uploaded
pytspsa-0.1.14.tar.gz 18.6 kB Details

Release files / pytspsa-0.1.14.tar.gz

Download URL pytspsa-0.1.14.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e10b6313ed8e98f1bf639d34aa7792d9689b22a4dd9c14990ee428fe24ad4ef
BLAKE2b-256 checksum
How to use checksums
ba1405e340c9e86e872d10ef41ff7d849bc25a72b3d9e52feb94ffee5eb9ca2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.14 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page