How to optimize an objective function with strict inequality constraints?
11 views (last 30 days)
Show older comments
Objective function =x(2)*(-10)-x(1)*70+240
subjected to : 3<=x(1) ; x(2)<=8
I try to optimize this objective function using penality function method.
x0=[0;0];
c(1)=50; % penality parameter
for k=1:1:25
f=@(x)(x(2)*(-10)-(x(1))*70+240+(c(k).*((3-x(1))^2+(x(2)-8)^2))); % converting constrained problem into unconstarined
[x,fval]=fminunc(f,x0);
c(k+1)=1.5*c(k); % penality parameter updation
k=k+1;
end
disp(x)
By using this penality function method,solution obtained is 3 & 8, it is boundary values.(I also used fmincon tool and KKT condtion, but got values as like this)
But I need a solution of 3<x(1)<x(2)<8 (ie ,values between 3 &8)
Is there any other method to solve this problem?Please help me to solve this problem
Accepted Answer
Matt J
on 29 May 2022
Edited: Matt J
on 29 May 2022
The original problem with the unnecessary 240 term dropped is,
Objective function =-70*x1-10*x2
subjected to : 3<=x(1) ; x(2)<=8
Making a change of variables,
y1=x1-3, y2=8-x2
and also applying the monotonic transform
to the objective function and the problem becomes

Objective function =atan(-70*y1 + 10*y2)+pi/2
subjected to : y1,y2>=0
Make yet another change of variables,
y1=-log(z1)
y2=exp(z2)
and the problem becomes
Objective function =atan(-70*log(z1) + 10*exp(z2)) +pi/2
subjected to : 0<=z1<=1
We can minimize this with fmincon:
fun=@(z) atan(70*log(z(1))+10*exp(z(2)))+pi/2;
opts=optimoptions('fmincon','StepTolerance',1e-16,'OptimalityTolerance',1e-16,...
'FunctionTolerance', 1e-16,'MaxIterations',1e5,'MaxFunEvals',1e10);
[z,fval,exitflag,output]=fmincon(fun,[0.5,0],[],[],[],[],[0,-inf],[1,inf],[],opts);
fval
Checking bounds on the original variables x1,x2 are strictly satisfied:
x1=3-log(z(1))
x2=8-exp(z(2))
More Answers (1)
Walter Roberson
on 28 May 2022
x(2)*(-10)-x(1)*70+24
That is a linear function. The derivative with respect to either variable can be taken easily and will be -70 with respect to x1 or -10 with respect to x(2). The optimal value will therefore occur either at one of the infinities or at the bounds.
If x(1) is +inf and x(2) is finite then the objective is -inf. That combination is permitted by the boundary conditions, which give a lower bound on x(1) and an upper bound on x(2).
You penalized incorrectly with a quadratic penalty on a linear function, which overwhelmed the function itself.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!