Closed blegat closed 6 years ago
I just opened a branch (no-mpi) to try to excise MPI from StructJuMP completely. Maybe I should target my changes against this PR instead.
looks like a clean enough design to me. It breaks StructJuMPSolverInterface.jl, but we've seen it coming with JuMP's new MOI backend :)
@michel2323
Finally passing the tests :) Ready for review !
I would try to get StructJuMPSolverInterface working with this branch. Is everything on the StructJuMP side ready to make that happen or should I still wait?
Everything should be ready :)
When calling NLobjective I get the following
ERROR: LoadError: LoadError: MethodError: no method matching parseNLExpr_runtime(::StructuredModel, ::Int64, ::Array{JuMP.Derivatives.NodeData,1}, ::Int64, ::Array{Float64,1}) Closest candidates are: parseNLExpr_runtime(!Matched::Model, ::Number, ::Any, ::Any, ::Any) at /home/michel/.julia/dev/JuMP/src/parse_nlp.jl:158 parseNLExpr_runtime(!Matched::Model, ::Any, ::Any, ::Any, ::Any) at /home/michel/.julia/dev/JuMP/src/parse_nlp.jl:193 parseNLExpr_runtime(!Matched::Model, !Matched::VariableRef, ::Any, ::Any, ::Any) at /home/michel/.julia/dev/JuMP/src/parse_nlp.jl:164
I see that nlp.jl has been removed. So I guess some changes happened here for some reason. Also, for NLconstraint I get
ERROR: LoadError: LoadError: MethodError: no method matching initNLP(::StructuredModel) Closest candidates are: initNLP(!Matched::Model) at /home/michel/.julia/dev/JuMP/src/nlp.jl:148
What is the way to go here? It seems to me that you overwrite/overload these JuMP functions in StructJuMP somehow?
I see that nlp.jl has been removed. So I guess some changes happened here for some reason.
NLP has not been implemented yet in this PR. We might need an nlp.jl
file like in the current version of StructJuMP with similar content. The NLP part of JuMP has not moved much from JuMP v0.18 to JuMP master contrarily to the rest of the constraints
Ok. So how would I add support for NLconstraint and NLobjective. The 2 functions above, initNLP and parseNLExpr_runtime require a JuMP model as argument. How do I access the JuMP model from a StructJuMP object?
I cannot see any of it in JuMPExtension that I could rely on, which seems to be the way it is done now.
Or are you saying I should not touch it and wait :-)?
How do I access the JuMP model from a StructJuMP object?
There is no JuMP model inside the StructJuMP model, the StructJuMP model should play the role of the JuMP model, we might need to add an nlp_data
field to the StructJuMP model.
I cannot see any of it in JuMPExtension that I could rely on, which seems to be the way it is done now.
No there is no JuMPExtension from which you can get inspiration. The best approach would be to add the nlp_data
field and implement the missing methods similarly to what is done in https://github.com/JuliaOpt/JuMP.jl/blob/06a58d8d20d0002fadf1018cdc99f4874a88ef20/src/nlp.jl.
I am not super familiar with the NLP part of JuMP though so @joehuchette and @mlubin might have better advises.
I have added a release-0.1
branch and a README note saying that the release-0.1
branch is for development with JuMP v0.18 and the master branch is for developement with JuMP v0.19-alpha
I moved the old version in the
old
folder as the new version of JuMP needs a redesign of StructJuMP as JuMP stores the model in an MOI backend which does not support expression with variables belonging to another model. The new StructuredModel does not uses MOI to store the model. It keeps the AbstractVariable and AbstractConstraint that a JuMP model would have given to MOI and got index back that would be stored in VariableRef or ConstraintRef. Given a StructuredModel, it is simple to build a JuMP Model to solve the problem with MOI. You just create a model and fill it using addvariable and addconstraint (replacing the StructuredVariableRef by the corresponding VariableRef returned by addvariable in the functions). This is what is done inBendersBridge
which usedWhat do you think of the new design ?
At the moment, benderstest pass but it needs a few PR to be merged: https://github.com/JuliaStochOpt/ParameterJuMP.jl/pull/7, https://github.com/JuliaOpt/ECOS.jl/pull/72, https://github.com/JuliaOpt/ECOS.jl/pull/71, https://github.com/JuliaOpt/ECOS.jl/pull/70