/TSP-antcolony-algorithm

An implementation of TSP by Ant Colony Algorithm in Java.采用蚁群算法解决TSP旅行商问题的Java版程序。

Primary LanguageJava

TSP-AntColonyAlgorithm

An implementation of TSP(Traveling Salesman Problem) by Ant Colony Algorithm in Java.

Details

  • Solve TSP in Java.
  • Adopt Object-Oriented.
  • Divide into 5 Classes: AntAlgorithm, Ant, City, Road and Constant.
  • Verify respectively in 3 different size of cities: 10 cities, 20 cities and 31 cities.

Classes

  • AntAlgorithm: controls the whole algorithm's life cycle including initing all the ants, choosing the next city and simulating the round trip for each ant, updating pheromone for each road.
  • Ant: portrays the serveral actions of ant such as initing the birthplace, choosing the next city, arriving the next city.
  • City: contains the id of city, the sum of visibility and pheromone with weight, and the possibility to be choosed by one ant.
  • Road: contains the distance and the pheromone of each road.
  • Constant:contains the data of map, the initial value of pheromone(C), the max number of round trips, the number of ants, the flow-rate of pheromone and so on.

For More

If you want to learn more information about this implementation, please visit the following three sites(but a pity only in Chinese):