Thursday, 28 May 2015

Entropic vs Fractal AI

This blog has been devoted to "Entropic Emotional AI" until some weeks ago. Now I call this "old" implementation of the AI the "linear" or the "entropic" version, while now my attention has shifted to "Fractal Emotional AI".

Why? What makes this change in the wording means? Is "Fractal" any better that "Entropic"?

Short answer is Fractal is much better, powerful and simplier. It is the big brother of the now weak Entropic AI. It performs much better that the previous one in terms of the emerging intelligent behaviours and, more important (or not) it is far more flexible and extendable than it was never.



Lets compare the same frame of a similar simulation with both versions. Fractal and Linear versions used 500 futures both, but Fractal was thinking 50 seconds ahead, while Linear version only allowed up to 20 seconds. Anyway, using more that 20 is a total waste of CPU as you will see.

Lets start with the fractal version:

Fractal AI - 500 futures - 50 seconds

The most important difference is that the fractal version is capable of thinking 50 seconds ahead and more, there is no limit. The fractal growth is made in such a way that all the track can be "scanned" in one single instant.

Now lets see how did the linear/entropic version:

Linear (entropic) AI - 500 futures - 20 seconds
Linear version is not capable of thinking even 20 seconds ahead, most of the futures it thinks end up a few seconds after start. The futures can't even reach a 5 or 6 seconds time horizon! That is the main difference.

In the linear version, a "crazy monkey" was in charge to drive the kart during those endless 20 seconds, moving the joysticks randomly here and there. But none of the monkeys was able to keep it running for more than 5 or 6 seconds.


Crazy monkeys were never a good idea anyhow, I noted it in my first talk, but without the help of fractal growth, what else do you have?

Those are the main differences:

  1. Detecting the outcomes for your action any number of seconds ahead means you can decide not to pass another kart because you don't like champagne, and you can foresee that this action would lead you to win the race and then to have to drink it... no way! The power of this unlimited time horizon to think ahead is the fractal magic doing its work.
  2. The fractal size -or its weight if you think of it as a plant growing up- tells you how good or bad a given option is, this means no need to use strange "mood" or complicated "gain" feelings, just positive enjoys and simple gain feelings.
  3. The fractal growth is not governed by differentinal changes on the agent's state, so there is no need to store the "old" values for all parameters.
  4. Not using strange feelings means there is no need to calculate strange "stimulis" derived from the real one associated with each feeling. For goals to work in the linear version I needed up to 3 of them. Now they are all gone.
  5. Fractals are know for scanning the space optimally. To get a similar effect, if even possible, you would need to use a number of linear futures orders of magntude bigger than with a fractal. Fractal AI is CPU friendly as CPU time depends linearly on time ahead used. No NP problem here.
  6. The "shape" of the fractal (or its laws of growth) has more degrees of freedom than lines had. This means the fractal AI can adapt to different environments much better that linear ever could.
  7. Some other secondary "artifacts" I needed to add to the linear version are now obsolete. The main one is the grid size and deleting the similar ending futures (the entropic part of the algorithm) but also some others like ReactionTime or Urgency in the gain feelings.
  8. If you don't need to prune the repeated futures on each options, you don't need options at all. No need to decide witch decisions will be your arbitrary chossen options.
  9. Also, there is more need of controlling joystick "sensitivity", as there no option to choose, you are free to try out any random action you could take just by having a fractal growing in that particular direction.

This all means that the fractal AI, althought being much more advanced and powerful than entropic one was, is also much simplier. Fractals are simplier than lines, but also goals, feelings and the rest of the ingredients are now simplified to a minimun or even deleted from the code.

To get an idea of how good it can be, have a look at the "oldy but goldy" kart performing an almost perfect lap at the standar test track using an unfinished version of the fractal AI (items 8 and 9 are not still implemented, that is why it crashes at the end):


In some day items 8 and 9 will be ready, we will leave beta stage in that moment and get to version 1.0, but there are more things in the way for V2.0, of course!

If you wish to compare with a similar "old AI" video, check this one, the time limit of 5-6 seconds is quite obvious on dificult sections, as the karts are not aware of the problems behind the next curve, they can not "see" it at all:


No comments:

Post a Comment