Sign in to follow this  
phyitbos

Evolutionary Algorithms + Neural Net

Recommended Posts

I am trying to create a program that models simple artificial life similar to what the guy made in this video:

[media]http://www.youtube.com/watch?v=2kupe2ZKK58&list=UUYidgLlQS_D-xNcoTLb0n6w&index=17&feature=plcp[/media]

So far my program has some critters that scurry around my screen looking for food but with no "brain". I've never messed with neural networks before but have been reading up on them in books and online for the past few days. This particular case seems a bit different from your basic neural network in some aspects though.

It seems that his NN doesn't use any type of learning or error measuring, but rather it does this from the evolution of the creatures? I'm thinking that the weights are randomly initialized and that the creatures that are best fit / survive in general have their weights copied over to the next generation (with crossover and random mutation)? He says the brain consists of a directed graph where the edges are weights, and I'm guessing this is what he means?

Share this post


Link to post
Share on other sites
I have heard of this type of thing. More often I've heard of GAs using a simple rules-based tree where the rules get crossbred and mutated. Essentially any "brain" that can be summarised as a combination of numbers and logical operations could be cross-bred, although results may vary. Personally I think it's a waste to use NNs without using one of their major features.

Share this post


Link to post
Share on other sites
[url="http://en.wikipedia.org/wiki/Genetic_algorithm"]Genetic Algorithm[/url]
[url="http://www.youtube.com/results?search_query=genetic+algorithm"]Videos[/url]
[url="https://www.google.com/webhp?sourceid=chrome-instant&ie=UTF-8&ion=1#hl=en&safe=off&sclient=psy-ab&q=genetic+algorithm+in+games&oq=genetic+algorithm+in+games&gs_l=hp.3..0j0i8i30l3.1473.51425.0.51610.48.29.7.5.5.2.200.2598.21j7j1.29.0.les;..1.0...1c.1.UyVAOm2DpoA&pbx=1&ion=1&pws=0&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&fp=e144f1b25e45ee57&biw=1339&bih=1010"]Genetic Algorithms in Games[/url]

Share this post


Link to post
Share on other sites
if you are looking for a NN algorithm that uses evolutionary methods have a look at http://www.cs.ucf.edu/~kstanley/neat.html. There are libraries there for different languages so you can just plug your inputs in if you don't want to implement it yourself.

Share this post


Link to post
Share on other sites
Just a suggestion, but if you manage to get it work, you should try higher level evolution as in what benefits the society, not what benefits the individual.

Like have a few areas, with little traffic between them, and have inputs for positions and directions etc. of other beings.

So i would imagine the best societies beings would aim for food nobody else is aiming for, while the worst just go for the nearest food, slowing down their growth as they fight for food.

Share this post


Link to post
Share on other sites
[quote name='Waterlimon' timestamp='1349168617' post='4986001']
Just a suggestion, but if you manage to get it work, you should try higher level evolution as in what benefits the society, not what benefits the individual.

Like have a few areas, with little traffic between them, and have inputs for positions and directions etc. of other beings.

So i would imagine the best societies beings would aim for food nobody else is aiming for, while the worst just go for the nearest food, slowing down their growth as they fight for food.
[/quote]

That's interesting in that it now starts to involve [url="http://en.wikipedia.org/wiki/Game_theory"]game theory[/url] -- especially [url="http://en.wikipedia.org/wiki/Nash_equilibrium"]Nash equilibria[/url]. The problem is that "benefiting society" is really hard to codify without getting completely subjective.

One interesting note is that evolutionary algorithms will benefit society as long as you encode the right parameters. For example, if you were to rate the pieces of food not only by distance, but by proximity of other agents to it -- and then also keep track of successes and failures to acquire those items-- you will start to see agents being less competitive for the food since it benefits them to go slightly farther to get the guaranteed hit. As per Adam Smith, Nash, etc., you are still self-serving, but doing it in a way that is non-destructive to the group as a whole (via [url="http://en.wikipedia.org/wiki/Pareto_efficiency"]Pareto improvements[/url]).

