Mopdify OBBT in PowerModels.jl to be applicable on model constructor in PowerModelsAnnex

Hi All,

I have developed a new model constructor in PowerModelsAnnex and want to apply the OBBT.jl in PowerModels to the model. Can you please guide me how can I do that? In other words, is it possible to call the model constructor(i.e., implemented in PowerModelsAnnex) in OBBT.jl? Any help would be appreciated.

All the best,
Rasoul

model_constructor is a keyword argument of the function run_obbt_opf. For models that define the correct variables it should work fine with a model defined in another package.

Thanks for the response!
There are different functions in PowerModelsAnnex (e.g., post_qc_opf) that solve the OPF problem. I wanna use one of these functions as a model_constructor to do the optimization based bound tightening (OBBT). Can you please let me know what should I do to make the “post_qc_opf” compatible with OBBT.jl code in PowerModels. In other words, how can I call or use “post_qc_opf” function in OBBT.jl? Thanks in advance!

All the best,
Rasoul

The the OBBT function and its model_constructor argument are designed to work with the models defined in PowerModels. Not the stand alone models in PowerModelsAnnex. You can try making a copy of the OBBT function in PowerModels.jl and adapting it to work with the model constructors functions in PowerModelsAnnex.

Thanks for the response!

I am trying to adapt the OBBT code with one of model_constructor functions (e.g., post_qc_opf) in PowerModels Annex. Can you please give me some hints about building the model_relaxation by model_constructor functions (e.g., post_qc_opf) in PowerModelsAnnex.

Without having a model_relaxation I cannot use solve_generic_model for solving relaxation model. I am also not able to change the objective function (e.g., @objective(model_bt.model, Max, vm[bus])) when I need to change them. I will really appreciate your comments.

All the best,

Rasoul

Thanks for the response!

I have a question about the JuMP model in my modified OBBT code and I am not sure here is the right place to ask it. I took your word about adapting OBBT code with the model constructor in PowerModelsAnnex. I added the model constructor in PowerModelsAnnex as a function to the OBBT code and passed several flags into the function (i.e., modelconstructor) to select which objective at which direction to be optimized.
The adapted OBBT code works properly and obtains the same solution that original OBBT obtains. However, the code gets super sluggish as it goes forward. Every time that the function (i.e., modelconstructor) gets called in the code, following warning shows up for all variables in the model:

Warning: A variable or constraint named va is already attached to this model. If creating variables programmatically, use the anonymous variable syntax x = @variable(m, [1:N], ...).

After each iteration variable’s bound get updated and there is no need to old model. Is there any way to get rid of the older model and build a new one for the next iteration in order to prevent the issue. I will appreciate your response!

All the best,
Rasoul

Yes. This is what the code in PowerModels does. It is not clear to me why your code would not do the same.