Visualisation of Genetic Algorithms for the Traveling Salesman Problem in Java --by Johannes Sarg

The Traveling Salesman Problem (TSP)

Find the shortest trip through n towns where each town must be visited exactly once.

In the following we define that from each town all other towns can be visited. The costs to visit a town from another are represented by their euklidic distance. Therefore the costs are reflexive.

The Genetic Algorithm (GA)

A GA tries to use basic principles of natural evolution. It is especially appropriate for problems with large and complex search-spaces, where the global optimum can't be found within a reasonable amount of time using traditional techniques as e.g. total enumeration or branch and bound. It cannot be guaranteed that the optimum solution is found by the GA. Here are some references for GAs.

Structure of a GA:

procedure GA begin t = 0; initialize(P(t)); evaluate(P(t)); while (not termination condition) begin t = t + 1; Qs(t) = selection(P(t-1)); Qr(t) = recombination(Qs(t)); P(t) = mutation(Qr(t)); evaluate(P(t)); end;

end;

Description:

A set of potential solutions are randomly initialized and their quality evaluated. Out of this set better solutions are preferred, corresponding to a probability distribution. Each time, two of the selected solutions creats new solutions by recombination which finally are mutated. These generated solutions are evaluated and represents the basis for the next generation. In this way a GA tries to find better solutions and to reach the global optimum.

Objectives of the program TSPGA

exact simulation and visualisation of a GA run visualisation of the mutation and recombination methods possibility to compare different GA runs concerning the same TSP

The GA for TSPs

In the "Options" menu, you can configure the following properties for the GA:

GA parameters:

recombination methode: Partially Matched Crossover (PMX) Order Crossover (OX) Cycle Crossover (CX) Uniform Order Based Crossover (UOBX) Edge Recombination Crossover (ERX) ERX with heuristic (Grefenstette) None recombination probability (0% - 100%) mutation methode: Inversion Insertion Displacement Reciprocal Exchange (Swap) None mutation probability (0% - 100%) population size (5 - 100) k value for the Tournament selection (1 - 10) elitism (true / false)

Set Problem: A grid can be defined where the user can set the positions of the towns (4 - 100 towns).

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章