In one sentence (thanks to @Brian Borchers), I want to minimize the function f(x, y, ...), with gradient g(x, y, ...), subject to constraints that aren't given explicitly, but are defined by situations where the routines that compute f and g return an error.
The domain for
f isn't linear and it is not simple to change variables. I approximated a boxed constraints within which the parameters only occasionally (still infinitely many) fall out of the domain.
g as a black box, it throws exceptions when parameters are not in the domain. I am only able to create wrappers so as to catch exceptions and returns some values.)
So, I used L-BFGS-B, and
f to be very large when the parameters not in the domain. And I set
g at those points to be 1.
In most case the optimization just works fine. However, sometimes it would trigger error like "ABNORMAL_TERMINATION_IN_LNSRCH", I guess it is just because my
g doesn't agree with
f at those nasty points.
What's the best practice in general in such case?