Professional Documents
Culture Documents
COSC343 - Assignment 2
Alex Gregory 4115039
Crossover
Its imperative that a crossover makes sense. My thinking was that, if the child is to
inherit some characteristics of the parents in a meaningful way, they should receive both
the action and the weight for that action from the same parent. For this reason, rather
than a simple crossover point, individual characteristic sets are mapped from parent A
and parent B into the child.
Selection Mechanism
Parents are chosen through a weighted random roulette style process. In the first few
generations, if the environment was sufficiently adverse, wed see that perhaps just one
creature would survive the length of the generation. The performance of the selection
algorithm was greatly improved in circumstances where there were alive creatures when
we heavily prioritised those creatures in the selection algorithm above dead creatures.
This means that, when there are alive creatures, it becomes highly unlikely that a dead
(even a recently dead one) creature will be selected for pass their genes onto the next
round.
Between creatures that are alive, there is effectively a standard roulette wheel style
selection weighted off their energy level at the end of that round.
The motivations or impulses from which the creature decides what to do are added
together and the largest one is selected.
e.g.
- there is a monster next to my left so (my chromosone informs me that) I should go to
the right (if legal) (weight 0.5)
- there is a strawberry to my right so (my chromosone informs me that) I should go to the
right (if legal) (weight 0.9)
- there is a strawberry south of me so (my chromosone informs me that) I should go
South (if legal) (weight 0.9)
- then:
The largest impulse is to the right (1.4), so Ill do that.
n by m arrays
The creature, monsters and food item operate within a space of 30x30. The dimensions n
and m are both 32. This means there is a buffer around the creature space which means
algorithms the creature (and monster) use to check their surroundings are simplified.
3,000
total energy levels at end of each
2,250
generation
1,500
750
0
generation 15 30 45 60 75 90 105 120 135 150 165 180 195
40
Remaining creaures at end of each generation
30
20
10
0
generation14 28 42 56 70 84 98 112 126 140 154 168 182 196
From the above graphs, its apparent that perhaps the large number of generations wasnt
so necessary. Graphs are useful - this wasnt apparent when watching the numbers. It
seemed at the time that incremental gains in the remaining energy level continued well
past 50-100 generations. I could well be wrong!
50
Average population energy
37.5
25
level (fitness)
12.5
-12.5
-25 Minimum
-37.5
generation16 32 48 64 80 96 112 128 144 160 176 192
Initially, I had only placed one strawberry at each strawberry drop location. I increased
this to a uniform 5, because I ran in to issues with competition hampering the
evolutionary algorithm.
Competition meant that, as the group of creatures evolved, their performance might
actually decrease due to scarcity. Rather than one lucky creature getting all the
strawberries because none of the others were interested, they would compete and exhaust
the supply very quickly. I found that, rather than reducing the number of steps per
generation, or number of creatures (made for a poor variety in behaviours), it was better
to offer a relative abundance of strawberries.
Creatures were slower to evolve to move away from monsters. Creatures developed
strange behaviours regarding mushrooms. Probably the most evolutionarily beneficial
was to not eat and ignore (let a mushroom have no bearing on your movements.
Compile
Click run.