Non Linear optimization problem in MATLAB
Mostra commenti meno recenti
I have following problem which I am using MATLAB to solve it seems to me pertty Please check Is this correct or NOT?
Question

objective function (objfun2.m)
function f = objfun2(x)
f = 7.9 * 0.000000001 * 300 * pi * (x(1)^2 - x(2)^2);
end
Non linear constraint (confun2.m)
function [c, ceq] = confun2(x)
%Nonlinear inequality constraints
sqrt1=sqrt((1.84*100000* (pi/4)*(x(1)^4-x(2)^4))/(7.9*0.000000001*pi*(x(1)^2-x(2)^2)));
sqrt2= sqrt(1+(x(3)*300^3)/(3 * 1.84 * 100000 *(pi/4)*(x(1)^4-x(2)^4)));
c = -(((1.875^2)/(300^2 * 2*pi))*sqrt1*sqrt2)+230 ; % since it should have x<m form
% Nonlinear equality constraints
ceq = [];
Main Code
LB=[9.2,6,0.1];
UB=[15,9.8,18];
A=[];
b=[];
Aeq=[];
beq=[];
x0=[10,9,0.15];
% Make a starting guess at the solution
%options = optimoptions(@fmincon,'Algorithm','sqp');
[x,fval] = fmincon(@objfun2,x0,A,b,Aeq,beq,LB,UB,@confun2);
My Solution (Not sure it is correct or NOT)
x= 9.7603 9.7603 16.8680
How would I check this?
Risposta accettata
Più risposte (1)
You should call fmincon with more output arguments, so that you can assess the quality of the solution
[x,fval,exitflag,output] = fmincon(___)
However, I would not trust the solution that you've shown above. It looks like fmincon was trying to reach a solution where x1=x2, which is outside the domain of your nonlinear constraint function.
Was your nonlinear constraint active at the solution? We cannot test that because you've only shown the solution to 4 decimal places. If all the constraints were inactive at the final x, then this is definitely not a solution, because the gradient is non-zero there (so the KKT conditions are not satisfied).
You might try re-solving the problem with the demoninators in your nonlinear constraints cleared, i.e., instead of
num/den-230>=0
express the constraints as
num-230*den>=0
If you reach a solution where the objective function is significantly less than 0 (and the constraints are satisfied), then you'll know that solution is better.
You could also try evaluating your objective function and constraints on a coarsely sampled grid covering the area within your LB, UB bounds. This would be a way to obtain a better initial guess and a better idea of what the globally minimum value is. Because there are only 3 variables, this should be computationally tractable.
1 Commento
John D'Errico
il 30 Dic 2017
+1
Categorie
Scopri di più su Solver Outputs and Iterative Display in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


