Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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 14-Dec-21 22:14pm
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.

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.
 
Share this answer
 
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.
 
Share this answer
 
v2
Comments
Shamsunissa Ali 24-Feb-22 13:28pm    
I Have Tried In GUI TSP But It Shows lots of error which i can not understand
Patrice T 24-Feb-22 13:36pm    
I can not guess without seeing the code and error messages.
Ask your own question: https://www.codeproject.com/Questions/ask.aspx[^]

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900