# Set\_start\_value to reduce iterations

**URL:** <https://discourse.julialang.org/t/set-start-value-to-reduce-iterations/96760>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, ipopt\
**Created:** [March 29, 2023, 8:49am UTC](https://discourse.julialang.org/t/set-start-value-to-reduce-iterations/96760 "2023-03-29T08:49:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annaquest](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/annaquest/32/47482_2.png) [@Annaquest](https://discourse.julialang.org/u/Annaquest)\
**Post date:** [March 29, 2023, 8:49am UTC](https://discourse.julialang.org/t/set-start-value-to-reduce-iterations/96760/1 "2023-03-29T08:49:57Z")

</div>

I have written an algorithm where I update a penalty parameter, ρ, if some conditions are not satisfied. Then I update the objective function with the new increased parameter and call optimize! Like this,

```julia
ρ = ρ*10
initial_guess = value.(all_variables(model));
@objective(model, Min, obj + ρ * b ); # b and obj is some expression calculated (not changing)
set_start_value.(all_variables(model), initial_guess);
optimize!(model)

```

However, the algorithm seems happier without the set\_start\_value as it uses even more iterations with set\_stat\_value and sometimes even fails to find the solution. I also tried this,

```julia
variable_primal, constraint_solution,nlp_dual_start = get_start_values(model); 
@objective(model, Min, obj + ρ * b );  
set_optimal_start_values(model,variable_primal, constraint_solution,nlp_dual_start)
optimize!(model)

```

where `get_start_values(model)` and `set_optimal_start_values(...)` is doing the same as the `set_optimal_start_values` found at [[Primal and dual warm-starts · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/conic/start_values/)]. Am I doing this the wrong way? Can I use `set_optimal_start_value` if I modify the objective? I know I can’t do this,

```julia
set_optimal_start_values(model)
@objective(model, Min, obj + ρ * b );
optimize!(model)

```

I don’t know if my question was clear. I want to try to reduce the number of iterations by using the optimal start value function. I was wondering if I am doing it correctly.

---

<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:** [March 29, 2023, 6:27pm UTC](https://discourse.julialang.org/t/set-start-value-to-reduce-iterations/96760/2 "2023-03-29T18:27:54Z")

</div>

Hi @Annaquest, welcome to the forum. This is a bit easier to have a conversation on than StackOverflow.

Do you have a reproducible example that I can copy-paste? I would have expected this to improve things.

Do you also have a log of the Ipopt solves?
