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

Asynchronous cuts with price states #324

Closed
adow031 opened this issue Jun 18, 2020 · 10 comments · Fixed by #325
Closed

Asynchronous cuts with price states #324

adow031 opened this issue Jun 18, 2020 · 10 comments · Fixed by #325

Comments

@adow031
Copy link

adow031 commented Jun 18, 2020

I've written a model using price states, and I'm trying to use the asynchronous cut generation, however, it throws the following error.

The error is being thrown at this section of the code:
for (y, μ) in zip(cut.obj_y, V.objective_states)
JuMP.add_to_expression!(yᵀμ, y, μ)
end

I don't get any error if price states are not present. The documentation on these asynchronous cuts is a bit limited. Is this not supported yet?

MethodError: no method matching iterate(::Nothing)
Closest candidates are:
  iterate(!Matched::Core.SimpleVector) at essentials.jl:600
  iterate(!Matched::Core.SimpleVector, !Matched::Any) at essentials.jl:600
  iterate(!Matched::ExponentialBackOff) at error.jl:218
  ...
in top-level scope at FINAL INFINITE HORIZON MULTIDIMENSIONAL.jl:45
in  at base\none
in #train#49 at SDDP\ytro1\src\algorithm.jl:874
in master_loop at SDDP\ytro1\src\plugins\parallel_schemes.jl:223
in slave_update at SDDP\ytro1\src\plugins\parallel_schemes.jl:104
in  at base\none
in #_add_cut#92 at SDDP\ytro1\src\plugins\bellman_functions.jl:69
in add_cut_constraint_to_model at SDDP\ytro1\src\plugins\bellman_functions.jl:80
in iterate at base\iterators.jl:332 
in _zip_iterate_all at base\iterators.jl:342
in _zip_iterate_some at base\iterators.jl:350 
@odow
Copy link
Owner

odow commented Jun 18, 2020

It's not implemented, but I thought I threw a nicer error:

error(
"This model uses features that are not suppored in async " *
"mode. Use `parallel_scheme = Serial()` instead.",
)

I'll take a look.

@odow
Copy link
Owner

odow commented Jun 19, 2020

Do you have a reproducible example? Are you using multi-cut as well? Found one.

@adow031
Copy link
Author

adow031 commented Jun 19, 2020

I just tested my code with the change you've made, and it's working. Should I take this to mean that this is a supported feature, or should I use it 'at my own risk'?

@odow
Copy link
Owner

odow commented Jun 19, 2020

This will be a supported feature, but for now it's "at your own risk."

@adow031
Copy link
Author

adow031 commented Jun 19, 2020

Great thanks for this; my infinite horizon objective-state model, might finally be able to converge.

@odow
Copy link
Owner

odow commented Jun 19, 2020

What's the discount factor?

@adow031
Copy link
Author

adow031 commented Jun 19, 2020

48 stages, and it wraps around with a discount factor of 0.9

@odow
Copy link
Owner

odow commented Jun 19, 2020

That shouldn't be a problem then. The real issue with the objective state is that I still haven't implemented cut selection, so it's going to hit issues with lots of cuts.

@adow031
Copy link
Author

adow031 commented Jun 19, 2020

I've previously done manual cut selection on objective state models, where I discard cuts that no longer bind for any visited states, but that was in the Julia 0.6 version.

Anyways, we're getting off topic!

@odow odow closed this as completed in #325 Jun 19, 2020
@odow
Copy link
Owner

odow commented Jun 19, 2020

Just to confirm, this is now "official supported."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants