Skip to content

Implement JuMP.copy_extension_data #200

@klamike

Description

@klamike
┌ Warning: Model contains extension data of type Dualization.PrimalDualMap{Float64} that we do not know how to copy.
│ 
│ If you are using a JuMP extension and you did not add data to the `model.ext` dictionary. Please open an issue on the GitHub repository of the JuMP extension and tell them to implement `JuMP.copy_extension_data`.
│ 
│ If you added things to `model.ext`, they have not been copied.
└ @ JuMP JuMP.jl/src/copy.jl:23

It is not obvious to me how to do this nicely since we don't have the ReferenceMap in JuMP.copy_extension_data. Ideally it would work like

m = Model()
@variable m x
@constraint m y x  1
@objective m Min x
dual_model = dualize(model)
copied_dual, ref_map = JuMP.copy_model(dual_model)

# manually propagate keys (current work-around)
y1 = getindex(ref_map, Dualization._get_dual_variables(dual_model, model[:y]))

# proposed behavior -- map from original primal to copied dual
@assert y1 == Dualization._get_dual_variables(copied_dual, model[:y])

Alternatively, set it missing or something that throws to show the above workaround?

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