fmincon violates my constraints?

3 ビュー (過去 30 日間)
Tao
Tao 2015 年 5 月 26 日
コメント済み: Alan Weiss 2015 年 5 月 26 日
To be simple, my constraint function is like below:
function [ c, ceq ] = ctr( x, a, b)
[F] = f(x, a, b);
c(1) = -F;
ceq(1) = .....;
end
where x is the vector I'm going to optimize, and F is calculated through the function f, and I want to constraint F greater than 0. However, during the optimization using fmincon, the code crashes and saying "constraint function is not defined at ....", then I check my constraint function and found F is smaller than 0.
Could anyone explain why?
  1 件のコメント
Alan Weiss
Alan Weiss 2015 年 5 月 26 日
You didn't show us your nonlinear constraint code or your fmincon call. So how are we supposed to answer you?
Please give us real nonlinear constraint code, and your complete fmincon call, I mean something like
[x,fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)
and give us the definitionse of your arguments, such as
fun = @(x)objfun(x,a,b)
Alan Weiss
MATLAB mathematical toolbox documentation

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by