# How to use a solution as starting point to run my NL model again after modifying something (e.g. a constraint)?

**URL:** <https://discourse.julialang.org/t/how-to-use-a-solution-as-starting-point-to-run-my-nl-model-again-after-modifying-something-e-g-a-constraint/88203>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [October 4, 2022, 3:07am UTC](https://discourse.julialang.org/t/how-to-use-a-solution-as-starting-point-to-run-my-nl-model-again-after-modifying-something-e-g-a-constraint/88203 "2022-10-04T03:07:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angel127](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Angel127](https://discourse.julialang.org/u/Angel127)\
**Post date:** [October 4, 2022, 3:07am UTC](https://discourse.julialang.org/t/how-to-use-a-solution-as-starting-point-to-run-my-nl-model-again-after-modifying-something-e-g-a-constraint/88203/1 "2022-10-04T03:07:27Z")

</div>

I have a NL model, and it finds a locally optimal solution after two hours. I would like to apply a nested for loop to use the epsilon constrained method. Then, on each iteration, some right-hand side coefficients will be varying. I want to know how to use the solutions I found (or at least one of them, maybe the very first one) as starting points. Since my model has a lot of variables and constraints, I would like to “load” a solution as a starting point efficiently. Every comment or alternative is appreciated.

---

<div class="post-metadata">

**Author:** ![Mahbubar06](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@Mahbubar06](https://discourse.julialang.org/u/Mahbubar06)\
**Post date:** [October 4, 2022, 7:03pm UTC](https://discourse.julialang.org/t/how-to-use-a-solution-as-starting-point-to-run-my-nl-model-again-after-modifying-something-e-g-a-constraint/88203/2 "2022-10-04T19:03:50Z")

</div>

I am no expert, but the following way works for me.

```julia
using JuMP, Ipopt

model = Model(Ipopt.Optimizer)
@NLparameter(model, epsn == 15)
@variable(model, x >= 0)
@variable(model, y >= 0)
@NLconstraint(model, x^2+y^2 <= epsn) #assuming this is the epsilon constraint
@NLobjective(model, Min, (5-x)^2+3*(y-x^2)^2)
optimize!(model)

epsilon = [10, 5, 2]

for p in epsilon
    xVal = value(x)
    yVal = value(y)
    set_start_value(x, xVal) #warm start
    set_start_value(y, yVal)
    set_value(epsn, p)
    optimize!(model)
end

```

---

<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:** [October 8, 2022, 4:38am UTC](https://discourse.julialang.org/t/how-to-use-a-solution-as-starting-point-to-run-my-nl-model-again-after-modifying-something-e-g-a-constraint/88203/3 "2022-10-08T04:38:44Z")

</div>

Start values are documented here: [Variables · JuMP](https://jump.dev/JuMP.jl/stable/manual/variables/#Start-values)
