{"id":20071351,"url":"https://github.com/cptanalatriste/aco-tsp","last_synced_at":"2025-07-19T04:33:53.321Z","repository":{"id":145889099,"uuid":"55096781","full_name":"cptanalatriste/aco-tsp","owner":"cptanalatriste","description":"Solving the Travelling Salesman problem with Ant Colony Algorithms, using the Isula Framework","archived":false,"fork":false,"pushed_at":"2022-06-22T14:30:53.000Z","size":37,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T19:44:00.279Z","etag":null,"topics":["ant-colony-optimization","java","traveling-salesman"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cptanalatriste.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-03-30T20:50:11.000Z","updated_at":"2024-09-04T01:54:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"3524e0f1-ea68-481c-973a-728792f3155d","html_url":"https://github.com/cptanalatriste/aco-tsp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cptanalatriste/aco-tsp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptanalatriste%2Faco-tsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptanalatriste%2Faco-tsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptanalatriste%2Faco-tsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptanalatriste%2Faco-tsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cptanalatriste","download_url":"https://codeload.github.com/cptanalatriste/aco-tsp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptanalatriste%2Faco-tsp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265888947,"owners_count":23844534,"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":["ant-colony-optimization","java","traveling-salesman"],"created_at":"2024-11-13T14:28:51.252Z","updated_at":"2025-07-19T04:33:53.311Z","avatar_url":"https://github.com/cptanalatriste.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aco-tsp\n\n[![Build Status](https://travis-ci.org/cptanalatriste/aco-tsp.svg?branch=master)](https://travis-ci.org/cptanalatriste/aco-tsp)\n[![packagecloud](https://img.shields.io/badge/java-packagecloud.io-844fec.svg)](https://packagecloud.io/cgavidia/aco-tsp)\n\nA Java Program that solves the Travelling Salesman Problem using the Ant System algorithm. The algorithm details and configuration where taken from in Section 6.3 of the Clever Algorithms book by Jason Brownlee.\n\nIn the same fashion as the book, we use the berlin52 instance from TSPLIB as a testbed for the program.\n\nThe Ant-Colony Algorithm\n------------------------\nThis program uses a classic Ant System approach with some peculiarities for the Travelling Salesman Problem described in the book. To implement this algorithm, we use the Isula Framework.\n\n```java\n        double[][] problemRepresentation = getRepresentationFromFile(fileName);\n\n        ProblemConfiguration configurationProvider = new ProblemConfiguration(problemRepresentation);\n        AntColony\u003cInteger, TspEnvironment\u003e colony = getAntColony(configurationProvider);\n        TspEnvironment environment = new TspEnvironment(problemRepresentation);\n\n        AcoProblemSolver\u003cInteger, TspEnvironment\u003e solver = new AcoProblemSolver\u003c\u003e();\n        solver.initialize(environment, colony, configurationProvider);\n        solver.addDaemonActions(new StartPheromoneMatrix\u003cInteger, TspEnvironment\u003e(),\n                new PerformEvaporation\u003cInteger, TspEnvironment\u003e());\n\n        solver.addDaemonActions(getPheromoneUpdatePolicy());\n\n        solver.getAntColony().addAntPolicies(new RandomNodeSelection\u003cInteger, TspEnvironment\u003e());\n        solver.solveProblem();\n```\nThe implemented process has the following characteristics:\n* The initial value of the cells of the pheromone matrix is a function of the number of cities in the problem instance and the quality of a random solution. See the `ProblemConfiguration` class for more details.\n* The evaporation ratio for the algorithm is 0.4 as described in the book. When all the ants have finished building their solutions, they deposit pheromone in the corresponding cells of the pheromone matrix it in a quantity proportional to the solution quality.\n* The Ants use the Random Proportional Rule for selecting solution components while traversing the problem graph, as it corresponds on an Ant System algorithm.\n\nThe results \n-----------\nFor the berlin52 problem instance, the optional solution has a total distance of 7542 units. Under the current configuration, the solutions produced by the algorithm are around 7795 after an execution time of 1.5 seconds.\n\nHow to use this code\n--------------------\nThe code uploaded to this GitHub Repository corresponds to a Maven Java Project. \nAs such, it is strongly recommended that you have Maven installed before working with it.\n\n**This project depends on the Isula Framework**. Follow the instructions available in \nhttps://github.com/cptanalatriste/isula\n\nKeep in mind that several file and folder locations were configured on the `AcoTspWithIsula.java` file. You need to set values according to your environment in order to avoid a `FileNotFoundException`. Once this is ready, you can launch this project by executing `mvn exec:java -Dexec.mainClass=\"tsp.isula.sample.AcoTspWithIsula\"` from the project root folder.\n\nMore about Isula\n----------------\nVisit the Isula Framework site: http://cptanalatriste.github.io/isula/\n\nReview the Isula JavaDoc: http://cptanalatriste.github.io/isula/doc/\n\nQuestions, issues or support?\n----------------------------\nFeel free to contact me at carlos.gavidia@pucp.edu.pe.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcptanalatriste%2Faco-tsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcptanalatriste%2Faco-tsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcptanalatriste%2Faco-tsp/lists"}