Skip to content

dual_names option not ensuring named dual constraint #132

Closed
@andrewrosemberg

Description

@andrewrosemberg

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))"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions