Difference between revisions of "User talk:Bigfatcat"
(reply) |
|||
Line 18: | Line 18: | ||
I have no idea what NEAT is but sounds like a neat idea *sniggers*. With that in mind, I don't want to get anyone excited about my GP; this is a mini GP that probably wont be very human-competitive. I just want to make a proof of concept and practice my GP skills in preparation of my dissertation. I've taken your advice Voidious and I'm now culling my population after every cycle; I feel slightly evil but it's for a good cause, honestly. A complete 40-generation cycle now takes less than 20 minutes and it's providing some slightly satisfying results. I've also modified my fitness equation to take into account the average score of the three opponents, it seems to be more accurate. --[[User:Bigfatcat|Bigfatcat]] 20:54, 26 April 2011 (UTC) | I have no idea what NEAT is but sounds like a neat idea *sniggers*. With that in mind, I don't want to get anyone excited about my GP; this is a mini GP that probably wont be very human-competitive. I just want to make a proof of concept and practice my GP skills in preparation of my dissertation. I've taken your advice Voidious and I'm now culling my population after every cycle; I feel slightly evil but it's for a good cause, honestly. A complete 40-generation cycle now takes less than 20 minutes and it's providing some slightly satisfying results. I've also modified my fitness equation to take into account the average score of the three opponents, it seems to be more accurate. --[[User:Bigfatcat|Bigfatcat]] 20:54, 26 April 2011 (UTC) | ||
+ | |||
+ | These guys used NEAT - [http://www.youtube.com/watch?v=Ru9W-9CxdQ8 video] / [http://www.jonnielsen.net/RoboReportOfficial.pdf paper]. Yeah I wouldn't feel too embarrassed if your GP bots don't compete with the top hand coded bots. =) Maybe check out the "GPBots" in the rumble for comparison? Anyway, late response, but my GA pseudocode is kinda like this: | ||
+ | <syntaxhighlight> | ||
+ | mutationRate = 0.005 | ||
+ | crossoverRate = 0.7 | ||
+ | population=50 | ||
+ | battles=100 | ||
+ | |||
+ | newGeneration { | ||
+ | newPopulation = new List | ||
+ | while newPopulation.size < population { | ||
+ | random1, random2 = random members of population, | ||
+ | chosen with roulette wheel selection | ||
+ | if (Math.random() < crossoverRate) { | ||
+ | newPopulation.add(crossover(random1, random2)) | ||
+ | newPopulation.add(crossover(random1, random2)) | ||
+ | } else { | ||
+ | newPopulation.add(random1) | ||
+ | newPopulation.add(random2) | ||
+ | } | ||
+ | } | ||
+ | |||
+ | for each bit in each member of newPopulation { | ||
+ | if (Math.random() < mutationRate) | ||
+ | bit.flip | ||
+ | } | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | I also protect against ever adding duplicates and account for other edge cases. You're right, I accept that I might lose something valuable, but odds are very very good that most of the good traits will live on and still have some diversity. Also, I'm running "battles" just simulating targeting runs with [[User:Voidious/WaveSim|WaveSim]], which is not real battles and is maybe 20x faster than a real Robocode battle. | ||
+ | |||
+ | --[[User:Voidious|Voidious]] 01:21, 27 April 2011 (UTC) |
Revision as of 02:21, 27 April 2011
Feel free to discuss my Genetic Programming project!
If you need to speed up the compiling you may with to try using Jikes instead of javac. It compiles much faster, but unfortunately only works for Java 1.4 and earlier, so you need to point at an old robocode.jar for your compile classpath. For running, if you have multiple cores you can turn on the robocode option to enable running the robots in parallel. Otherwise you could use something like RoboResearch which can network battles across multiple machines and set up a whole lab to run your battles. Some food for thought =) --Skilgannon 18:30, 25 April 2011 (UTC)
Thanks Skilgannon, really appreciate the suggestions, definitely food for thought :) I'll look into the dual core option, if I have time RoboResearch sounds like a good idea too. For now I'll halve the reproduction rate just so I can run a complete cycle of 50 generations and while I'm waiting I'll look into your suggestions. Cheers! --Bigfatcat 18:40, 25 April 2011 (UTC)
I've been tinkering with genetic algorithms with Robocode - not "genetic programming", just tuning parameters of algorithms. Why increase the population size over time? I just cull to the same population size each generation. My populations tend to be more like 20-50. Currently I breed using "roulette selection", which I think is pretty common. Also, note that you need to run a lot if battles to accurately evaluate performance, especially as your fitness goes up. Something like 50-100 battles (35 rounds each) is what I use until fitness improvement starts really slowing down. In general, as my fitness improvement slows down, I lower mutation rate, increase crossover rate, and increase the battle count. Of course, all these settings vary by the problem you're working with.
As you've noticed, running actual battles is kinda slow, though that also depends on the complexity of the bots. I'm using WaveSim just to work on targeting algorithms. If you can find any way to evaluate fitness without running actual battles, that could help a lot. Good luck. =) --Voidious 23:09, 25 April 2011 (UTC)
I halved the reproduction rate but once it reached the 40th generation it was still taking too long to run. For this reason I'm going to reduce the number of generations to 40. So when you cull your population I assume you just kill the 50% of your population (the weakest)? Doing that though, how do you ensure you're not losing some valuable variety? One of those weakest individuals may have one value that is perfect. Also when you say you run 50-100 battles with 35 rounds each...you do that for each robot? Surely that takes a hell of a long time?
I'm using Elitism and Roulette Wheel by the way; half of the reproduction pool is selected via elitism and half is selected via Roulette Wheel.--Bigfatcat 13:13, 26 April 2011 (UTC)
Another thought I had for speeding up the compiling would be to compile all the files you need with one big call to javac instead of lots of little calls. Each time you call javac it needs to load rt.jar which is about 30MB. Jikes gets around this by being implemented in C, but the sun javac is actually written in Java (hence the long init times). --Skilgannon 15:14, 26 April 2011 (UTC)
Just throwing a random thought out here, has anyone tried to evolve a population using GP against a population that uses NEAT? I'm wondering what would happen here: a population using GP tests its fitness against NEAT while at the same time, a NEAT population evolves and tests its fitness against the GP population.--Khanguy 20:37, 26 April 2011 (UTC)
I have no idea what NEAT is but sounds like a neat idea *sniggers*. With that in mind, I don't want to get anyone excited about my GP; this is a mini GP that probably wont be very human-competitive. I just want to make a proof of concept and practice my GP skills in preparation of my dissertation. I've taken your advice Voidious and I'm now culling my population after every cycle; I feel slightly evil but it's for a good cause, honestly. A complete 40-generation cycle now takes less than 20 minutes and it's providing some slightly satisfying results. I've also modified my fitness equation to take into account the average score of the three opponents, it seems to be more accurate. --Bigfatcat 20:54, 26 April 2011 (UTC)
These guys used NEAT - video / paper. Yeah I wouldn't feel too embarrassed if your GP bots don't compete with the top hand coded bots. =) Maybe check out the "GPBots" in the rumble for comparison? Anyway, late response, but my GA pseudocode is kinda like this:
mutationRate = 0.005
crossoverRate = 0.7
population=50
battles=100
newGeneration {
newPopulation = new List
while newPopulation.size < population {
random1, random2 = random members of population,
chosen with roulette wheel selection
if (Math.random() < crossoverRate) {
newPopulation.add(crossover(random1, random2))
newPopulation.add(crossover(random1, random2))
} else {
newPopulation.add(random1)
newPopulation.add(random2)
}
}
for each bit in each member of newPopulation {
if (Math.random() < mutationRate)
bit.flip
}
}
I also protect against ever adding duplicates and account for other edge cases. You're right, I accept that I might lose something valuable, but odds are very very good that most of the good traits will live on and still have some diversity. Also, I'm running "battles" just simulating targeting runs with WaveSim, which is not real battles and is maybe 20x faster than a real Robocode battle.
--Voidious 01:21, 27 April 2011 (UTC)