Multivariate nonlinear constrained optimization using JuMP and ForwardDiff (Automatic Differentiation)

Hi, I am new to Julia and I am trying to understand how to use JuMP/ForwardDiff to transfer a collocation algorithm (nlp problem) written in MATLAB. I use fmincon in MATLAB with a nonlinear function that returns a vector of nonlinear constraints. My objective function also operates on an input vector, but returns a scalar. I don’t have my own analytical Gradient of the objective, Jacobian and Hessian of the constraints, I rely on the default finite-difference method used in fmincon for those. Now I understand that there is a possibility of using automatic differentiation (ForwardDiff package) in Julia, but from what I understand of the JuMP package, there is no way to define a vector of nonlinear constraints, as well as no way of passing a vector as an argument to the objective function.

Please let me know if my understanding/interpretation is wrong in some way. If I am indeed correct, can someone more knowledgeable about these packages tell me why there are these limitations and if there is a way to extend the packages to build multivariate support into these packages?

Thanks,
Dhathri

Hi there!

The JuMP documentation has a bunch of tutorials and manual content on nonlinear programming with JuMP.

If you’re coming from MATLAB, things are a little different. You should try to write out your objective and constraints as scalar expressions, rather than providing a single large function to optimize.

If you can’t write our your expressions algebraically and you just have a black-box function, JuMP might not be the right tool for the job; see Should I use JuMP? · JuMP.

It’s often hard to provide general advice without seeing code, so I suggest you read Please read: make it easier to help you and provide a simplified minimal reproducible example of the problem that you are trying to solve.

1 Like