Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getValue() doesnt seem to work with VariableRef arguments #45

Closed
etatara opened this issue Jan 16, 2022 · 3 comments
Closed

getValue() doesnt seem to work with VariableRef arguments #45

etatara opened this issue Jan 16, 2022 · 3 comments
Labels

Comments

@etatara
Copy link

etatara commented Jan 16, 2022

JuMP.value(node::OptiNode,vref::VariableRef) throws an error:

ERROR: KeyError: key Symbol("##260") not found
Stacktrace:
 [1] getindex(h::Dict{Symbol, MathOptInterface.ModelLike}, key::Symbol)
   @ Base ./dict.jl:482
 [2] value(node::OptiNode, vref::VariableRef)
   @ Plasmo ~/julia-1.6.2/share/julia/packages/Plasmo/s5YhC/src/optinode.jl:48
 [3] top-level scope
   @ REPL[22]:1

This can be replicated in the example optigraph_4_nodes.jl by calling:

JuMP.value(node, node[:x])

In optinode.jl:48, the call to JuMP.backend(node).result_location[node.id] throws the error because the node.id symbol is different from the key in the result_location dict.

@etatara
Copy link
Author

etatara commented Jan 16, 2022

It seems like just using JuMP.value(node[:x]) works OK.

@jalving
Copy link
Member

jalving commented Jan 16, 2022

Thanks for reporting this. Both versions are supposed to work. I'll push out a fix asap.

@jalving jalving added the bug label Oct 9, 2023
@jalving jalving mentioned this issue Oct 9, 2023
@jalving
Copy link
Member

jalving commented Oct 9, 2023

This should now be fixed by #93.

Just FYI, fixing this revealed another issue with running optimize! on a node after a graph. It is normally possible to track separate solutions on a node versus the graphs that contain it. Right now, if you optimize a node directly, it will clear all of solutions on each graph. I'll plan to file an issue with a working example.

@jalving jalving closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants