Question regarding Genetic Algorithm
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
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
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
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!