Skip to content

Commit

Permalink
Merge pull request plasmo-dev#90 from dlcole3/dc/fix_dual_call
Browse files Browse the repository at this point in the history
Updated `dual(subgraph, linkconstraint)` to call from correct subgraph
  • Loading branch information
jalving authored Oct 7, 2023
2 parents 6a371f5 + 3a809da commit 51bb4c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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
5 changes: 3 additions & 2 deletions src/optigraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,9 @@ Retrieve the dual value of `linkref` on optigraph `graph`.
"""
function JuMP.dual(graph::OptiGraph, linkref::LinkConstraintRef)
optiedge = JuMP.owner_model(linkref)
id = graph.id
return MOI.get(optiedge.backend, MOI.ConstraintDual(), linkref)
edge_pointer = optiedge.backend.optimizers[graph.id]
dual_value = MOI.get(optiedge.backend, MOI.ConstraintDual(), linkref)
return dual_value
end

# set start value for a graph backend
Expand Down

0 comments on commit 51bb4c6

Please sign in to comment.