Couple JuMP with the simulator


I am working on a project about multi-reservoir control optimization problem and the objective function is calculated by Telemac simulator. Do you have some examples or best practices for such integration? I have read some JuMP examples and the objective function is written in expressions. Can I pass one function to @objective macro and can I get all variables in the function?


1 Like

As far as I know, JuMP cannot deal with black box functions. Alternatives are listed here

1 Like

Hi @Jack_Tang,

If your simulator can only return function evaluations, then JuMP isn’t the right tool for the job. Follow the link suggested by @tred for alternatives.

But if it can return derivative information, then you could consider using a user-defined function: Nonlinear Modeling · JuMP

Thanks for your quick reply. Follow the link you provide, I find the user-defined-function section: Nonlinear Modeling · JuMP. And the code snippet from Register a function section

square(x) = x^2
couple_with(x, y) = function .... get result from simultor... end

model = Model()

register(model, :square, 1, square; autodiff = true)
register(model, :couple_with, 2, f; autodiff = true)

@variable(model, x[1:2] >= 0.5)
@NLobjective(model, Min, couple_with(x[1], x[2]))


Yep, thanks for the confirm!

1 Like