From 3df7e3fc43031d5d53ecc5b39c0349ced9fcc6fd Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 26 Sep 2023 10:36:35 -0500 Subject: [PATCH 1/2] Updated function for calling dual on different subgraphs --- src/optigraph.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/optigraph.jl b/src/optigraph.jl index 7a4e1e0..bc98a03 100644 --- a/src/optigraph.jl +++ b/src/optigraph.jl @@ -890,7 +890,14 @@ 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) + + last_solution_id = optiedge.backend.last_solution_id + optiedge.backend.last_solution_id = graph_id + + dual_value = MOI.get(optiedge.backend, MOI.ConstraintDual(), linkref) + optiedge.backend.last_solution_id = last_solution_id + + return dual_value end # set start value for a graph backend From 3a809da82097a82f105f67bc698e127707b98fb6 Mon Sep 17 00:00:00 2001 From: jalving Date: Sat, 7 Oct 2023 14:35:45 -0700 Subject: [PATCH 2/2] use edge backend mapping --- src/optiedge.jl | 3 +-- src/optigraph.jl | 8 +------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/optiedge.jl b/src/optiedge.jl index ebf4736..b01d11c 100644 --- a/src/optiedge.jl +++ b/src/optiedge.jl @@ -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 diff --git a/src/optigraph.jl b/src/optigraph.jl index bc98a03..f30456e 100644 --- a/src/optigraph.jl +++ b/src/optigraph.jl @@ -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