{"id":22025310,"url":"https://github.com/beeceej/ga-tsp","last_synced_at":"2025-10-19T21:42:13.925Z","repository":{"id":144411649,"uuid":"123047006","full_name":"beeceej/ga-tsp","owner":"beeceej","description":"Genetic algorithim to solve the Travelling Salesman problem, written in mostly functional style Java","archived":false,"fork":false,"pushed_at":"2018-02-27T01:04:09.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-23T10:46:24.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beeceej.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-27T00:00:28.000Z","updated_at":"2018-02-27T15:31:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"7378d35b-5506-4360-8a49-1abd0dd95308","html_url":"https://github.com/beeceej/ga-tsp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beeceej/ga-tsp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeceej%2Fga-tsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeceej%2Fga-tsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeceej%2Fga-tsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeceej%2Fga-tsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beeceej","download_url":"https://codeload.github.com/beeceej/ga-tsp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeceej%2Fga-tsp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259888189,"owners_count":22927073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T07:15:41.988Z","updated_at":"2025-10-19T21:42:13.801Z","avatar_url":"https://github.com/beeceej.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Genetic Algorithm - TSP\n\nThis project heavily uses Java 8 features like Streams, First Class(ish) functions, map, reduce, bind(flatmap), etc.\n\nThe Travelling Salesman problem can be stated as:\n```\nGiven locations (A(x,y), B(x,y), ... ) with distinct locations on a directed acyclic graph,\nfind the least costly path (in this case distance) to traverse from starting point A to end point. \n```\n\nmy (loose) interpretation of a genetic algorithm eventually converges upon an optimal solution by:\n\n`-\u003e Begin with a randomly generated seed Population of size N`\n\n`-\u003e For M generations, perform random mutations on the traversal order, keeping only the most efficient routes (only routes with distance \u003c than average)`\n\n`-\u003e After M generations, we will have converged upon a near optimal solution in much less time than exhaustive search`\n\nA naive solution would be to calculate distance on every pass, but this can be amortized by pre-computing distances and retrieving them for amortized O(1) look up.\nI've only implemented pair look up, but this could be further implemented by adding look ups for A -\u003e B -\u003e C ... etc.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeeceej%2Fga-tsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeeceej%2Fga-tsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeeceej%2Fga-tsp/lists"}