views:

158

answers:

2

Let's imagine I have an unknown function that I want to approximate via Genetic Algorithms. For this case, I'll assume it is y = 2x.

I'd have a DNA composed of 5 elements, one y for each x, from x = 0 to x = 4, in which, after a lot of trials and computation and I'd arrive near something of the form:

best_adn = [ 0, 2, 4, 6, 8 ]

Keep in mind I don't know beforehand if it is a linear function, a polynomial or something way more ugly, Also, my goal is not to infer from the best_adn what is the type of function, I just want those points, so I can use them later.

This was just an example problem. In my case, instead of having only 5 points in the DNA, I have something like 50 or 100. What is the best approach with GA to find the best set of points?

  1. Generating a population of 100, discard the worse 20%
  2. Recombine the remaining 80%? How? Cutting them at a random point and then putting together the first part of ADN of the father with the second part of ADN of the mother?
  3. Mutation, how should I define in this kind of problem mutation?
  4. Is it worth using Elitism?
  5. Any other simple idea worth using around?

Thanks

+2  A: 

Usually you only find these out by experimentation... perhaps writing a GA to tune your GA.

But that aside, I don't understand what you're asking. If you don't know what the function is, and you also don't know the points to being with, how do you determine fitness?

From my current understanding of the problem, this is better fitted by a neural network.

edit:

2.Recombine the remaining 80%? How? Cutting them at a random point and then putting together the first part of ADN of the father with the second part of ADN of the mother?

This is called crossover. If you want to be saucey, do something like pick a random starting point and swapping a random length. For instance, you have 10 elements in an object. randomly choose a spot X between 1 and 10 and swap x..10-rand%10+1.. you get the picture... spice it up a little.

3.Mutation, how should I define in this kind of problem mutation? usually that depends more on what is defined as a legal solution than anything else. you can do mutation the same way you do crossover, except you fill it with random data (that is legal) rather than swapping with another specimen... and you do it at a MUCH lower rate.

4.Is it worth using Elitism? experiment and find out.

San Jacinto
I already have a fitness function. That is not the problem.
devoured elysium
What I'm asking for is for the methodology. I still didn't understand very well what is a general "recipe" for this kind of problem. Should I take off 20% of the worse individuals? Or 80%? Recombine the 2 best? Or the 50% best?
devoured elysium
usually with a GA, you want to swap info between your parents, not just modify an annswer in-place. what you described in the 3rd part of your comment is more of a mutation than a new breed.
San Jacinto
additionally, you can use all of these as paramters that vary based off of another random. for instance... if you want to choose at least the top 2% of the population as parents but not any more unless they pass a certain fitness threshold, well you can build a selection function that does just that. be creative :)
San Jacinto
+1  A: 

Gaussian adaptation usually outperforms standard genetic algorithms. If you don't want to write your own package from scratch, the Mathematica Global Optimization package is EXCELLENT -- I used it to fit a really nasty nonlinear function where standard fitters failed miserably.

Edit: Wikipedia Article

If you hunt down prints of the listed papers on the article, you can find whitepapers and implementations. In general though, you should have some idea what the solution space for your maximizing the fitness function look like. If the number of variables is small, or the number of local maxima is small or they are connected/slope down to a global maxima, simple least squares works fine. If the area around each local maxima is small (IE you have to get a damned good solution to hit the best one, otherwise you hit a bad one), then fancier algorithms are needed.

Choosing variables for a genetic algorithm depends on what the solution space will look like.

BobMcGee
please add linkage for me to read on the technique :)
San Jacinto
I'll read about that, but this specific work demands GA, so I can't just use other method :(
devoured elysium
Anyway that got me interested. Do you have anything about it that is easily readable besides wikipedia? I'd give a shot using it, actually.
devoured elysium
That's where I learned about it -- if you do a google on "gaussian adaptation" there are some whitepapers published. In general though, the strength of an algorithm will depend on how complex the maxima for your fitness function are.
BobMcGee