Tuesday, 9 June 2015

A finished version of Fractal AI

Today I will show you what I consider to be the first finished version of the "Fract Emotional Artificial Intelligence".

The Fractal AI is now parameter less, meaning all those params I needed to set manually, like the "evapore ratio", are now governed by the AI.

Nice fractal thinking paths.

Before telling you about the history behind, please watch a video of the Fractal AI V2.0 (2.0 for no particular reason except it follows 1.9). It is just the same old boring pair of rockets trying to collect energy from drops as fast as posible, but this time, they sports the newest version of the AI (visible from the last third of the video).

Change log

So what has changed from the last post? I was telling you about the implementation of an exclusion principle to avoid dense areas. I finished it, and I didn't need to use momentums -velocities- at all, it was not needed, fractal nature of the algorithm makes it irrelevant.

But the resulting AI was not what I spected. It was terrible conservative, watching it you would say it was so clever it didn't want to risk it self. The exclusion principle by its own was not enough.

Then I turned into the "Evapore ratio" searching for a solution. This evapore ratio defines how many futures are replaced by others each second, or, inversely, how long a future will last, in average. If evapore was set to zero, average life of futures tend to infinity, so they trace simple lines.

So I tried to make this evapore automatically adjusted by the AI, specting it to solve the problem of this excess of prudence. It idn't work.

Then I realized something fundamental was missing. There was the need for a second AI parameter: The "Sensibility" to the feelings that the agent's goals triger.

It sounds extrange at first, but it makes quite a lot of "sense" (punch intended): Initially, I had an "Entropic Intelligence" that was linear and goal-less, just using "blind" entropic forces. Then, I added feelings, and things changed for better. Now, I have added fractals as a sustitutive to linear paths, again for better.

So, if a parameter called "Evaporation" was changing the paths from lineal ones when evapore ratio was set to zero, to a more and more fractally shaped path, then I needed a second parameter, simetrically defined, to control how "emotional" the algorithm goes.

I called it "Sense", and basically makes all feelings weight to be augmented or diminised in the decision taking proccess. Using evapore and sense simultaneously realy made the magic.

I start playing with different combinations of "Evapore" and "Sense" values, noticing I could simulate quite a range of different behaviours:

Evapore=0 and Sense=0
It was the old and first "Common Sense" linear algorithm I came to in my first posts.

Evapore=0 and Sense=1
It correspond to the linear and emotional version, what I called "Entropic Emotional Intellignce"

Evapore=1 and Sense=0
It is a new kind of "Common Sense", one much better than the linear one, as it replaces boring lines with nice fractals.

Evapore=1 and Sense=1
It is the "Fractal Emotional Artificial Intelligent" it is pure form, the best of all four.

Finally, I tried to make the AI to automatically adjust this "Sense" for me, and voila, it worked fine this time. The introduction of the "sense" factor allowed me to fine-tune the AI and get a nice video.

But evaporation is not an easy parameter to manually choose, playing around with the fractality was dangerous, as more of it was better, until a point in witch it becomaes dangerous. Same goes for the "Sense" parameter. There was a "Sweet point" for each situation.

The final step was to make BOTH of the parameter to be simultaneously adjusted by the AI. It closed the loop. The AI was parameter-less for the first time

I will show you some frames of another discarted video showing the effect of each parameter. Please note the two level meters on the player's left, they represent the evapore and sense ratios used at each moment, both ranging from 0 to 5 (again, the 5 limit is for no particular reason).

 Evapore ratio at its maximum.

Green dots accounts for good things to come, points were the fractal cloned, usually after a good point (a big drop) is reached, while red ones account for places where a future decided to "suicide" because the neighborhood was too dense for him (the "exclusion principle" in action), quite like in a "game of life".

There are also red points where the future ends because of the agent's death, but they are another kind of "red points", as not all the systems need to have a "dead state".

Goal less fractal "Common Sense"

This last frame correspond to Sense=0. The AI continuously goes into this "Common Sense" configuration when the situation gets too dangerous. It switches off feelings, fix the surviving problem, and when done, it switch on again the feelings and pursue the goals actively again. It is a "Fractal Common Sense", a safe auto pilot that automatically engages when needed.

