How to set up non-linear relative constraints in Geneti Algorithm optimization
Show older comments
I am trying to sove an optimization problem consisting of four variables using 'ga'. The system consists of non-linear transcendental equations. My constraints for the unknown variables are like this :
0<=x(1)<=x(2)<=x(3)<=x(4)<=pi/2
The problem with the lower/upper bounds is that the lower bound exists only for x(1) and upper one exists only for x(4). The bounds for other variables are relative and matlab does not accept LB=[0 x(1) x(2) x(3)] format.
I have tried the non-linear constrainsts as well (since there are other constraints involving the cosines of unknown variables) but the results do not make any sense.
Any worthy member has any idea to circumvent this issue??
Accepted Answer
More Answers (1)
Alan Weiss
on 7 Oct 2013
Edited: Alan Weiss
on 7 Oct 2013
To get these linear constraints into the solver, use linear inequality constraint matrices. The constraints are:
x(1) <= x(2)
x(2) <= x(3)
x(3) <= x(4)
To put these in the form Ax <= b, take the following:
A = [1,-1,0,0;
0,1,-1,0;
0,0,1,-1];
b = zeros(3,1);
The bounds x(1) >= 0 and x(4) <= pi/2 are:
lb = [0,-Inf,-Inf,-Inf];
ub = [Inf,Inf,Inf,pi/2];
It is probably even more efficient to take
lb = zeros(4,1);
ub = pi/2 + lb;
I hope this is clear.
Alan Weiss
MATLAB mathematical toolbox documentation
4 Comments
Hafiz
on 8 Oct 2013
Hafiz
on 9 Oct 2013
If you have a physical example of the system, then you should be able to choose at least a feasible set of design variables x(1), x(2), x(3). Plug them into your constraint function and check that c(x)<=0. Similarly check that A*x<=b and that the bounds are satisfied. If not all constraints are satisfied, you know that you've coded the equations incorrectly. If they are satisfied, then you can use that as your initial guess x0 and fmincon can't have any excuses that it can't find a feasible point.
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!