You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was hoping to use BilevelJuMP with PowerSimulations.jl. There is already existing code to construct my lower level JuMP model in PowerSimulations.jl, which I would like to leverage. Is there a way to build a JuMP model using some other existing package, and then set that as the lower level problem in the BilevelModel?
Thanks,
Devon
The text was updated successfully, but these errors were encountered:
dsigler1234
changed the title
Using Existing JuMP Model Construction Code with BiLevelJuMP
Using Existing JuMP Model Construction Code with BilevelJuMP
Jun 18, 2024
functioncreate_my_model()
# initialize the JuMP model
model =Model()
# append data to model@variable(model, ...@constraint(model, ...@objective(model, ...return model
end
You can split this in two function (PowerModels work this way, you just have to find the right functions, HydroPowerModels.jl does it):
functioninit_model()
# initialize the JuMP model
model =Model()
return model
endfunctionbuild_model!(model)
# append data to model@variable(model, ...@constraint(model, ...@objective(model, ...return model
endfunctioncreate_my_model()
# initialize the JuMP model
model =init_model()
build_model!(model)
return model
end
Now you can re-use the build_model!(model) function:
functioncreate_my_bilevel_model()
model =BilevelModel()
# now pass just the lower level model as `Lower(model)`# this will add all variables and constraints to the lower part of the modelbuild_model!(Lower(model))
# do something else for the upper......return model
end
Again, this is possible in PowerModels and is already done for multi-stages (not bilevel) models in HydroPowerModels.
Hello,
I was hoping to use BilevelJuMP with PowerSimulations.jl. There is already existing code to construct my lower level JuMP model in PowerSimulations.jl, which I would like to leverage. Is there a way to build a JuMP model using some other existing package, and then set that as the lower level problem in the BilevelModel?
Thanks,
Devon
The text was updated successfully, but these errors were encountered: