|
"Matteo " <voto_100.delete.this@hotmail.com> wrote in
message <g6btnh$qpf$1@fred.mathworks.com>...
> Hello,
>
> while running fmincon I get this error for some particular
> initial points:
>
> > In fmincon at 303
> ??? Error using ==> svd
> NaN or Inf prevents convergence.
>
> Error in ==> pinv at 29
> [U,S,V] = svd(A,0);
>
> Error in ==> optim/private/qpsub at 492
> projSD = pinv(projH)*(-Zgf);
>
> Error in ==> optim/private/nlconst at 707
> [SD,lambda,exitflagqp,outputqp,howqp,ACTIND] ...
>
> Error in ==> fmincon at 546
> [X,FVAL,lambda,EXITFLAG,OUTPUT,GRAD,HESSIAN]=...
>
> I don't use any constraint, only box bounds. I checked the
> output of my objective function, and it's not giving any NaN
> or Inf, but only very big objective values, when this error
> occours.
>
> Now I am pretty sure that such big values in the objective
> cause the error, but I wonder if there should not be some
> kind of error check to prevent the code to stop.
>
> Have you ever had this problem?
>
> I am using 7.2 (2006a). Do you know if this problem has been
> solved in recent versions of MATLAB?
>
> Thanks
>
> Matteo
Hi Matteo,
How large are the values of the objective function? How
about X?
Why does that matter: In this case the pseudo-inverse
command is trying to compute the SVD of a matrix with a NaN
or Inf in it. That means there was overflow in the
arithmetic leading to that matrix.
One way to combat this is to scale your problem. If you know
that your objective function produces large values, then
scale it such that it produces values in a range near 1. (If
you provide gradients with your objective function, then
you'd have to scale those likewise.)
++Steve
PS: There is a failsafe option to check if your objective or
constraint functions give Inf or NaN values. It's called
'FunValCheck'. However, as you noted, neither this nor any
other options will help in your case.
|