Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Dept.

of Computer Science
Using Genetic Algorithms to Teach a Robot to Fight
Søren Atmakuri Davidsen
Introduction problem we want to solve. After each round, the fitness of the robot is calculated
by determining how many opponents it hit, and how
Genetic algorithms is a concept from machine learn- many hits it took itself.
ing, and is used for searching a solution to a problem.
Radar
Cannon
In this exhibit we show how we can use genetic algo- After many many rounds, our robot is starting to be-
(bearing)
rithms to create a robot that learns how to fight with- Seriously, you make Robots come smarter. We have to remember that the robot
started from nothing, everything it knows, it has
out any direct programming given by us: The fighting
algorithm is created by a genetic algorithm. fight for real? (Is it safe?) learned by itself, using the genetic algorithm.
Wheels
No and Yes :-) RoboCode is a game where you win (heading)
What are genetic algorithms? by programming a robot to shoot its opponents. But,
it is a good idea. We would like to test our Robots Figure 3: RoboCode tank concepts
Everyone knows the famous researcher Charles Dar- using real hardware in a fight to death against pitiful
win and his principle survival of the fittest. Genetic al- humans.
gorithms is the computer-science version of this prin-
ciple.
To program the Robot is easy, using the Java pro- How can robots learn to fight
gramming language. The program contains informa-
Genetic algorithms come from how chromosomes tion about how the robot should behave in given situ- using a genetic algorithm?
evolves in any living creature in nature. One gener- ations.
ation creates the next generation by taking features Here we look at 3 such situations: As seen, the Robot’s “program” is a series of instruc-
from parents, and randomly mutating. For each gen- tions to carry out, in different situations. As time and
eration, only the fittest will be considered as parents 1. What to do when Robot is idle? energy is limited, we fix the number of instructions the
for the next generation. Robot can carry out within it’s limits.
2. What to do when Robot see other Robot?
Parent 1 3. What to do when Robot is hit by bullet?
Evolving the Robot against an opponent
Parent 2 In each of the situations, we can give the robot a num-
ber of instructions on what to do, these are: For each generation, there are 100 new little Robots
Child created from the parents. Cruelly, we immediately
1. Turn Robot left or right. send them to fight with an opponent. The Robots with Why is this all useful?
Figure 1: Crossover – some gene-material from each highest score are selected to become parents for the
2. Drive Robot forward or backward. next generation.
parent.
3. Look for other Robots. For each new generation of little Robots, the princi-
ple of the genetic algorithm is, that the Robots selected
Before mutation
4. Turn Robot’s cannon. will be better fighters, by breeding only on the best
After mutation parents. Fighting Robots are just one example of how genetic
5. Fire Robot’s cannon. algorithms are useful for solving a problem. Genetic
Figure 2: Mutation – gene-material contains small ran- algorithms are useful because they can find solutions
dom changes. Each of the instructions can take some values. For ex- Results to problems, which are otherwise not obvious by tra-
By letting the genetic algorithm evolve over many ample: In what direction should we turn the Robot? ditional optimization techniques used by engineers.
generations, we hope to find the best chromosomes. Or, how big a bullet should we use when firing the We have designed our robot so two parts of it will be
cannon? Each instruction takes energy and time from created by genetic algorithms: Genetic algorithms are used many places in the
In nature, genes are related to how we look and func- the Robot. In order to make the game fair, each Robot real world, some few examples from ISRO (Indian
1. what to do when we are hit by a bullet.
tion, for example some genes decide our gender and participating, has limited energy and time to carry out Space Research Organisation): Scheduling satellite
eye-color, while others have impact on how fast we its instructions. When a Robot is hit by a bullet, it will 2. what to do when we see an enemy. payloads, designing communication antennas and re-
can run or for how long we can run. In computer loose some energy. When energy is 0, the Robot’s life A part from this, the robot is very simple, and will configurable hardware modules for long-term space
science, the genes likewise are a representation of the is over. drive around randomly on the battlefield. missions (Mars the latest)

You might also like