Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Evolving Phrases

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
Evolving Phrases
Kanzure
Member #3,669
July 2003
avatar

Quote:

I really don't think 'guessing games' are a good domain for GA - unless it develops psychic powers - what's the point of rewarding it for guessing right the first time, for example? :)

Guessing games are fine if the numbers are "randomly" generated by the computer, and if the AIs are given the information as to when the number was generated, how long it took, etc. Because we all know that there isn't a "truly random" function. Sure, it could be close, but if a computer can process the information to generate the number, can't it go reverse?

(Can't it?)

Wetimer
Member #1,622
November 2001

My post is now a three-page thread. Sweet...

A number guessing game. Hmm... Thats a neat idea, I think I might try that myself.

Quote:

I really don't think 'guessing games' are a good domain for GA - unless it develops psychic powers - what's the point of rewarding it for guessing right the first time, for example?

Its not as if the program has a single guess. The point is that the program is told whether its guess is too high or too low. The idea is to see whether or not the program will find an efficient algorithm for narrowing down the correct number in the lowest number of steps.

I once wrote a number guessing game with a twist. Essentially, it did not pick a number, instead it had a range.

Say, 0 to 100

If you guessed 33, it would take a look at the possible ranges
0-32 and 34-100

Since 34-100 is a bigger range, it would tell you that you number was too low. So, it cheated by always telling you consistent facts but always picking the path which give you the least amount of information.

Guessing games are fine if the numbers are "randomly" generated by the computer, and if the AIs are given the information as to when the number was generated, how long it took, etc. Because we all know that there isn't a "truly random" function. Sure, it could be close, but if a computer can process the information to generate the number, can't it go reverse?

That's another interesting expirment. Give the program the seed value, and see whether or not it can find the result of rand().

Quote:

And there in lies the problem. You should promote higher scores, but not discourage lower scores. You can't just kill something because it isn't preforming well, because otherwise, as you see, they don't preform well.

But that creates an intersting problem. If you can't kill anything then it's going to start sucking up resources very fast. But, ya know, it happens. Better than programs that don't evolve at all.

I suppose it depends on what you are interested in. But it seems to me if you are trying to in some measure simulate actual biological evolution, this route cannot be used since in real life less-fit organisms die off.

<code>if(Windows.State = Crash) Computer.halt();</code>

Billybob
Member #3,136
January 2003

Quote:

I suppose it depends on what you are interested in. But it seems to me if you are trying to in some measure simulate actual biological evolution, this route cannot be used since in real life less-fit organisms die off.

There you go again, bringing real life back into it ;) You're just gonna start a debate again.
So moving on:
Less-fit organisms don't die off naturally until there's a lack of resources, and a lack of resources shouldn't occur until far higher up in the evolutionary chain. Think of it this way, the organisms start off as very, very simple like cloning bacteria (even simplier than bacteria). They don't need many resources, and they're small. Considering the vastness of the world, to them they have a near unlimited amount of resources to consume.
Later, when they become more complex and naturally larger the resources become thinner, in reference to their size and consumption. But by this time they've evolved far enough (hopefully) to continue evolution even if they start to die unnatural deaths.

Here's a perfect example. Sexual reproduction is quite useful higher up in the evolutionary chain, and interestingly enough won't develop until that point.
As I have found, sexual reproduction isn't useful and can be quite dangerous at lower stages of evolution. It complicates matters for simple code and can lead to many failed generations. The last thing evolution at this stage needs is failed evolution (we're trying to avoid deaths in the first place!). Higher up though, when sexual reproduction develops naturally, it becomes very useful. At this point organisms start dieing unnaturally for lack of resources and normally any unique and useful mutations they had developed would be lost. But with sexual reproduction these unique mutations can be defused into the gene pool, so the organism has no need to stay alive. Other generations can carry on its achievements. At the higher levels sexual reproduction can hopefully be managed far better as well, limiting the failed generations caused by it.
Sexual reproduction then leads to choosing of mates, which leads to non-natural selection which can lead to all sorts of things. Culture, maybe? ;)

X-G
Member #856
December 2000
avatar

Quote:

And there in lies the problem. You should promote higher scores, but not discourage lower scores.

Yes you should. That's the whole point with natural selection; the weak die and don't get to reproduce. Thus, if you want to evolve phrases, you're going to have to plain and simple kill off those that don't perform well.

Quote:

Less-fit organisms don't die off naturally until there's a lack of resources

