Polyhedra.jl
Polyhedra.jl copied to clipboard
[feature] JuMP: Support accessing the attribute `MathOptInterface.ConstraintDual(1)`
Is it possible to get the dual solution from a JuMP
model constructed from a polyhedron?
using Polyhedra
using JuMP
using Clp
using LinearAlgebra
hrep = HalfSpace([-1, 0], 0) ∩ HalfSpace([0, -1], 0) ∩ HalfSpace([1, 1], 1)
model = Model(with_optimizer(Clp.Optimizer, LogLevel=0))
@variable(model, x[1:2])
con = @constraint(model, x in hrep)
@objective(model, Max, dot([1, 0], x))
optimize!(model)
value.(x)
2-element Array{Float64,1}:
1.0
-0.0
But dual
and shadow_price
do not work:
dual(con)
ArgumentError: Constraint bridge of type `Polyhedra.PolyhedraToLPBridge{Float64,MathOptInterface.ScalarAffineFunction{Float64}}` does not support accessing the attribute `MathOptInterface.ConstraintDual(1)`.
...
shadow_price(con)
The shadow price is not defined or not implemented for this type of constraint.
...
Not yet. We need to figure out what it would be. It could be a struct providing a mapping between H-Rep indices and the dual of the corresponding constraint