# SDDP.jl: Can it model nonconvex multistage SPs?

**URL:** <https://discourse.julialang.org/t/sddp-jl-can-it-model-nonconvex-multistage-sps/98370>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package\
**Created:** [May 5, 2023, 7:44am UTC](https://discourse.julialang.org/t/sddp-jl-can-it-model-nonconvex-multistage-sps/98370 "2023-05-05T07:44:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![math\_opt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math_opt/32/25317_2.png) [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Post date:** [May 5, 2023, 7:44am UTC](https://discourse.julialang.org/t/sddp-jl-can-it-model-nonconvex-multistage-sps/98370/1 "2023-05-05T07:44:26Z")

</div>

As the title says, I want to know if the package [SDDP.jl](https://odow.github.io/SDDP.jl/stable/) models nonconvex multistage stochastic programs? The documentation says it works for convex multistage SPs; however, to make sure I don’t reinvent the wheel, I just want to know if it can handle nonconvexity.

---

<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:** [May 5, 2023, 7:57am UTC](https://discourse.julialang.org/t/sddp-jl-can-it-model-nonconvex-multistage-sps/98370/2 "2023-05-05T07:57:10Z")

</div>

It depends on the nonconvexity.

You can use binary and integer variables. But we’ll find a suboptimal policy, although for many practical problems it’s usually pretty good.

But if you have a non convex function like `sin(x)`, then no, it will not work, and you’ll likely get a policy that makes little sense.

---

<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:** [May 5, 2023, 7:59am UTC](https://discourse.julialang.org/t/sddp-jl-can-it-model-nonconvex-multistage-sps/98370/3 "2023-05-05T07:59:16Z")

</div>

> [@math\_opt](#):
>
> however, to make sure I don’t reinvent the wheel,

Do you have a generic solution approach for non-convex problems???

If you have SDDP-related questions, feel free to open an issue, [Issues · odow/SDDP.jl · GitHub](https://github.com/odow/SDDP.jl/issues), and we can discuss there.

---

<div class="post-metadata">

**Author:** ![math\_opt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math_opt/32/25317_2.png) [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Post date:** [May 5, 2023, 8:11am UTC](https://discourse.julialang.org/t/sddp-jl-can-it-model-nonconvex-multistage-sps/98370/4 "2023-05-05T08:11:47Z")

</div>

The nonconvexity, in my case, arises mostly from bilinear terms (maybe other polynomial terms but definitely not `sin(x)` or something similar). Something similar to what we have in pooling problems. By reinventing the wheel, I meant implementing SDDP for my problem, which I would want to avoid if your package can already do that. I want to minimize the effort of extending a deterministic nonconvex multi-time period problem to a multistage stochastic case and solve it using SDDP. I probably need to do a little more reading on SDDP, but I will surely reach out to you on GitHub as I have more questions about how to use your package. Thanks 🙂

---

<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:** [May 6, 2023, 2:54am UTC](https://discourse.julialang.org/t/sddp-jl-can-it-model-nonconvex-multistage-sps/98370/5 "2023-05-06T02:54:10Z")

</div>

> arises mostly from bilinear terms

SDDP.jl will “solve,” but you’ll get a suboptimal policy because SDDP.jl uses tangent cuts to approximate the cost-to-go function.

> I meant implementing SDDP for my problem, which I would want to avoid if your package can already do that

SDDP.jl _can_ solve problems with bilinear terms. But it won’t find an optimal solution. But this is an algorithmic limitation, not a limitation of the particular library.

> I want to minimize the effort of extending a deterministic nonconvex multi-time period problem to a multistage stochastic case and solve it using SDDP

It’s not clear that you could or should do this.

> I will surely reach out to you on GitHub as I have more questions about how to use your package

Yeah this might be better than discourse. The details are somewhat niche.
