Open odow opened 4 years ago
The bigger issue is probably that dual(con)
is not the target. Either use shadow_price
, or use -dual(con)
if maximizing.
Here's the backstory: https://jump.dev/JuMP.jl/v0.21.1/constraints/#constraint_duality-1
Here's what we do in SDDP.jl: https://github.com/odow/SDDP.jl/blob/ab23175c601f5c01ed5d38264e1619eb1d2056ee/src/plugins/integrality_handlers.jl#L69-L82
This is also a worthwhile thing to do: https://github.com/odow/SDDP.jl/blob/ab23175c601f5c01ed5d38264e1619eb1d2056ee/src/algorithm.jl#L154-L178
Read the performance tips: https://docs.julialang.org/en/v1/manual/performance-tips/index.html In particular, using global variables and having loops in the top scope will make your code orders of magnitude slower than it needs to be :(. To fix, just wrap the training and simulation loops in a function. (Your code feels very "Matlab-y." While the syntax is similar, writing long scripts is not Julia's forte.)
You can also use Julia's package manager to add a
Project.toml
andManifest.toml
. This will prevent version incompatibilities: https://docs.julialang.org/en/v1/stdlib/Pkg/#