How to identify the infeasibility from the set of equality and inequality constraints

1 visualización (últimos 30 días)
Dear community members,
I am trying to minimize the objective function "tf" in my optimization model that include three inequality and two equality constraints. The objective function or (optimization varaibel "tf") is occurs in both the inequality and the equality constraints.
I am trying to solve these set of constraitns through fmincon. I have two files; one includes main function and the other one include set of constraints. The code for the main file is pasted below;
function [obj_val] = main_moppn1(tf)
objective = @(tf) tf ;
tf=0.2432;
disp(['initial objective:' num2str(objective(tf))]);
A=[];
b=[];
Aeq=[];
beq=[];
lb = [0.01];
ub = [];
nonlincon=@nlcon_moppn1;
options = optimoptions(@fmincon, 'MaxIterations',15000000, 'MaxFunctionEvaluations',30000, 'StepTolerance',0.0000001,'Algorithm','interior-point');
[x,fval,exitflag,output] = fmincon(objective,tf,A,b,Aeq,beq,lb,ub,nonlincon,options)
disp(['final objective:' num2str(objective(x))]);
obj_val = objective(x);
end
%----------------------------------------------------------------------------------------
The constraint file (nlcon_moppn1) includes all the constraints which are as given below.
function [vp,a2,a3,ceq1,ceq2] = nlcon_moppn1(tf)
global q1;global q2;global w1;global w2;
% [v1,a1,vp,j1,ceq1,ceq2]
q1=0;q2=90;
w1=9129.9125; w2=-9129.9125;
vp=((w1*w2)*((w1-(w2*tf))/(2*(w1-w2)^2))+ ((q2-q1)/tf)+(tf/6)*(w1-w2))-370;% Inequality constraints
a2=w1-140;% Inequality constraints
a3=w2-140;% Inequality constraints
ceq1 = -((w1*tf)/2)+(q2-q1)/tf+((w1-w2)*tf/6);% equality constraints
ceq2 = ((w2*tf)/2)+(q2-q1)/tf+((w1-w2)*tf/6);% equality constraints
end
The solution process for the above set of constraint is converged to infeasible point.I will be thankful if somebody can help me to identify the constraints that causing infeasibility and the solution process converged to an infeasible point.
  3 comentarios
Muhammad Saeed
Muhammad Saeed el 21 de Nov. de 2022
Dear Torsten,
Thanks you so much for the response and putting the efforts to my problem.
However as you can see in the main function file I kept the lb = [0.01];This emphasize that "tf" must be a greater than zero and has a positive value. From your remarks it sems that fmincon did not taking into account lower bound constraint while running the optimization.
Is there alternative way to specify the value of a lower bound or other constraint that generating the infeasible solution?
Torsten
Torsten el 21 de Nov. de 2022
Editada: Torsten el 21 de Nov. de 2022
If you take lb = 0.01 for tf, it is even more obvious that no feasible point exists.
0 was the only candidate for tf following from your equality constraints - if you request tf >=0.01, absolutely no feasible point is in sight.

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 21 de Nov. de 2022
Editada: John D'Errico el 21 de Nov. de 2022
You have a scalar problem?
But then, you have TWO equality constraints?
So a solution will exist only if BOTH equalities are satisfied for any solution. And of course, this is not then a problem that fmincon can handle, because your feasible set will be a disjoint set of solutions of the nonlinear equality constraints, if any such set even exists.
Regrdless, I'll look at the rest of the problem you have posed. We see these constants established.
q1=0;q2=90;
w1=9129.9125; w2=-9129.9125;
I'll make tf a sym, so we can look at the equations generated. tf is apparently the unknown.
syms tf
vp=((w1*w2)*((w1-(w2*tf))/(2*(w1-w2)^2))+ ((q2-q1)/tf)+(tf/6)*(w1-w2))-370% Inequality constraints
vp = 
So a simple inequality. Things will be bad of course when tf approaches zero, but we are not yet worried about that.
Next, we see this:
a2=w1-140 % Inequality constraints
a2 = 8.9899e+03
a3=w2-140 % Inequality constraints
a3 = -9.2699e+03
HUH? w1 and w2 are constants. KNOWN PARAMETERS. And a1 and a2 are not variables in the problem. So these are irrelevant. As long as they have the proper sign, they are trivially either satisfied, or no solution can possibly exist. After all, you call them inequality constraints.
Anyway, in fact, you seem to not understand how to use fmincon.
The constraint function for fmincon REQUIRES that you return two vectors. Not 5 separate variables! You do this:
function [vp,a2,a3,ceq1,ceq2] = nlcon_moppn1(tf)
MATLAB will look at the first of those variables, and assume it is the inequality constraint. Then it will look at the SECOND returned variable, and assume it is the EQUALITY constraint.
And then? It throws everything else in the bit bucket! It ignores the other three variables that you returned, because MATLAB does not care that you think something is an equality constraint, just because you named the variables ceq1 and ceq2. This is not how functions work in MATLAB. MATLAB does not look at the variable names, and know what you intend by them.
Anyway, even if we go back and fix things, so that you return TWO vectors of variables, as fmincon requires, it will still fail. Why? trivially, a2 is ALWAYS the fixed value 8.9899e3. And that number is going to be ALWAYS greater than zero.
>> help fmincon
fmincon finds a constrained minimum of a function of several variables.
fmincon attempts to solve problems of the form:
min F(X) subject to: A*X <= B, Aeq*X = Beq (linear constraints)
X C(X) <= 0, Ceq(X) = 0 (nonlinear constraints)
LB <= X <= UB (bounds)
As such, what you call an inequality constraint precludes a solution from ever existing, since one of your constraints fails to satisfy the requirement that C(X) < 0.
@Torsten has already shown why the equality constraints cause the problem to fail too, so I won't repeat his analysis.
NO solution can possibly exist. Even if a solution COULD possibly exist, fmincon could not ever find it, because fmincon requires a continuous and differentiable function on a continuous feasible set. You don't have that.

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by