Skip to main content

Initial Release.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytspsa-0.1.14.tar.gz (18.6 kB view details)

Uploaded Source

File details

Details for the file pytspsa-0.1.14.tar.gz.

File metadata

  • Download URL: pytspsa-0.1.14.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytspsa-0.1.14.tar.gz
Algorithm Hash digest
SHA256 1e10b6313ed8e98f1bf639d34aa7792d9689b22a4dd9c14990ee428fe24ad4ef
MD5 ef6c123358d2cc083aab50849f931273
BLAKE2b-256 ba1405e340c9e86e872d10ef41ff7d849bc25a72b3d9e52feb94ffee5eb9ca2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page