Write nonlinear constraint to fmincon
Mostrar comentarios más antiguos
I am using fmincon to optimize a vectorized function (myfun) of five variables (x). This function has also some parameters (k, l, m, n) which I am passing to fmincon. What I am doing is shown below:
p=@(x)myfun(x, k, l, m, n);
[xmin, pmin]=fmincon(p, x0, A, b, Aeq, beq, lb, ub, nonlcon, options);
My question is how am I going to write the nonlinear equality which I have in my problem. I have written another function about the nonlinear equality in which x is the variables used in myfun and L is a parameter that I would like to pass inside the constraint. See below:
function [c,ceq]=pitch(x,L)
c=[];
ceq=x(3)*x(5)-L;
end
The problem is that I don't know how to write inside the fmincon the constraint. I have written this:
nonlcon=@(x)pitch(x,L)
which results in an error. I would appreciate your answers. Thank you.
1 comentario
Matt Kindig
el 17 de En. de 2013
Could you post the error for us?
Respuesta aceptada
Más respuestas (4)
Giorgos Papakonstantinou
el 17 de En. de 2013
0 votos
1 comentario
Giorgos Papakonstantinou
el 17 de En. de 2013
Giorgos Papakonstantinou
el 17 de En. de 2013
Giorgos Papakonstantinou
el 17 de En. de 2013
0 votos
Giorgos Papakonstantinou
el 17 de En. de 2013
0 votos
3 comentarios
Giorgos Papakonstantinou
el 17 de En. de 2013
Shashank Prasanna
el 17 de En. de 2013
Giorgos, you are right this options is currently only available in Genetic Algorithm. Other optimization tools as yet dont support mixed integer programming.
Categorías
Más información sobre Choose a Solver en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!