Click here to Skip to main content
14,490,514 members
Rate this:
Please Sign up or sign in to vote.
See more:
How to implement genetic algorithm using gui that is when the program is executed it should show as a man walking and finding the shortest route to all the cities

What I have tried:

I have tried the. Tsp using genetic algorithm but it shows lot of errors
Posted
Updated 30-Sep-19 3:35am
Comments
phil.o 30-Sep-19 7:50am
   
Please show what code you have tried, and which error messages you get.
Use the Improve question widget which appears on hovering your question, and qualify it with relevant details.
Rate this:
Please Sign up or sign in to vote.

Solution 1

You have basically two tasks:
  • Implement the genetic algorithm for solving the Traveling Salesman Problem
  • Provide graphical feedback to the user about algorithm progress (and/or solution).

This page Traveling Salesman Problem with Genetic Algorithms in Java[^] could help you in accomplishing the first task.

Then you have to read one (or more) of the many many many available tutorials on Java GUI programming in order to realize the second one.

No need to say, the algorithm implementation should expose info about its progress in order to make the GUI interface properly updated.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Quote:
How to implement genetic algorithm using gui

Basically, the algorithm used, genetic or not, is not link to GUI.
In order to show the advance of optimization, the GUI needs the actual path and best path and a call to GUI update.

So, whatever is your algorithm, you need a place to store actual path, best path in a place that GUI can read.
Then every time your algorithm make a change in path, it must call GUI update. this is the only link you must have to the GUI.
I would use a callback to GUI to avoid messing in algorithm.
Quote:
I have tried the. Tsp using genetic algorithm but it shows lot of errors

To get help on this, you need to show your code and error messages.
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100