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

Price interpolation and Markov states #121

Closed
odow opened this issue Apr 19, 2018 · 3 comments
Closed

Price interpolation and Markov states #121

odow opened this issue Apr 19, 2018 · 3 comments

Comments

@odow
Copy link
Owner

odow commented Apr 19, 2018

A user writes

In an example of your work "Stochastic dual dynamic programming with stagewise dependent objective uncertainty”, you use a value_function = priceprocess(USE_AR1) as a parameter of SDDPModel. I want to know if this we can modify the priceprocess function to allow noises from different discrete distributions. For example, think of a tree with different branches at stage 2 than at stage 3.

Here is an example

const DISTRIBUTIONS = [
    [1, 2, 3], # distributions in Markov state 1
    [3, 4, 5]  # distributions in Markov state 2
]
function buildvaluefunction(stage::Int, markov::Int)
    return DynamicPriceInterpolation(
        # ... other arguments omitted ...
        dynamics = (price, noise) -> price + noise,
        noises = DISTRIBUTIONS[markov]
    )
end
m = SDDPModel(
    stages = 3,
    # The transition matrix
    #    x - x
    #   / \ /
    # x    X
    #   \ / \
    #    x - x
    markov_transition = [
        [1.0]'
        [0.5 0.5],
        [0.5 0.5; 0.5 0.5]
    ],
    # pass a function that takes (stage, markov state) as arguments 
    #    and returns a value function.
    value_functon = buildvaluefunction
        ) do sp, t, i
    # you can also use the state t, and markov state i,
    #     inside the subproblem, e.g.
    @state(sp, x >= 2 * t + i, x0==0)
    @stageobjective(sp, p-> (t + i) * p * x
end
@lorenzoreus
Copy link

Dear Oscar,
I'm trying to apply previous code, but I can't make it work. buildfunction is defined with arguments, but no argumets are used when it is used in the SDDPModel. I've tried doing some changes from this example with no success. Any help is appreciated.
Nice package by the way.

@odow
Copy link
Owner Author

odow commented Apr 23, 2018

Lorenzo,

See #122.

Nice package by the way.

Thanks!

@lorenzoreus
Copy link

Thanks so much! It works

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

No branches or pull requests

2 participants