Autonomous Agents and Genetic Algorithms

Today Simon spent hours watching videos and reading Daniel Shiffman’s book The Nature of Code, concentrating on more complicated matters than ever: autonomous agents and evolution (genetic algorithms). In The Nature of Code there are two separate chapters covering these topics.  The term autonomous agent is defined as “an entity that makes its own choices about how to act in its environment without any influence from a leader or global plan”. This basically means that Simon has decided to try programming smart entities, that are like living things (have their DNA’s, behaviours, evolution).

The Autonomous Agent chapter also talks about steering force:

 

In the videos below, Simon has studied the steering behaviors in Daniel Shiffman’s code (Seek, Flee and Arrival) and changed the code slightly (third video) to be able to switch between the behaviours with a click of the mouse:

I also saw Simon go through the paper called Steering behaviours For Autonomous Characters by Craig W. Reynolds and reading about Persuit and Evade steering behaviours at this game development page.

In the video below Simon adjusted the Evolve Flow Field code to be able to see the possible behaviours (velocity vectors) of his smart rockets.

The code comes from the chapter Evolution of Code in Daniel Shiffman’s book, the chapter mainly devoted to genetic algorithms: it looks at the core principles behind Darwinian evolutionary theory and develops a set of algorithms inspired by these principles.

One of the most interesting notions Simon came across today was fitness, as in survival of the fittest. In the video you see Simon creating obstacles for the smart rockets. Together we observed how, as many generations of rockets passed, they learned to go around the obstacles better. This was possible because the rocket’s fitness was programmed to be greatly reduced every time it hit an obstacle.

All the rockets also have DNA’s: “We are marching through the array of PVectors and applying them one at a time as a force to the rocket”, Daniel Shiffman explains.

Simon also learned about genotypes and phenotypes, mating pool, crossover and mutation. He loved Daniel Shiffman’s example about haw many generations of strings with 18 random “genes” it would take to write “To be or not to be”.

Shakespear Evolution 18 Apr 2017

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s