fmincon violates my constraints?

6 visualizzazioni (ultimi 30 giorni)
Tao
Tao il 26 Mag 2015
Commentato: Alan Weiss il 26 Mag 2015
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 Commento
Alan Weiss
Alan Weiss il 26 Mag 2015
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

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by