{ "info": { "author": "William Borgeaud", "author_email": "williamborgeaud@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "# tspy: An optimization package for the traveling salesman problem.\nThe *tspy* package gives a Python framework in which to study the famous [Traveling Salesman Problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem) (TSP). In this package, one can work on specific instances of the TSP. Approximation methods and lower bounds are included by default. The structure of the package makes it easy to create and include your own methods.\n\n## Installation\nThe *tspy* package can be installed using *pip*:\n```\npip install tspy\n```\n\n## How to use tspy\n### Creating an instance\nTo create an instance of the TSP, use:\n```python\nfrom tspy import TSP\ntsp = TSP()\n```\nCurrently, data can be given to the instance in two ways: by giving it the *NxN* distance matrix *D* or, in the case of an Euclidian TSP, a *NxP* data matrix *X* and a distance function.\n```python\n# Using the distance matrix\ntsp.read_mat(D)\n\n# Using the data matrix and a distance function\ntsp.read_data(X, dist)\n```\n\n### Computing approximate solutions\nThe module `tsp.solvers` contains several algorithms providing approximate solutions of TSP instances. For example, the [2-opt](https://en.wikipedia.org/wiki/2-opt) algorithm gives good solutions rather quickly. Here is how it can be used in the *tspy* package:\n```python\nfrom tspy.solvers import TwoOpt_solver\ntwo_opt = TwoOpt_solver(initial_tour='NN', iter_num=100)\ntwo_opt_tour = tsp.get_approx_solution(two_opt)\n```\nOther solvers are used similarly.\n\nCurrent solutions are stored in the dictionary `tsp.tours`. If a data matrix has been provided to the instance, a plot of the solution can be shown:\n```python\ntsp.plot_solution('TwoOpt_solver')\n```\n![alt text](https://github.com/wborgeaud/tspy/blob/master/images/two_opt_sol.jpg)\n\nAt any point, the best solution that has been computed can be retrieved:\n```python\nbest_tour = tsp.get_best_solution()\n```\n\n### Computing lower bounds\nThe TSP being *NP-hard*, it is difficult to get exact solutions for large instances. However, by computing lower bounds we can know how good our approximations are. The *tspy* package provides several lower bounds methods. One example is given by the `Simple_LP_bound` which gives the optimal solution of the [LP relaxation](https://en.wikipedia.org/wiki/Linear_programming_relaxation) of the TSP:\n```python\nfrom tspy.lower_bounds import Simple_LP_bound\nlower_bound = tsp.get_lower_bound(Simple_LP_bound())\n```\nAt any point, the best lower bound that has been computed can be retrieved:\n```python\nbest_lower_bound = tsp.get_best_lower_bound()\n```\n\n## Future\nThe following features will be added soon:\n- Genetic programming \n- Ant colony optimization\n- Lin\u2013Kernighan heuristic\n- Better LP lower bounds\n\nFeel free to contact me if you would like to contribute.\n\n\n## Author\n*tspy* was written by William Borgeaud (williamborgeaud[at]gmail.com).\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wborgeaud/tspy", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "tspy", "package_url": "https://pypi.org/project/tspy/", "platform": "", "project_url": "https://pypi.org/project/tspy/", "project_urls": { "Homepage": "https://github.com/wborgeaud/tspy" }, "release_url": "https://pypi.org/project/tspy/0.1.1.1/", "requires_dist": null, "requires_python": "", "summary": "An optimization package for the traveling salesman problem", "version": "0.1.1.1" }, "last_serial": 4113774, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "93ddbcc89a2f0d1005cba748af9a916a", "sha256": "e12c42c3602229bf1d3ab3c8a9fea51e06471add597fb59a1223c090abe78c56" }, "downloads": -1, "filename": "tspy-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "93ddbcc89a2f0d1005cba748af9a916a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6897, "upload_time": "2018-07-28T17:21:09", "url": "https://files.pythonhosted.org/packages/47/29/01dd1e471fdde6b841455666e457896c489795b36e5394b7e567f6bf421a/tspy-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b644bafaa3e185e81a56ee6ce881cf8", "sha256": "534256ce38c5a3d83c9f7b0c71898d4cca709614c352292eec59c2fbf1645aec" }, "downloads": -1, "filename": "tspy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2b644bafaa3e185e81a56ee6ce881cf8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4809, "upload_time": "2018-07-28T17:21:10", "url": "https://files.pythonhosted.org/packages/77/b7/0e922a950ec454b170cc1e41229ff72251aaf8526d5cc4e6855ee3794b8f/tspy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6ac083bacc152331a3d79f9114159164", "sha256": "1d429aed66e98bec93ceee6e937ba60be90880fe75e5c12724f90eea3bd92c59" }, "downloads": -1, "filename": "tspy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6ac083bacc152331a3d79f9114159164", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8975, "upload_time": "2018-07-29T13:54:14", "url": "https://files.pythonhosted.org/packages/22/5f/060d635cd6b08c0f027e1b02370110221f23d8603feacfd2f8e7c8859801/tspy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f834810548dbaa7dd3d8f70690cbabcb", "sha256": "9bd86bec89b7fdcd4629da737d82d56f74292f0a6e1d6f568390b215cc4e9c5a" }, "downloads": -1, "filename": "tspy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "f834810548dbaa7dd3d8f70690cbabcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7510, "upload_time": "2018-07-29T13:54:17", "url": "https://files.pythonhosted.org/packages/7a/24/8400c561d5287f86732acb49f0ba370bbdff480a6aabba073675873de63f/tspy-0.1.1.tar.gz" } ], "0.1.1.1": [ { "comment_text": "", "digests": { "md5": "eca8e934a633ae62ba3657134e9e2606", "sha256": "c349dc86412190698698e40b8e843ead0f42b3ab8be6a7c91d78bff4ea32e219" }, "downloads": -1, "filename": "tspy-0.1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "eca8e934a633ae62ba3657134e9e2606", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9020, "upload_time": "2018-07-29T13:56:47", "url": "https://files.pythonhosted.org/packages/1a/b5/a2fc6445dd39dd32946854f9cebbb25527286de5293e464e6d971ef04e81/tspy-0.1.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "78d452d5676c8589ffdc599ca516f43b", "sha256": "d15cc1f4f00a530565183a356ab21b489dc587be0382abe9d7dbb53380735976" }, "downloads": -1, "filename": "tspy-0.1.1.1.tar.gz", "has_sig": false, "md5_digest": "78d452d5676c8589ffdc599ca516f43b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7575, "upload_time": "2018-07-29T13:57:53", "url": "https://files.pythonhosted.org/packages/32/a2/b0a18fbfad43dc2adae262566d74af1dcbf7c2ac6da30856f88eb2021909/tspy-0.1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eca8e934a633ae62ba3657134e9e2606", "sha256": "c349dc86412190698698e40b8e843ead0f42b3ab8be6a7c91d78bff4ea32e219" }, "downloads": -1, "filename": "tspy-0.1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "eca8e934a633ae62ba3657134e9e2606", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9020, "upload_time": "2018-07-29T13:56:47", "url": "https://files.pythonhosted.org/packages/1a/b5/a2fc6445dd39dd32946854f9cebbb25527286de5293e464e6d971ef04e81/tspy-0.1.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "78d452d5676c8589ffdc599ca516f43b", "sha256": "d15cc1f4f00a530565183a356ab21b489dc587be0382abe9d7dbb53380735976" }, "downloads": -1, "filename": "tspy-0.1.1.1.tar.gz", "has_sig": false, "md5_digest": "78d452d5676c8589ffdc599ca516f43b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7575, "upload_time": "2018-07-29T13:57:53", "url": "https://files.pythonhosted.org/packages/32/a2/b0a18fbfad43dc2adae262566d74af1dcbf7c2ac6da30856f88eb2021909/tspy-0.1.1.1.tar.gz" } ] }