Question regarding Genetic Algorithm

1 view (last 30 days)
Guillaume
Guillaume on 30 Nov 2013
Commented: Alan Weiss on 3 Dec 2013
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.

Answers (1)

Alan Weiss
Alan Weiss on 2 Dec 2013
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 Comments
Guillaume
Guillaume on 3 Dec 2013
Thanks for this answer, the second suggestion is exactly what I want to do but i'm not sure to know how to proceed to do it. How do you set two variables and where do you set the binary one?
Thanks again.
Alan Weiss
Alan Weiss on 3 Dec 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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!