Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dual_names option not ensuring named dual constraint #132

Closed
andrewrosemberg opened this issue Mar 28, 2022 · 0 comments · Fixed by #133
Closed

dual_names option not ensuring named dual constraint #132

andrewrosemberg opened this issue Mar 28, 2022 · 0 comments · Fixed by #133

Comments

@andrewrosemberg
Copy link

andrewrosemberg commented Mar 28, 2022

Primal bounded variable with name not getting named dual constraint.

In the below example, the variable named "0_pg[1]" (that has both an upper and lower bound) gets a dual constraint created but with no name.

MWE:

using JuMP
using Dualization
using GLPK
using Downloads
using PowerModels

case_name = "pglib_opf_case5_pjm.m"
DATA_DIR = mktempdir()
case_file_path = joinpath(DATA_DIR, case_name)
Downloads.download("https://raw.githubusercontent.com/power-grid-lib/pglib-opf/01681386d084d8bd03b429abcd1ee6966f68b9a3/" * case_name, case_file_path)
network_data = PowerModels.parse_file(case_file_path)

pm = PowerModels.instantiate_model(
    network_data,
    DCPPowerModel,
    PowerModels.build_opf;
    setting=Dict("output" => Dict("duals" => true)),
)

jump_primal_model = pm.model

##### Ensuring our primal Variable has a name
@assert name(var(pm, 0, :pg, 1)) == "0_pg[1]"
@assert !isnothing(variable_by_name(jump_primal_model, "0_pg[1]"))

dual_jump__model = dualize(jump_primal_model, with_optimizer(GLPK.Optimizer); dual_names = DualNames("dual_v_", "dual_c_"))

####### ERROR #######
@assert !isnothing(constraint_by_name(dual_jump__model, "dual_c_$(var(pm, 0, :pg, 1))"))
@andrewrosemberg andrewrosemberg changed the title dual_names option not ensuring named Constraint dual_names option not ensuring named dual constraint Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant