# Cyclic policy graph with fix number of cycles - SDDP.jl

**URL:** <https://discourse.julialang.org/t/cyclic-policy-graph-with-fix-number-of-cycles-sddp-jl/116546>\
**Category:** Optimization (Mathematical)\
**Tags:** question, sddp\
**Created:** [July 2, 2024, 8:21pm UTC](https://discourse.julialang.org/t/cyclic-policy-graph-with-fix-number-of-cycles-sddp-jl/116546 "2024-07-02T20:21:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sorooshsa](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Sorooshsa](https://discourse.julialang.org/u/Sorooshsa)\
**Post date:** [July 2, 2024, 8:21pm UTC](https://discourse.julialang.org/t/cyclic-policy-graph-with-fix-number-of-cycles-sddp-jl/116546/1 "2024-07-02T20:21:16Z")

</div>

Hi everyone,

Can we design a cyclic linear policy graph in SDDP.jl with a fixed number of cycles? Let’s assume there are 4 nodes, where node 4 transitions to node 1 with a probability of 1. However, this cycle should repeat only for a fixed number of times, for example, 2 cycles, and then it terminates.  
P.S: I know we can model infinite horizon, but here I want something like finite cyclic modeling.

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:** [July 13, 2024, 12:50am UTC](https://discourse.julialang.org/t/cyclic-policy-graph-with-fix-number-of-cycles-sddp-jl/116546/2 "2024-07-13T00:50:05Z")

</div>

See [API Reference · SDDP.jl](https://sddp.dev/stable/apireference/#SDDP.InSampleMonteCarlo)

You can do something like:

```julia
SDDP.train(
    model,
    sampling_scheme = SDDP.InSampleMonteCarlo(;
        max_depth = 8,
        terminate_on_dummy_leaf = true,
    ),
)

```

But note that this is _not_ the same as a finite graph with 8 nodes.
