# Sensitivity analysis in simulation phase of SDDP.jl

**URL:** https://discourse.julialang.org/t/sensitivity-analysis-in-simulation-phase-of-sddp-jl/132085
**Category:** Optimization (Mathematical)
**Tags:** sddp
**Created:** [September 4, 2025, 12:35am UTC](https://discourse.julialang.org/t/sensitivity-analysis-in-simulation-phase-of-sddp-jl/132085 "2025-09-04T00:35:42Z")
**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: [September 4, 2025, 12:35am UTC](https://discourse.julialang.org/t/sensitivity-analysis-in-simulation-phase-of-sddp-jl/132085/1 "2025-09-04T00:35:42Z")

</div>

Hello,

I trained a hydropower model using SDDP.jl with a given set of parameters. To check the robustness of the trained policy, I would now like to run simulations where one of the parameters is changed — for example, increasing the load parameter that must be satisfied in each node by 10%.

My goal is to perform a simple sensitivity analysis and observe how the trained policy reacts to this change in demand.

I tried to just modify the demand parameter in my code and rerun the simulation, but it seems that this approach does not work directly.

What is the correct way to change parameters (like demand) **only in the simulation phase** after training the model?

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: [September 4, 2025, 1:06am UTC](https://discourse.julialang.org/t/sensitivity-analysis-in-simulation-phase-of-sddp-jl/132085/2 "2025-09-04T01:06:46Z")

</div>

There are a few options.

You should write the cuts from the first model, create a new model, and then read in the cuts:

```Julia
SDDP.write_cuts_to_file(model, "model.cuts.json")
changed_model = ...
SDDP.read_cuts_from_file(changed_model, "model.cuts.json")

```

You could loop through the trained subproblems and modify them:

```julia
for (index, node) in model.nodes
    # do something with node.subproblem
end

```

You could add the demand parameter as a random variable that is constant during training, but allows you to simulate a different value.

Do you have a small example of what you tried?
