I am trying to solve a non-convex optimization problem using fmincon()
.
At each iteration, I am iteratively looking for the optimum value and when the termination criterion is satisfied, I keep this value as an initial value for fmincon()
and run the code for the second iteration.
The problem is the code is running fine for the first to third iteration and then I get the following error
Error using sqpInterface Finite difference derivatives at initial point contain Inf or NaN values. Fmincon cannot continue.
Error in fmincon (line 823) [X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = sqpInterface(funfcn,X,full(A),full(B),full(Aeq),full(Beq), .
How can I get rid of this error?
fmincon()
had calculated areInf
orNaN
for whatever reason. Without knowing what you are doing, it's impossible to say why does it happen. I would start by introducing the problem, looking at the intermediate values (say grad, Hessian, etc at the previous iterations) to find out how the problem behaves. In the current for of the question, there is not a lot we can help you with. $\endgroup$