What a Fractal AI is

You can think of it in some different ways, all correct.

Personally, I think of it as a "fractalized" version of my previous "Entropic Emotional Intelligence". In the fractal version, all the complex heuristic added to make the linear version to work, are nicely gone.

Also, it is a fractal "Conway's Game of Life", a cellular automata that decides with one clones and witch one evaporates using simpler rules: nice places tend to make futures to clone, while too dense areas tend to make them evaporate. The resulting evolution of the cellular automata is the way the futures spread into the future, exploring the possibilities optimally. Ah! And the exact rules used adapt continuously so the growth is always maximized.

But it also performs as a truly evolutive algortihm, as the fractals traveling from different initial direction evolve by evaporating the worst postioned futures while cloning -and mutating- the best ones, making decisions based on how fast each fractal fagocitated each other.

Just to make it better, the algortihm is actually easy and naturally paralellizable, in a sense that really fits with the paradigm of quantum computing. The algortihm is indeed a natural quantum algorithm, just downgraded to make it work on non-quantum computers, like my PC. If you should want to "revert" it into its natural form of a quantum algorithm, some of the code just would need to be wiped out, but nothing added.

So basically the Fractal AI algorithm is a perfect mix of several "magic algortihms": an emotional one, a cellular automaton, a fractal one and, and an evolutive algorithm, all packed up together into a single quantum algorithm simplier than any of the above alone.

I is worth noting that the resulting algorithm has a very low computational cost, the CPU time needed is low and, more importantly, it grows LINEARLY with all the parameters involved. Even when the AI controls several agents, the collision detection phase, the one that is usually O(n²), is also linear O(n) in this case thanks to quantum computing or, equivalently, thanks to the fractal nature of it.

I will add a last video where all those "debbuging options" are switched on so you can see, real time, how the fractal evolves, "sniffing" the possible outcomes for the different decisions. This time only 100 futures were used, so the AI is not capable of decinding optimally when there are a few disperse drops.

What is next?

Being "perfect" doesn't mean you can't improve it. It means that, given the fixed parameters you supplied, it performs as good as it can be done.

In those videos, I had to choose the following parameters:

1- Seconds to think in advance (20 or 30 seconds for instance).
2- The number of futures to use for each agent (200 for instance).
3- The precision or FPS (Frames per Second) of the simulation (20 FPS).
4- The goal set the agent has to follow (keep health, keep energy, get drops and love speeding).
5- The relative strength of the feelings coming from the goals (1, 1, 5 and 0.5 in this example).

One to tree are related to how many resources you can invest on this AI, so the more the better, and it is OK to be manually set. Fourth is the goal set you want the AI to follow. Again, you should define it some how manually. But the fifth one, the relative strength of the goals, can be directly controlled by the AI and will be in some days or weeks.
So the next steps intended are:

1- Make use of the fourth "transcendental feeling" to simulate deep collaboration, a "hive" of agents. I don't remeber commenting about it on the blog, so I will have to explain it when I have the first videos.

2- Make the relative strengths of the actual goals to change automatically so the fourth feeling is maximized. It is similar with the old idea of "layered entropic intelligence" form my distant pass, but now, under the umbrella of fractals, it is way much simplier to code and use, and more CPU friendly too!

3- Try to make the low level goals automatically created by the AI. This will be a tricky part, as there are a lot of combintions of sensorial data you can use, so a proper "evolutive" solution will be needed. I already thought about it when I was developing the Entropic version, and again, using fractals makes it all much simplier to implement, so may be I will be able to do it (but I am not quite sure now).

When all those points are coded, it will allows us something great: You define the problem by giving a simulaton of it, then set some CPU limits (number of seconds and futures) and finally a high level "transcendental" goal like "Win the race", "Take care of the colony" or "Bring me beer" (my personal favourite).

The AI will then construct the optimal goal set for you (an optimal base of it using grade one polynomials of the sensor outputs), give them the optimal relative strenghts, adjust the AI internal params of Evapore and Sense again optimaly for the given problem, and then use as many agents as it is controlling (hundreds of drones or just a single robot) to follow your high level order, without any human help, in a deeply collaborative and intelligent way.

No comments:

Post a Comment