Share this post


Link to post
Share on other sites
[quote name='Waterlimon' timestamp='1349168617' post='4986001']
So i would imagine the best societies beings would aim for food nobody else is aiming for, while the worst just go for the nearest food, slowing down their growth as they fight for food.
[/quote]

Along those lines there is also Novelty Search [url="http://eplex.cs.ucf.edu/noveltysearch/userspage/"]http://eplex.cs.ucf.edu/noveltysearch/userspage/[/url]

Share this post


Link to post
Share on other sites
BTW, as a follow up on the "fighting for food" and game theory bit, check out various references to the "Hawk-Dove game" and evolutionary game theory. Basic rules are:
[list]
[*]Doves will eat together
[*]Hawks scare off doves and eat the food
[*]Hawks fight other hawks -- and can't eat while doing so
[/list]
Therefore, if population is doves, it pays to be a hawk. If population is (multiple) hawks, it pays to be a dove. If there is 1 hawk, it is a toss-up, really.

Share this post


Link to post
Share on other sites
[quote name='IADaveMark' timestamp='1349200028' post='4986115']
That's interesting in that it now starts to involve [url="http://en.wikipedia.org/wiki/Game_theory"]game theory[/url] -- especially [url="http://en.wikipedia.org/wiki/Nash_equilibrium"]Nash equilibria[/url]. The problem is that "benefiting society" is really hard to codify without getting completely subjective.
[/quote]

Although I'd be the first to agree that the leap from real life to a game theoretic model is huge and fraught with peril, there [i]are[/i] some standard ideas about what "social optimality" means.

The idea is just:
- You have [i]n[/i] players
- Each player [i]i[/i] will choose an action; we'll call it [i]x[sub]i[/sub][/i].
- Each player [i]i[/i] gets a real-number reward, [i]r[sub]i[/sub][/i]([i]x[sub]1[/sub][/i], [i]x[sub]2[/sub][/i], ..., [i]x[sub]n[/sub][/i]).
- The "societal welfare" is the sum [i]R[/i]([i]x[sub]1[/sub][/i], [i]x[sub]2[/sub][/i], ..., [i]x[sub]n[/sub][/i]) = [i]r[sub]1[/sub][/i]([i]x[sub]1[/sub][/i], [i]x[sub]2[/sub][/i], ..., [i]x[sub]n[/sub][/i]) + ... + [i]r[sub]n[/sub][/i]([i]x[sub]1[/sub][/i], [i]x[sub]2[/sub][/i], ..., [i]x[sub]n[/sub][/i]) .
- The social optimum is the point ([i]x[sub]1[/sub][/i], [i]x[sub]2[/sub][/i], ..., [i]x[sub]n[/sub][/i]) that minimizes [i]R[/i].

The important thing is that the Nash equilibrium and the social optimum will not generally be the same point. The difference between social welfares at the two points is called the [i]price of anarchy.[/i]

The classic example is the prisoner's dilemma. Referring to this table (the first one to pop up in Google Image Search),
[img]http://www.beyondintractability.org/cic_images/aha/Game-Theory-prisoners-dilemma.gif[/img]
the Nash equilibrium is (Defect, Defect), which gives rewards of (2,2) and a social welfare of 4. But had the players chosen (Cooperate, Cooperate), they'd have gotten rewards of (3,3) and a social welfare of 6. So for this game the price of anarchy is 6-4 = 2.

If you're a benign ruler who gets to choose the rules by which your society runs, you can choose to tax certain actions in such a way (i.e., modify the individual reward functions) so that the Nash equilibrium [i]is[/i] the social optimum. The people who figured this out got a Nobel prize in economics (although in retrospect the math doesn't seem so difficult).

The extent to which these models describe the behavior of real humans is of course debatable, and is a subject of empirical study in psychology and the social sciences.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this