Saturday, 9 April 2016

Emotional links

Adaptive foraging, or the ability to harvest and collect items, is the main test-bed for swarm intelligences, as it resemble real life problems and mimic interesting social behaviours like ants and bees swarms.

So I am adapting my fractal AI code to deal with this problem, and as a first result, here I show you a video with only one agent (quite a small swarm!) so I can test if the new gadgets works OK.

The rocket now have a hook that will trap asteroids as a magnet. The hook is connected to the rocket with a rubber band, making the rocket-hook structure quite difficult to manage.

The goal is to go out there and trap asteroids, then take them to a deploy area, and start over again, but keep in mind that the life goes on, and the fuel will deplete soon, so it also have to take care of itself and try to keep health and energy levels high, as it always do.

The idea behind the simulation is simple: the hook has its own feelings -or a potential if you wish- so when it gets near an asteroid, potential will increase and it will feel "happy". This happiness transmits up to the host rocket, as hooks has no degree of freedom to use it with. As a result, rocket wants to be happy and make the hook happy too, resulting in a "inherited goal" that makes the rocket work hard doing what the hook likes more to do: collect asteroids.

Springs here act as the same time as physical links and emotional ones. To better understand the idea, imagine you want to learn some dance but you are a total mesh: one trick is to use sticks to keep you feet and arms always at the same distance from the teacher's ones, so you will dance as a puppet.

But once you are starting to learn the dance, you will need to eventually try without this help, so you would change those "physical springs" with emotional ones: you imagine the links are still there like "ghost springs", but springs with emotions that feel horrible (and cry loud) if you compress or stretch them. If you are emotionally connected with the springs (you dislike when they scream and cry) then you can "feel" the spring state as part of your own feelings, and it will make you try to follow the teachers movements in order to avoid springs "pain".

A more "Tarantino" way to imagine it is like this: virtual springs are attached to your arms and feet using fishing hooks, and you move just trying to avoid pain. I am sure you will now learn fast, even if the springs and hooks are just in your mind!


In this video, springs are both physical and emotional, but the emotional part is not related to the spring tensions or forces but instead on the final end's position. The idea is the same, but using a different formula for the spring potential.


  1. Sergio, el vídeo es realmente impresionante. Lo único es que, en mi humilde opinión (y como crítica constructiva), tal y como lo explicas yo creo que no se comprende lo absolutamente fascinante del hecho que comentas. Quiero decir; que alguien que llegue hasta esta entrada por casualidad, va a ver un vídeo muy chulo, pero creo que no va a entender lo asombroso del hecho de que este comportamiento inteligente que se observa no surge a partir de una programación "tradicional". Incluso el que haya seguido tu blog desde el principio yo creo que no lo verá claro del todo (estaba más claro al inicio, por cierto; cuando usabas programación lineal gracias a los dos vídeos con las charlas que impartiste).

    Creo que ayudaría mucho para que se entienda lo revolucionario de tu trabajo si hubiese una entrada dedicada totalmente a la base del algoritmo de este funcionamiento inteligente con "fractales" pero con mayor profundidad de lo que lo has hecho hasta ahora (e idealmente con un pequeño psuedocódigo que sirva de guía mental sobre lo que haces): porque precisamente un pequeño pseudocódigo explicativo es lo que más he echado en falta cuando he seguido tus entradas del blog.

    Un saludo!!

  2. Ops! Veo que aquí tienes bien explicada la base: No recordaba esta entrada.

    Voy a intentar crear un psuedocódigo a partir de lo que cuentas ahí y te lo paso para que lo revises y me digas si lo he interpretado bien, ¿vale?

    Un saludo!!