How to formulate annulus bounds constraints in ga ?
Show older comments
Hello, I am struggling in formulating the lb and ub in my ga code, I need ga to generate locations within an annulus area between a smaller rectangle of 49-by-63 and a larger rectangle of 77-by-91. thanks !!!
Accepted Answer
More Answers (1)
Mamdouh Abdulrahman
on 23 Oct 2017
0 votes
1 Comment
Alan Weiss
on 23 Oct 2017
Edited: Alan Weiss
on 23 Oct 2017
Now I'm not so sure, sorry again. Is this annulus a round annulus, I mean a section of two circles, radius between a and b? If so, then I think the correct nonlinear inequality constraint is this:
function [c,ceq] = myannulus(x)
ceq = [];
r = norm(x);
c = (-(r - a)*(b - r));
If, instead, this is a rectangular annulus, meaning the area between two rectangles where one rectangle is contained in the other, then I think that my previous answers are not correct. Instead, perhaps this is correct. The outer rectangle is from [xmin,ymin] to [xmax,ymax], and the inner rectangle is from [xmin2,ymin2] to [xmax2,ymax2], where
xmin < xmin2 < xmax2 < xmax
ymin < ymin2 < ymax2 < ymax
Use xmin, ymin and xmax,ymax as the bounds on the components of x. I mean, include them in the bounds. Then include also a nonlinear constraint function:
function [c,ceq] = myannulus2(x)
ceq = [];
cc(1) = (x(1) - xmin2)*(xmax2 - x(1));
cc(2) = (x(2) - ymin2)*(ymax2 - x(2));
c = max(cc(1),0)*max(cc(2),0);
Sorry for the confusion, I wasn't thinking clearly today.
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Surrogate Optimization 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!