Question regarding Genetic Algorithm
Mostrar comentarios más antiguos
Hi,
I would like to maximize a function with a constraint using the genetic algorithm. The problem is that for the 'x' vector I would like only values like those 0,[min,max]. So I can't use the boundary condition because it will exclude zero.
Thank you for your ideas.
regards.
Respuestas (1)
Alan Weiss
el 2 de Dic. de 2013
0 votos
Perhaps you can encode your problem as integer. Set lb = zeros(1,N), ub = 2+lb. When x = 0, you are set. When x = 1, map it to [min]. When x = 2, map it to [max].
But perhaps what you mean is your x variables are either 0 or are continuous between min and max. In that case, I suggest you make two variables for each component, one binary (I mean 0 or 1). The other should be continuous between min and max. Set the final variable to be binary*continuous.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
2 comentarios
Guillaume
el 3 de Dic. de 2013
Alan Weiss
el 3 de Dic. de 2013
Suppose your x is two-dimensional, x(1) and x(2). Create x(3) and x(4) as binary variables, and let x(1) and x(2) vary between min and max. Set z(1) = x(1)*x(3) and z(2) = x(2)*x(4). Then the variable z has the properties you want. Do all your calculations with input variables x(1)...x(4) and output variables z.
Alan Weiss
MATLAB mathematical toolbox documentation
Categorías
Más información sobre Genetic Algorithm en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!