Difference between revisions of "Targeting with Genetic Algorithm"

From Robowiki
Jump to navigation Jump to search
(Created page with "Simply it is determining the GF values in the nodes with genetic algorithm. ==How To Use Genetic Algorithm In Targeting== Of course there can be lots of other ways but I...")
 
 
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
Of course there can be lots of other ways but I will say how I used it on [[WormHole]].
 
Of course there can be lots of other ways but I will say how I used it on [[WormHole]].
 +
[[WormHole]] improves it's gun with genetic algorithms during the match. Latest version: https://www.dropbox.com/s/gupdskse08umgtv/dsekercioglu.WormHole_1.2.jar?dl=1
 +
 
;''Guessing the nodes''
 
;''Guessing the nodes''
  
Line 17: Line 19:
 
:''In robocode for adapting fast it randomly takes an index (index = size - (int)Math.round(Math.random() * 10)) like this code for using valid data.''
 
:''In robocode for adapting fast it randomly takes an index (index = size - (int)Math.round(Math.random() * 10)) like this code for using valid data.''
 
:''If enemy is disabled mutation will help it to adapt quickly.
 
:''If enemy is disabled mutation will help it to adapt quickly.
 +
 +
;''Problems''
 +
 +
:''It skips turns if there are (too many generations per tick/ too many chromosomes)''
 +
:''It can't hit strange patterns if the enemy doesn't move perpendicular to the robot.''
 +
 +
 +
;''Note: If you have something to say just write it.''

Latest revision as of 20:45, 2 February 2017

Simply it is determining the GF values in the nodes with genetic algorithm.

How To Use Genetic Algorithm In Targeting

Of course there can be lots of other ways but I will say how I used it on WormHole. WormHole improves it's gun with genetic algorithms during the match. Latest version: https://www.dropbox.com/s/gupdskse08umgtv/dsekercioglu.WormHole_1.2.jar?dl=1

Guessing the nodes
Make a standard segmented [GF] gun. Remove the bins so there will be only one GF value there.
Then with genetic algorithm create some chromosomes that has their own stats.
Keep a track of your firing data like {latVelWhenFired, advVelWhenFired, hit GF} so you will be able to use it in fitness method.
Then sort the chromosomes and get the first chromosome in the list. Put the first chromosome's stats to your real stats.
Mutation
Normally mutation in genetic algorithm can hurt the genes or it can make it better.
Generally it is randomised.
In robocode for adapting fast it randomly takes an index (index = size - (int)Math.round(Math.random() * 10)) like this code for using valid data.
If enemy is disabled mutation will help it to adapt quickly.
Problems
It skips turns if there are (too many generations per tick/ too many chromosomes)
It can't hit strange patterns if the enemy doesn't move perpendicular to the robot.


Note: If you have something to say just write it.