Adding a constraint in @confun constrained optimization

18 visualizaciones (últimos 30 días)
Mondher Souilah
Mondher Souilah el 31 de Oct. de 2018
Editada: Bruno Luong el 2 de Nov. de 2018
Hello, I am struggling to add a second constraint in my optimization problem... My obj function is:
function f = objfun(X)
for i=1..18;
f=sum(exp-(10*X(i)); end
My 1st constraint is a non linear inequality :
function [c,ceq]=confun(X)
ceq = [];
c(1) =(-0.35*X(3)+0.35*X(9)+1.3333*X(10))^2-(0.3333*X(13)+0.3182*X(3)-0.6364*X(6)+0.3182*X(9)-X(17))^2-(0.015/2)^2;
My second constraint is also a non linear inequality which I can't code, here is what I want to verify:
% I need that all the values from 0 to the X(i) to be generated (the optimum X(i)), the condition 1 is verified.
Would you note that ub and lb and all the other entries for fmincon are known and my problem is only in the @confun
[x,fval]= fmincon(@objfun,x0,A,b,Aeq,beq,lb,ub,@confun,options)
A = [];
b = [];
Aeq = [];
beq = [];
x0 = [0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016];
lb = [0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015];
ub = [0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015];
options = optimoptions(@fmincon,'Algorithm','sqp');
  2 comentarios
Alan Weiss
Alan Weiss el 1 de Nov. de 2018
Sorry, I don't understand what you mean by your second constraint. The only description you gave is "I need that all the values from 0 to the X(i) to be generated (the optimum X(i)), the condition 1 is verified." I have no idea what that means.
Alan Weiss
MATLAB mathematical toolbox documentation
Mondher Souilah
Mondher Souilah el 1 de Nov. de 2018
Editada: Mondher Souilah el 2 de Nov. de 2018
Hello Alan, in other words: I would like that the values to be generated at the end of the optimization respect the second constraint.
to be more clear, here is an example: i could have for example X(3)=0.013 at the end. this could respectcondition n1 but i want also to verify that : within all the interval (0.000 to 0.013) the condition is respected.

Iniciar sesión para comentar.

Respuesta aceptada

Bruno Luong
Bruno Luong el 2 de Nov. de 2018
Editada: Bruno Luong el 2 de Nov. de 2018
Mathmematically you could define another constraint function
h(x) := sup { g(y): y in [0,x] }
then optimize your objective function:
argmin obj(x), with the constraint
h(x) <= somevalue
Now the problem becomes "how to compute h(x)?"
But that's is now on your side, and you might able to do it with specific formula of g(x).
You can of course use fmincon or such to compute h(x). But that might be costly. In this case the confun becomes (quick and dirty):
function [c,ceq]=confun(X)
lb = zeros(size(X));
ub = X;
afun = @(X) -0.35*X(3)+0.35*X(9)+1.3333*X(10);
bfun = @(X) 0.3333*X(13)+0.3182*X(3)-0.6364*X(6)+0.3182*X(9)-X(17);
g = @(X) (afun(X).^2-bfun(X).^2);
X = fmincon(@(X) -g(X), X, [], [], [], [], lb, ub); % Maximize g(X)
c = g(X)-(0.015/2)^2;
end
In some problems, it is sometime easier to find a formula for another function that is slightly greater than h(x):
H(x) >= h(x) for all x.
Note: "sup" is loosely speaking "max" for people who are not familiar with the notation.

Más respuestas (1)

Alan Weiss
Alan Weiss el 2 de Nov. de 2018
It sounds to me as if your problem could be formulated for fseminf.
Alan Weiss
MATLAB mathematical toolbox documentation

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by