Genetic Algorithm options 'PopInitRange' not working

8 visualizaciones (últimos 30 días)
Craig Cowled
Craig Cowled el 11 de Jun. de 2013
I am using GAOPTIMSET to establish an upper and lower bound for my initial population in a GA optimisation.
I have abbreviated my inputs as below:
InitPopRange = [0.0076 0.0030 0.0011 0.0004 0.0068 0.0004; 0.0303 0.0068 0.0149 0.0049 0.0118 0.0303];
Options = gaoptimset('PopInitRange' , InitPopRange);
The optimisation kept crashing in my fitness function just after the very first individual had been created. During debugging, I noticed that my first individual had the following values:
x = [0.2508 0.0000 0.0000 0.2132 0.0970 1.0000];
Why is it that every single value of x falls outside InitPopRange? This is what has caused my fitness function to crash.
Obviously the work-around solution for me is to create my own initial population using a random number generator and apply my own limits. I'm just curious to know why the GA has seemingly ignored my option for initial population range. Any ideas?
  5 comentarios
Matt J
Matt J el 11 de Jun. de 2013
I noticed that my first individual had the following values:
What method did you use to observe the individuals? How do you know this individual was the "first"?
Even if you do succeed in getting the Initial Population that you want, what is to prevent the population from evolving at later iterations into a region which causes your fitness function to crash?
Because this is a Genetic Algorithm, the fitness function doesn't have to be smooth/continuous, so I think one normally defines the fitness function to return a safe value everywhere.
Craig Cowled
Craig Cowled el 11 de Jun. de 2013
MattJ, I was in debug mode when I observed the value of the first individual in my population. I placed a break within my fitness function so that I could catch the first value of 'x'.
I take your point about constraining the fitness function so that it only evaluates safe values. I have allowed values of x to vary between 0 and 1. In my case, some of the values can be zero and the fitness function will still evaluate, however, the fitness function becomes unstable when too many values of x are very close to zero (I don't know what combinations though). I don't want to move my lower bounds up because it is quite possible that my solution has some values close to zero.
In any case, I have a work-around. I guess I was just curious to know why PopInitRange didn't seem to work.

Iniciar sesión para comentar.

Respuesta aceptada

Alan Weiss
Alan Weiss el 11 de Jun. de 2013
I believe that the problem is that you have linear constraints. By default, ga uses the gacreationlinearfeasible function to create individuals in that case, and gacreationlinearfeasible does not pay attention to PopInitRange when there are linear constraints. To see how it works, look at this example.
You can choose to use the gacreationuniform creation function, which does exactly what you think it should when you pass in an initial range (it creates individuals uniformly between the bounds given in the initial range). To use this function,
options = gaoptimset('CreationFcn',@gacreationuniform,...);
Alan Weiss
MATLAB mathematical toolbox documentation

Más respuestas (1)

Craig Cowled
Craig Cowled el 12 de Jun. de 2013
Alan, thank you for such a good explanation. Cleared it up for me nicely.

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by