I have downloaded the PowerModelsAnnex.jl files. I am using the build_qc_opf functions, and wish to obtain dual prices from the solution. The specific dual prices I wish to obtain are the duals of the power balance or KCL constraints formed in the function build_qc_opf(). A sample of what I am trying to do is below.
- Do i need to name the constraints? and if so, how would i name constraints that are called within a for loop within a function. For example, there would be one constraint per bus, so just including a name within the @constraint call would mean that I replace the name at each iteration.
- In any case not sure whether just calling the resultdual or getdual functions would work outside of the function, where the model is defined within the function? when i have tried getdual(constraintname) it has not recognised the variable.
- is there a constraint dictionary I can access somehow?
model = Model()
pm = build_qc_opf(data,model)
result = optimize!(model)
vars = all_variables(model)
has_duals(model) [this returns a true]
dual_price = dual(model)
Thoughts greatly appreciated @ccoffrin