Predators. Intra-species violence. Death isn't necessary for evolution, just the inability to procreate.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Billybob
Member #3,136
January 2003

X-G, we've already shown that that won't work. At a much later stage they can handle it, but early on they just can't be unnaturally killed off.
See, from the weak will rise the strong. It takes a quite a few mutations to get a really good new set of genes, and no where during that process can that strain be killed off, otherwise you'll lose all the work and be stuck again at a primitive stage.
Much later in the evolutionary chain this problem is solved through the creation of sexual reproduction, and so the creations can die all they want while their genes persist and spread in the gene pool.

Rampage
Member #3,035
December 2002
avatar

Quote:

Much later in the evolutionary chain this problem is solved through the creation of sexual reproduction, and so the creations can die all they want while their genes persist and spread in the gene pool.

The whole point of this kind of exercises is to get the best "genes" to survive. In a controlled experiment, you know where you start (random chars) and where you want to be at the end (a coherent phrase). With such an specific criterion defined, it's quite easy to tell the good "genes" apart from the bad ones and thus the process is much faster.

-R

Trezker
Member #1,739
December 2001
avatar

Have a soul repository of fixed size.
Replace the least successful souls with the new ones.

Evert
Member #794
November 2000
avatar

Quote:

Less-fit organisms don't die off naturally until there's a lack of resources

It's purely a matter of statistics. Less fit individuals will by definition produce, on average, less offspring, so their genes will not spread as quickly as their more-fit brethern. So they `die off' gradually (but still quickly compared to an evolutionary timescale). This as opposed to them continuing to exist in the genepool until circumstances change.
Remember that species tend to be fairly homogeneous in their genetic makeup and tend to stay as they are as long as their environment stays constant, but can change quite rapidly if the environment suddenly changes (think of iceages favoring long hairs and thick hides, giving a slight edge to individuals with slightly longer hairs).

Wetimer
Member #1,622
November 2001

Quote:

Considering the vastness of the world, to them they have a near unlimited amount of resources to consume.

Provided that they can actually move to get to them.

Quote:

The whole point of this kind of exercises is to get the best "genes" to survive. In a controlled experiment, you know where you start (random chars) and where you want to be at the end (a coherent phrase). With such an specific criterion defined, it's quite easy to tell the good "genes" apart from the bad ones and thus the process is much faster.

But as seen, its actually very difficult to determine which mutation is better since they are all just random chars.

Quote:

It's purely a matter of statistics. Less fit individuals will by definition produce, on average, less offspring, so their genes will not spread as quickly as their more-fit brethern. So they `die off' gradually (but still quickly compared to an evolutionary timescale). This as opposed to them continuing to exist in the genepool until circumstances change.

Yes, so in any situaion the clock is clicking down. A good set of mutations must be found quickly!

<code>if(Windows.State = Crash) Computer.halt();</code>

Karadoc ~~
Member #2,749
September 2002
avatar

Quote:

And there in lies the problem. You should promote higher scores, but not discourage lower scores. You can't just kill something because it isn't preforming well, because otherwise, as you see, they don't preform well.

Yes, but the only mechanism I have for encouraging or discouraging is life and death. I can't do any more than that. And remember, I can't let everything live on, because my computer has finite memory. I want to do thounsands of generations with thounsands of new births in each generation. I can't afford to let them all live.
The surviving agents were randomly selected, but the probility was based on their score. So the poorer performers didn't just die straight away, they were just more likely to die. And the higher scoring ones were more likely to reproduce successfuly.
The dud breed did hang around, but just not for long enough to reach the next stable point.

One of the things I was going to do in my next attempt was to have them compete in a few different games, not just the one game. That way, they could afford to be good at just one game while they evolved towards a better solution in another game.
I would have them pair up to reproduce, and have kind of virtual geographic barriers appear and disappear between them over generations. That way, I would expect to start getting different species to appear. ie, different groups of agents such that if they pair up with one of their own species then the offspring will probably survive, but if they pair with a different species then it probably will not survive just because when the programs of different species mix, the result will not be good at any of the games.

Should be interesting.
But I don't have time for that now.

Quote:

Yes, so in any situaion the clock is clicking down. A good set of mutations must be found quickly!

Not really. At least, not the for the system I made. As I said, the probability of survival was weighted against the score in the game; but it was also weighted against the number of agents in the world. I had the probilities balanced such that the number of agents was more or less constant. If it got to high, then living conditions got rough; but when it was low, pretty much anything could survive.
Generally you want to make it so that they are competing against each other, not against the environment. I mean, they should never just die out from not being good enough for the programmers standards! They should only die out if they are not good enough compaired to the others. Otherwise, they would all just die before they got anywhere.

