fmincon function with two non-linear constraints

hi all, I am trying to use the fmincon function to optimise a function with two non-linear constraints. The cost function is
for n = 1:N
e = e + (norm(x(:, n) - o - dot(x(:, n), a)*a) - r)^2
end
where x is 3 by N matrix, o and a are three-dimension vectors and r is a scalar.
There are two constraints used
dot(a, o) == 0
norm(a) == 1
Can I use fmincon with two non-linear equal constraints? I saw the constraint function should contain a equal and non-equal constraints. How can I write the constraint function for my case?
Thank you

Respuestas (1)

Matt J
Matt J el 18 de Dic. de 2014
Editada: Matt J el 18 de Dic. de 2014
Only one of your constraints is nonlinear. You could write it like so,
function [c,ceq]=nonlcon(a)
c=[];
ceq=norm(a)^2-1;
end
Your objective function is non-differentiable, however. You'll probably have to use instead
e = e + (norm(x(:, n) - o - dot(x(:, n), a)*a)^2 - r^2)^2

3 comentarios

Ben
Ben el 18 de Dic. de 2014
Hi Matt, thank you for your reply. But in the nonlocn function, only the second constraint was used. How about the first one (dot(a, o) == 0)? Thank you
Matt J
Matt J el 18 de Dic. de 2014
Editada: Matt J el 18 de Dic. de 2014
As I mentioned, you only have 1 nonlinear constraint. The other one is linear. Use the Aeq and beq inputs to specify that one.
Ben
Ben el 21 de Dic. de 2014
Thank you. I will have a try

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

Ben
el 18 de Dic. de 2014

Comentada:

Ben
el 21 de Dic. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by