2

So, since the answer to this basically said that I really should look into encoding the genes of my creatures*, which I did!

So, I created the following neat little (byte[]-) structure:

Gene = { X, X, X, X, Y, Y, Y, Y, Z, Z, Z, Z }

Where

  • X = Represents a certain trait in a creature.

  • Y = These blocks controls how, if and when crossovers and mutation will happen (16 possible values, I think that should be more than enough!)

  • Z = The length of the strand (basically, this is for future builds, where I want to let the evolution control even the length of the entire strand).

(So Z and Y can be thought of as META-information)

(Before you ask, yes, that's a 12-byte :) )

My question to you are as follows:

How would I connect these the characteristics of each 'creature'?

Basically, I see it this way (and this will probably be how I will implement it): Each 'creature' can run around, eat and breed, basic stuff. I don't think (I sure don't hope so at least!) I will need a fitness-function per se, but I hope evolution, as in the race for food, partners and space will drive the creatures to evolution.

Is this view wrong? Would it be easier (do note, I'm a programmer, not a mathematician!) to look at it as one big graph and "simply" take it from there?

Or, tl;dr: Can you point me in the right direction to articles, studies and/or examples of implementation of this?

(Even more tl;dr; How do I translate a Gene to, say for example the Length of a leg?)

*Read the question, I'm building a sort of simulator.

Community
  • 1
  • 1
Marcus Hansson
  • 816
  • 2
  • 8
  • 17
  • [Fitness](http://en.wikipedia.org/wiki/Fitness_%28biology%29) just "describes the ability to both survive and reproduce" so ... :) –  Sep 15 '11 at 23:34
  • Although that _actually_ matches fitness as a mathematical model (or a boolean function terminating the loop or whatever), it doesn't match fitness _per se_ in my particular case, since I really isn't that interested in which little creature survives (or even less what attributes it has). But thanks for the link, interesting read :) – Marcus Hansson Sep 15 '11 at 23:44

2 Answers2

1

Looking at Mitchell, 1998, An Introduction to Genetic Algorithms, Chap. 3.3, I found a reference to Forrest and Jones, 1994, Modeling Complex Adaptive Systems with Echo. that refers to the software Echo that seems to do what you are looking for (evolving creature in a world). For the moment I can't find a link to it but here is a dissertation on implementing jEcho, by Brian McIndoe.

mitch
  • 1,870
  • 15
  • 12
  • Although I haven't had much time to actually read all of it, the little I have had time to go through looks very promising. – Marcus Hansson Sep 17 '11 at 15:49
1

I haven't seen metainformation like your Y and Z in a genetic algorithm's gene sequence before (in my limited exposure to the technique). Is your genetic algorithm a nontraditional one?

How many traits does a creature have? If your X's are representing the values of traits, and a gene sequence can have variable length (Z), then what happens if there are not enough X's defined for all the traits? What happens if there are more X's than the traits you have for a creature?

  • Z should be a fixed value.
  • Y should be parameters of your genetic evolution routine
  • there should be an X (or set of X) for every trait of a creature (no more, no less)

If the number of X's you have is fixed, then for each trait, you assign a particular index (or set of indexes) to represent that trait.

EDIT:

You should determine the encoding of your traits that X should represent: for length of a leg, e.g., you could have a few bytes represent the leg-length. If bytes 3-5 were the length of the leg, you could represent the length in your X-vector like this:

[...101......]

Where the dots are other trait representations. The above snippet represents a leg length of 5 (whatever that means). The below genome still has 5 as the leg length, but other traits filled out as well.

[001101011011]

Atreys
  • 3,741
  • 1
  • 17
  • 27
  • I probably have even less exposure to this than you have (at least it sounds like it!). Basically, I thought I could just simply enumerate through every X and the programmatically calculate the attribute of the trait represented in the gene (and yes, you could express it like "a genetic algorithm on the runtime parameters of a genetic algorithm", I want it to be as separated as possible from the actual outcome (ie as abstract as possible)). – Marcus Hansson Sep 26 '11 at 15:22
  • Aside from the actual encoding and structure of the gene, how would I go from having {X, [..] } to, say (for example!) the attributes of a leg? A better way of asking would probably be like, how would I calculate the attribute/s (say, length) of something using {X, [..]}? – Marcus Hansson Sep 26 '11 at 15:29
  • @MarcusHasson, I added some elaboration on how you get the traits from the representation. It's really up to you to determine how your encoding should be. As a caveat, the encoding may influence how your genetic algorithm performs, as well as the mutation and combination rules you choose. – Atreys Sep 26 '11 at 23:26
  • Ah, that explains a lot! So there's no actual calculation other than a plain, raw binary-to-decimal conversion taking place? So, basically, the only real reason to encode your traits is because it's easier to handle crossover and mutation that way! You, sir, are a hero! Thanks anyway :) – Marcus Hansson Sep 27 '11 at 06:14