Specifying some but not all Nonlinear Constraint Gradients through Fmincon

1 view (last 30 days)
I've been using Fmincon (SQP) for constrained gradient-based optimization, but have been doing so with finite-difference approximations to the nonlinear constraint gradients. I would like to improve the optimization procedure (with regard to optimality and feasibility) by providing analytical derivatives to a small set of nonlinear constraint gradients. Is this possible? If so, how do I tell Fmincon which nonlinear constraint gradients should be approximated by finite-differencing?

Accepted Answer

Matt J
Matt J on 15 Feb 2019
Edited: Matt J on 15 Feb 2019
I agree, it would be nice if the Optimization Toolbox would expose its finite differencing code as a separate function, so that we could selectively invoke it. Unfortunately, it doesn't allow this. The easiest workaround would probably be to tell fmincon that you will provide all the constraint derivatives analytically. Then, you implement your own finite differencing code within your nonlcon function, for those constraints that you don't truly want to differentiate analytically. You don't have to implement this from scratch. There is finite differencing code on the file exchange that you can build upon, e.g.,

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!