Closed dvignon closed 5 years ago
To the best of my knowledge, this is not yet supported. But it is a good point, we can put it up on the feature request list.
@ccoffrin Sounds good. Thanks. Would you by chance have any insight as to how I might be able to solve the above problem with JuMP?
@odow @mlubin any suggestions?
It looks like Juniper is trying to add an expression with the user-defined function to another JuMP model without registering it. However, there's no API to access the registry of user-defined functions from a JuMP model, so this is not an easy issue to fix.
Good to know. Is there any MINLP solver that supports user defined functions? For example, I am wondering what would happen with the old OSI interface to bonmin.
@dvignon it's not really the nicest way but maybe it's something you can work with for now.
Define the solver like this and set it after defining ll
the model definition is then simply m= Model()
solver = JuniperSolver(IpoptSolver(print_level=0);
mip_solver=CbcSolver(),
registered_functions=[Juniper.register(:ll,length(Blinks),ll,autodiff=true)])
setsolver(m, solver)
this works on the branch: https://github.com/lanl-ansi/Juniper.jl/tree/idea-118
Bonmin is oblivious to expression graphs, so user-defined functions are irrelevant. Does Juniper use expression graphs in a nontrivial way, or does it just copy them from one model to another? If it's the latter, you could look to how Pavito transforms the derivative evaluators instead of manipulating expression graphs.
@Wikunia Thank you very much!!! @ccoffrin and @mlubin thanks for looking into this.
This is implemented for v0.4 as well here: https://github.com/lanl-ansi/Juniper.jl/tree/feature-userfunction Will be tested and then merged.
New push on that branch for user defined gradients.
Tested by @tasseff shell it be merged @ccoffrin ?
Is there a PR I can review?
So I am using Juniper with Ipopt and Cbc to solve a bilevel problem. The user-defined function for the lower level problem takes in binary values from the upper-problem and returns the objective function value. It seems, however, that Juniper does not recognize that user-defined function, even after it has been registered with JuMP. A MWE is posted below:
The following error is returned
Thanks for your help.