Skip to content

Commit

Permalink
use edge backend mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
jalving committed Oct 7, 2023
1 parent 3df7e3f commit 3a809da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/optiedge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ function JuMP.constraint_object(linkref::LinkConstraintRef)
return linkref.optiedge.linkconstraints[linkref.idx]
end

#TODO: Update this
function JuMP.dual(linkref::LinkConstraintRef)
optiedge = JuMP.owner_model(linkref)
id = optiedge.backend.last_solution_id
# this grabs the last solution
return MOI.get(optiedge.backend, MOI.ConstraintDual(), linkref)
end

Expand Down
8 changes: 1 addition & 7 deletions src/optigraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -889,14 +889,8 @@ Retrieve the dual value of `linkref` on optigraph `graph`.
"""
function JuMP.dual(graph::OptiGraph, linkref::LinkConstraintRef)
optiedge = JuMP.owner_model(linkref)
id = graph.id

last_solution_id = optiedge.backend.last_solution_id
optiedge.backend.last_solution_id = graph_id

edge_pointer = optiedge.backend.optimizers[graph.id]
dual_value = MOI.get(optiedge.backend, MOI.ConstraintDual(), linkref)
optiedge.backend.last_solution_id = last_solution_id

return dual_value
end

Expand Down

0 comments on commit 3a809da

Please sign in to comment.