Skip to content

xcodeassociated/Genetic-algorithm-example-in-Java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goingAroundScotland

Solving the travelling salesman problem with Genetic Algorithm (in scotland)

Steps:

  1. Configure IO (Done)

  2. Initializing first generation (Done)

  3. Creating next generation (Done)

  4. Crossover and mutation (Done)

  5. Putting everything together! (Done)


How does the program read?

The program reads from a text file, currently known as "format.txt"

The first line represents no. of cities

The second line represents the city to start and end with (creating a circuit)

then from the third line, the program starts reading the distance between x and y cities and store it in a data structure for later use.


How to put the text for distance:

123

34 13

66 23 234

The distance between city 0 and city 1 is 123

The distance between city 0 and city 2 is 34

The distance between city 1 and city 2 is 13

The distance between city 0 and city 3 is 66

The distance between city 1 and city 3 is 23

The distance between city 2 and city 3 is 234


If I were to show it with a bit more description, it would look like this..

(City 0 -> City 1)

(City 0 -> City 2)(City 1 -> City 2)

(City 0 -> City 3)(City 1 -> City 3)(City 2 -> City 3)

About

Solving the travelling salesman problem with Genetic Algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%