160 likes | 300 Views
Evolving Killer Robot Tanks. Jacob Eisenstein. Why Must We Fight?. Giving the people what they want. Essence of embodiment: Moving around and surviving in a hostile environment. Real creatures…. Tank fighting simulator Human players code tanks in Java ~4000 tank control programs online
E N D
Evolving Killer Robot Tanks Jacob Eisenstein
Why Must We Fight? • Giving the people what they want • Essence of embodiment: • Moving around and surviving in a hostile environment. • Real creatures…
Tank fighting simulator • Human players code tanks in Java • ~4000 tank control programs online • Directional “radar” sensor • Must be pointed at enemy to see • Actuators • Moving, turning takes time • Gun must cool before firing • No terrain effects • Walled combat area
Evolving Robocode Tanks • Use genetic programming to evolve tanks • Many reports of people trying this… • ...no reports of success! • Wrong encoding?
Representation • Each AFSM is a REX-like program • Fixed-length encoding • 64 operations per AFSM • ~2000 bits per genome onRammed onHit Gun Input onScan Base Other actuators
Function Input 1 Input 2 Output Example AFSM 1. Random ignore ignore 0.87 2. Divide Const_1 Const_2 0.5 3. Greater Than Line 1 Line 2 1 4. Normalize Angle Enemy bearing ignore -50 5. Multiply Line 4 Line 3 -50 6. Output Turn Gun Left Line 5 -50 … … … …
Training • Scaled fitness • Mutation pegged to diversity • Typical parameters • 200-500 individuals • 10% copy, 88% crossover, 2% elitism • This takes a LONG TIME!!! • Sample from ~25 starting positions • Up to 50,000 battles per generation • 0.2-1.0 seconds per battle • 20 minutes to 3 hours per generation
Results • Fixed starting position, one opponent • GP crushes all opposition • Beats “showcase” tank • Randomized starting positions • Wins 80% of battles against “learning” tank • Wins 50% against “showcase” tank • Multiple opponents • Beats 4 out of 5 “learning” tanks • Both… • Unsuccessful
GP is not Magic • A good encoding provides a huge advantage. • Previous researchers got this wrong • GP is really good at finding non-general solutions • Clever fitness functions can encourage general solutions • Much more computationally expensive
Function Input 1 Input 2 Output 1. Random ignore ignore 2. Divide Const_1 Const_2 3. Greater Than Line 1 Line 2 4. Normalize Angle Enemy bearing ignore 5. Absolute Value Line 4 ignore 6. Less Than Line 4 Const_90 7. And Line 6 Line 3 8. Multiply Const_10 Const_10 9. Less Than Enemy distance Line 8 10. And Line 9 Line 7 11. Multiply Line 10 Line 4 12. Output Turn gun left Line 11 Example Program 0.87 0.5 1 -50 50 1 1 100 0 0 0 0
Position Velocity Heading Energy Gun Heat Useful Constants 1 2 10 90 Enemy Distance Bearing Heading Energy Velocity Inputs
Outputs • Forward / Backward • Turn robot • Turn radar • Turn gun • Fire • Gun heat must be zero • Variable power
Functions • Greater than, less than, equal • + - * / % • Absolute value • Random number • Constant • And, or, not • Normalize relative angle