Write nonlinear constraint to fmincon
이전 댓글 표시
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
Matt Kindig
2013년 1월 17일
Could you post the error for us?
채택된 답변
추가 답변 (4개)
Giorgos Papakonstantinou
2013년 1월 17일
Giorgos Papakonstantinou
2013년 1월 17일
0 개 추천
댓글 수: 3
Giorgos Papakonstantinou
2013년 1월 17일
Shashank Prasanna
2013년 1월 17일
Giorgos, you are right this options is currently only available in Genetic Algorithm. Other optimization tools as yet dont support mixed integer programming.
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!