# ProgressiveHedging.jl - Decision Variables

**URL:** <https://discourse.julialang.org/t/progressivehedging-jl-decision-variables/94414>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package\
**Created:** [February 10, 2023, 3:23pm UTC](https://discourse.julialang.org/t/progressivehedging-jl-decision-variables/94414 "2023-02-10T15:23:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mariana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mariana/32/15064_2.png) [@Mariana](https://discourse.julialang.org/u/Mariana)\
**Post date:** [February 10, 2023, 3:23pm UTC](https://discourse.julialang.org/t/progressivehedging-jl-decision-variables/94414/1 "2023-02-10T15:23:58Z")

</div>

Hello!

I’m starting to use ProgressiveHedging.jl and testing it in a two-stage problem.

However, both the first and second stages variables in my case present different dimensions. For example, I have 6 first-stage decision variables, 3 of which are 2-dimensional arrays, and the other 3 are 4-dimensional arrays.

How should I create the dictionary for JuMPSubproblem, in this case?

Thank you!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [February 11, 2023, 9:39pm UTC](https://discourse.julialang.org/t/progressivehedging-jl-decision-variables/94414/2 "2023-02-11T21:39:43Z")

</div>

I haven’t used ProgressiveHedging.jl.

Do you have the code that you’re currently trying?

From the example here, [Basic Example · ProgressiveHedging.jl](https://nrel.github.io/ProgressiveHedging.jl/stable/examples/basic/), it looks like you need `stage1` and `stage2` to be vectors of JuMP variables.

So create your first-stage as-is, and then use something like (I haven’t tested this):

```plaintext
model = Model()
@variable(model, x[1:2, 1:2])
@variable(model, y[1:2, 1:2, 1:2, 1:2])
stage1 = vcat(vec(x), vec(y))

```

You might also consider SDDP.jl;

- [GitHub - odow/SDDP.jl: Stochastic Dual Dynamic Programming in Julia](https://github.com/odow/SDDP.jl)
- [Example: Two-stage Newsvendor · SDDP.jl](https://odow.github.io/SDDP.jl/stable/tutorial/example_newsvendor/)

---

<div class="post-metadata">

**Author:** ![Mariana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mariana/32/15064_2.png) [@Mariana](https://discourse.julialang.org/u/Mariana)\
**Post date:** [February 13, 2023, 1:22pm UTC](https://discourse.julialang.org/t/progressivehedging-jl-decision-variables/94414/3 "2023-02-13T13:22:48Z")

</div>

Thank you very much, @odow! Your suggestion worked fine!
