My objective function has undefined subsets in the parameter space that are difficult to discover and add to the fmincon constraints. Is there a return value for my objective function that tells fmincon to ignore a parameter value?

My fmincon objective function contains undefined subsets of the multi-dimensional parameter space, which are difficult to discover and add to the fmincon constraints. Is there a return value for my objective function that tells fmincon to ignore a parameter value? Nan or Inf give errors and I'm reluctant to use a valid number that would confuse the gradient algorithm.

 Accepted Answer

You should be using fmincon's SQP algorithm. It is capable of backing up from NaNs or Infs if it collides with them in the course of its search.
However, it is important that the region of your parameter space which does have well-defined objective and constraint values be an open subset of R^n (or in other words, that the undefined region be closed). If not, you have not satisfied fmincon's requirement that your objective and constraint functions be differentiable. A requirement for a function to be differentiable is that it have defined values throughout some open set.

1 Comment

Thank you, Matt and John. I confirm that SQP recovers from occasional undefined objective function parameters, albeit not the initial value, of course.

Sign in to comment.

More Answers (1)

Simple anser: No.
Longer answer: Noooo.
Your function needs to be defined everywhere inside the constraint boundaries. It cannot be discontinuous. So returning inf, nan, or any garbage number will make it discontinuous, and certainly non-differentiable. No, you cannot do what you wish with fmincon.

Categories

Community Treasure Hunt

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

Start Hunting!