-----------

Tobias Dammers
Member #2,604
August 2002
avatar

Use a relative quality rather than absolute. That is, kill the individuals that perform worst and replace them by mixtures of the best. In the beginning, all individuals will perform equally badly, but as soon as one of them is slightly better, it will survive. The rest will be killed until there are more and more "slightly better" variations, the best of which will generally survive. That's how evolution works.
BTW, it is a "fact" that this mechanism does work for certain scenarios. Not just theory. The assumption that this mechanism is the driving force behind the origin of Life is not (and will never be) a proven "fact", but according to science (which is based on rational thinking rather than wild guessing), it is the most likely theory. Which, to the scientist, is the closest to a fact you can ever get. In that, it is just as much a fact as the "theory" that says that heavy objects will drop if you let go of them, or the one that says that all humans are mortal (I'm still alive, aren't I?).

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Wetimer
Member #1,622
November 2001

Quote:

Not really. At least, not the for the system I made. As I said, the probability of survival was weighted against the score in the game; but it was also weighted against the number of agents in the world. I had the probilities balanced such that the number of agents was more or less constant. If it got to high, then living conditions got rough; but when it was low, pretty much anything could survive.
Generally you want to make it so that they are competing against each other, not against the environment. I mean, they should never just die out from not being good enough for the programmers standards! They should only die out if they are not good enough compaired to the others. Otherwise, they would all just die before they got anywhere.

But still, time is working against any mutation. A better way must be found in a relativly small amount of time because during the transition it will perform far poorer then its relatives who are not transforming.

I imitated your original experiment. I made a stack machine and took the item that was on the top of the stack as the guess. I then pushed a -1 if it was too high and a 1 if it was too low. I started with completely random ops, which resulted in my original ancestor aborting because it tried some illegal operations.

My mutation system has the possiblity of duplicating and cutting sections of code. IT appears that given enough time, all the code causing problems is cut out, so the little buggers end up being able to guess. They found a rather innovative solution the problem. One of my OPS was a stacksize op, it pushed the size of the stack onto the stack. Since everytime the program ran it increased the stack size by one, this ended up being a crude counting mechanism, guessing every option one by one. Which was enough to do better then the crashing and smashing relatives. However, as with your version, they never got past this stage.

<code>if(Windows.State = Crash) Computer.halt();</code>

Evert
Member #794
November 2000
avatar

Quote:

because during the transition it will perform far poorer then its relatives who are not transforming.

In other words, you have reached a locally stable optimum, which you cannot evolve out of. I don't think it's really a problem to find such a thing in a simulation. After all, natural selection also tends to settle in the closest (quasi) equilibrium state, which is not nescessarily the best state.
As an example, consider the human eye. There are very many obvious design flaws in it that could be remedied. However, this doesn't happen, partially because the changes are rather involved and partially because there's no `pressure' from natural selection to do so: our eyes are good enough for what they're supposed to do.

Trezker
Member #1,739
December 2001
avatar

Well, since humans used to live to about 30 years with some luck, our bodies haven't evolved to deal with being alive for 100 years.
But I wonder how long it will take before our genes evolve to adapt, if it ever happens. Humanity is so chaotic I doubt there is any positive evolution going on.

Rampage
Member #3,035
December 2002
avatar

Quote:

Well, since humans used to live to about 30 years with some luck, our bodies haven't evolved to deal with being alive for 100 years.

I know I'm going to live 800 years. Maybe some examinations to my body will tell you how humans will be in the future! :o;D

-R

Wetimer
Member #1,622
November 2001

On the 30 years. I'm not sure thats actually accurate. The average life may have been 30 years, but thats majorly affected by large numbers of infant and children deaths. If you consider the life expectancy of a twenty-year old male (because females had a tendency to die in childbirth) I don't think its changed nearly that much.

Quote:

In other words, you have reached a locally stable optimum, which you cannot evolve out of. I don't think it's really a problem to find such a thing in a simulation. After all, natural selection also tends to settle in the closest (quasi) equilibrium state, which is not nescessarily the best state.

So, we'd expect Evolution to stay stagnant for a while until some change changed the "rules of the game" forcing a whole new method to arise?

<code>if(Windows.State = Crash) Computer.halt();</code>

 1   2   3 


Go to: