Skip to content

Commit

Permalink
Merge pull request plasmo-dev#93 from jalving/issue-45
Browse files Browse the repository at this point in the history
fix JuMP.value
  • Loading branch information
jalving authored Oct 9, 2023
2 parents a70d81e + e74c4d7 commit c03f30b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/optigraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ the optinode variable value obtained by solving `graph` which contains said opti
function JuMP.value(graph::OptiGraph, var::JuMP.VariableRef)
node_pointer = JuMP.backend(var.model).result_location[graph.id]
var_idx = node_pointer.node_to_optimizer_map[index(var)]
return MOI.get(backend(graph).optimizer, MOI.VariablePrimal(), var_idx)
# return MOI.get(backend(graph).optimizer, MOI.VariablePrimal(), var_idx)
return MOI.get(node_pointer, MOI.VariablePrimal(), var_idx)
end

"""
Expand Down
3 changes: 3 additions & 0 deletions src/optimizer_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ function JuMP.set_optimizer(node::OptiNode, optimizer_constructor)
return nothing
end

# NOTE: this resets NLP data on every NodePointer, so graph solutions get cleared
# This is currently a known limitation in Plasmo.jl. If you solve a node after a graph,
# it will remove the graph solution.
function JuMP.optimize!(node::OptiNode; kwargs...)
JuMP.optimize!(jump_model(node); kwargs...)
return nothing
Expand Down

0 comments on commit c03f30b

Please sign in to comment.