Optimization with JuMP: an affine expression enters a nonlinear constraint (dynamic discrete choice)

User-defined functions cannot return a vector output.

This example suggests a work-around: https://jump.dev/JuMP.jl/stable/examples/nlp_tricks/#User-defined-functions-with-vector-outputs.

If you have lots of functions, you will need to use the raw-expression syntax: Registering an array of functions and using them in constraints and objectives - #2 by odow (more docs: https://jump.dev/JuMP.jl/stable/nlp/#Raw-expression-input).

2 Likes