jump-dev / jump-dev/Dualization.jl

Implement `JuMP.copy_extension_data`

Open
#200 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
103
Forks
7
Avg merge
2h 44m
Merged PRs (30d)
1

Description

```julia
┌ 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

```julia
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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.