Advertisement

A trainable AI-based mechanical arm.

Started by August 28, 2005 05:21 AM
12 comments, last by shadowisadog 19 years, 2 months ago
I just created an AI based mechanical arm that uses some neural networks (with genetic evolution) to learn some operation with a ball. It's possible to write some code to teach it what to do. You can found the app with some examples (fast and long shots) following this link (circa 1mb): http://www.e-nuts.net/index.php?p=r&l=en&c=goodies I hope you like it... Included with the app you found some files that allow you to create new plugins (if you need support, write me). Waiting for replies... -- Andrea Fontana Homepage: e-nuts.net [Edited by - Trikko on August 28, 2005 7:17:06 AM]
watched the video :)

did it actually learn to tap the ball into a suitable position and then smack it?

because that is really impressive
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
Advertisement
Quote: Original post by ErUs
watched the video :)

did it actually learn to tap the ball into a suitable position and then smack it?

because that is really impressive


Sure. If you download the app you can see that :) However the position and the way it use to hit the ball could change. It depends on the way the evolution take... The performances change too. A friend of mine take a video of a long shot of 800+ meters :))

--
Andrea Fontana
http://www.e-nuts.net
Very cool and inspirational!

I assume it also genetically evolves the starting point and speed of the ball?
(mine managed to hit it as far as 562!!)

I also noticed that the genetic algorithm easily get stuck at local maximums. Once it finds a solution which actually throws the ball somewhere it doesn't change the basic concept much, rather just fine-tuning the motion it's already doing. This results in never-improving cases where the ball never gets thrown further than 150 meters, but if I restart it reaches 300 meters after ten generations.

To solve this, perhaps you should keep several DNA's (spawned from individual random seeds) evolving alongside eachother, at least initially. My own approach to solving this (however I haven't yet tested it) is to change the degree of mutations with time.
The first mutations change 99% of the DNA. The following ones 95%... 92% and so on. This goes on all the way down to about 4% where it doesn't slow down anymore. At those low mutationrates it's all about fine-tuning the local maximum it found. After that initial heavy degree of mutation, it's a big chance that local maximum might be THE maximum.
----------------------~NQ - semi-pro graphical artist and hobbyist programmer
Quote: Original post by NQ
Very cool and inspirational!

I assume it also genetically evolves the starting point and speed of the ball?
(mine managed to hit it as far as 562!!)

I also noticed that the genetic algorithm easily get stuck at local maximums. Once it finds a solution which actually throws the ball somewhere it doesn't change the basic concept much, rather just fine-tuning the motion it's already doing. This results in never-improving cases where the ball never gets thrown further than 150 meters, but if I restart it reaches 300 meters after ten generations.

To solve this, perhaps you should keep several DNA's (spawned from individual random seeds) evolving alongside eachother, at least initially. My own approach to solving this (however I haven't yet tested it) is to change the degree of mutations with time.
The first mutations change 99% of the DNA. The following ones 95%... 92% and so on. This goes on all the way down to about 4% where it doesn't slow down anymore. At those low mutationrates it's all about fine-tuning the local maximum it found. After that initial heavy degree of mutation, it's a big chance that local maximum might be THE maximum.


Hmm it's a difficult topic and english is not my natural language but i try to explain my teory about it :)

1 - I thought about the possibility of keep some different DNA's families too. But i think there're some negative aspect. I think it's better to keep the way the evolution follows. I think if you "restart" natural evolution maybe human beings on the earth could be quite different (maybe more intelligent than us too..). It's funny to see some strange solutions it found... Maybe they aren't the best one, but it's the way the evolution takes.

2 - The "local min." problem is common on Neural Networks. By the way in this case if you see that the net get stuck wait for some minutes: usually it finds new life :) You can see on the DNA's list some letter after results.

'R' = DNA was created randomly.
'C' = DNA is a crossover.
'D' = DNA is a crossover (one of the parents is the previous winner)
'E' = DNA is a mutation of previous winner
'X' = 'R' or 'C' or 'D' or 'E' but there was a genetic error (one or more of 224 genes is totally random)

If you decreasing mutation's ratio it get stuck very easly. I just tried it: the result is a lot of generations like 200...[E] 200.000100[E], 200.000110[E] and so on... It doen't works. Instead if you don't decrease evolution ratio the result seems to be: 190.... 230[X] .. 231[E] 235[D] ecc..ecc..

I hope you can understand my explanation, i'm sorry for my english :)

Andrea Fontana

PS:
-Starting point doesn't change! Only the starting force on the ball evolves!
-An user gives me a movie of a 800+ shot :P Competition starts!!!

[Edited by - Trikko on August 29, 2005 10:39:53 AM]
Quote: Original post by Trikko
1 - I thought about the possibility of keep some different DNA's families too. But i think there're some negative aspect. I think it's better to keep the way the evolution follows. I think if you "restart" natural evolution maybe human beings on the earth could be quite different (maybe more intelligent than us too..). It's funny to see some strange solutions it found... Maybe they aren't the best one, but it's the way the evolution takes.

That's correct, and I see we think of it differently. To me, it doesn't matter if it's natural behaviour or not. All I want is the best solution to the problem, I don't care if it's not how it would have happened in nature.
Quote: 2 - The "local min." problem is common on Neural Networks. By the way in this case if you see that the net get stuck wait for some minutes: usually it finds new life :)


Alright, but when I try your application this does not happen. It reaches 350 at generation 90. Then nothing happens, and I let it work for a while. It reaches generation 700 and still nothing new have happened. It get stuck easily.
If I restart it, it reaches 400 at generation 50.

I do not mean to flame your work! I think your work is excellent! I am very impressed! I am trying to do very similiar thing, but with little creatures which are trying to find food.

Does anyone have some more examples of genetic algorithms illustrated this way? I would love to see more!

----------------------~NQ - semi-pro graphical artist and hobbyist programmer
Advertisement
What about if your application could detect when it's stuck, and backtrack over the history of generations to try to find a different branch of evolution? If it can't advance it would backtrack more and more. Of course there might be a bit more to this, like keeping a "branched" history instead of a list; I'd elaborate more but it's getting late. Impressive work by the way!
Quote: Original post by Jotaf
What about if your application could detect when it's stuck, and backtrack over the history of generations to try to find a different branch of evolution? If it can't advance it would backtrack more and more. Of course there might be a bit more to this, like keeping a "branched" history instead of a list; I'd elaborate more but it's getting late. Impressive work by the way!



Backtrace could be a fun idea... I'll think about it. :) Thank you!
When i finish my university-exam's session i include it!!

A. Fontana
Very nice :), makes me want to write my own neruel network app heh.

EDIT: btw about the crossover, you said that one of the parents is the previous winner, but how is the other parent decided? Is it the second to previous winner or do you pick just a random parent from the list? or do you just randomly create a new parent?
Quote: Original post by shadowisadog
Very nice :), makes me want to write my own neruel network app heh.

EDIT: btw about the crossover, you said that one of the parents is the previous winner, but how is the other parent decided? Is it the second to previous winner or do you pick just a random parent from the list? or do you just randomly create a new parent?


Thank you :)

'D' means: one of the parents is the previous winner, the other is pick randomly from population.

'C' means: two randomly picked parents from population (it's possible that one of them is the winner btw!)

A. Fontana
www.e-nuts.net

This topic is closed to new replies.

Advertisement