Now we're going to look at
NetLogo implementation of the Robbie the robot genetic algorithm
This interface is a little bit complicated so I go through it
So there is two parts to this interface, there's the genetic algorithm
part,
and then there's this us part that simulates Robbie
in its environment. So let's run the genetic algorithm.
we set the population size here
I'm actually gonna set it to 60.
One disadvantage of this net logo versions is
kinda slow so I can't run it on the same size population that I ran the C
language version and speed up this
to make its fast as possible as to speed up all the way
Okay so the population size 60. The mutation rate
remember after parents are crossed over to create an offspring the offspring is
mutated.
this is the probability mutation at each
value in the string there's a 0.05 probability
that each value will be mutated this means on average
about 12 mutations per string.
It's kind of high but let's leave it there for now will experiment with this later on
okay so now I do setup
just takes a little while because
slow and what you gonna see
each the individuals in the population is represented here.
I have 60 individuals in the population this is the first-generation where
everything's random
these each represent a random strategy and
the vertical axis here represents the fitness
see concede that these are all quite low fitness
this one here is the highest fitness in the population
the horizontal axis represents how similar
these other individuals are to the best individual in terms of
this stream that represents the strategy
how similar the strings are okay so
week either just run this forever we can run it for certain number generations
and I've set the number generation to 50 so let's run it
and over here it tells us
the best fitness at each generation and
also gives a representation of the strategy itself in terms of
with the actions are in that strategy that's not that useful
right now because a we can't really interpret
how good a strategy is by looking at that string of course
but now I can just watch this the population
change overtime and you can see a plot of the
best fitness of the best individual in each generation here
you can see it's quite slow
okay well got a generation 50
and it went from -74
of the best as the best fitness all the way to
7.5
is the best fitness. So now we can do is we can
look at what's the best individual does
in a given environment. So I set up the environment
now that display switches to the individual
his the best individual and
here's what it's going to do in this particular configuration of cans for
each of the cans
the it to these orange dots is a can, so I can do is step through the best
strategy
well here with it set is
at each time step this individual is just staying put
okay it's ok it's zero fitness let's try a different environment
here's a different configuration of can still just stay put
here's a different configuration kids well
there's some configuration of cancer this individual
actually does something cuz it got higher than
0 average fitness but I guess we haven't found it yet
ok it picked up a can it had a can on its site and picked up a can
okay so it gets a score of 10 on this round
alright well let some toggle display
that goes back to our genetic algorithm display and lets
try going for another 50 generations starting from
the population we have now. I accidentally press Setup
so I destroyed the population we had now so let's try that again
go in generations so this is a different run
it starts out with the different initial population have random strings
so we'll see it different progression
and now let me skip ahead to generation fifty in the video
okay here we are. generation 50 this is done a little bit better the best
fitness is
18 .5 so let's watch the best individual
so we see stepping through it actually made some moves but it didn't pick up
any cans.
let's try different environment hear it actually picked up a can
Ah it's picking up some cans so but that is going backwards and going
again out stack anyway this is just to show you this model you can download it
on from our course materials pages called RobbieGA.nlogo
and you could play with it we're gonna do some exercises using it for the
homework in this unit