# Warm-starting (set\_start\_value function) does not work in JuMP

**URL:** <https://discourse.julialang.org/t/warm-starting-set-start-value-function-does-not-work-in-jump/53620>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [January 19, 2021, 4:16pm UTC](https://discourse.julialang.org/t/warm-starting-set-start-value-function-does-not-work-in-jump/53620 "2021-01-19T16:16:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shuvomoy\_Das\_Gupta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuvomoy_das_gupta/32/10069_2.png) [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Post date:** [January 19, 2021, 4:16pm UTC](https://discourse.julialang.org/t/warm-starting-set-start-value-function-does-not-work-in-jump/53620/1 "2021-01-19T16:16:51Z")

</div>

Dear All,

I am trying to solve the following SDP with warm starting. The code is as follows

```julia
using JuMP, COSMO
    
# data
m = 5
n = 10
using Random: bitrand
c = randn(n)
x0 = bitrand(n)
A = randn(m, n)
b = A * x0 
x_prev = ones(n+1)
X_prev = x_prev*x_prev'

# JuMP model
    
sdp_model = JuMP.Model(COSMO.Optimizer)

@variables(sdp_model,
    begin
    X_tl[1 : n + 1, 1 : n + 1], PSD
end)

JuMP.set_start_value(X_tl, X_prev) 
# this line produces the following error:
# ERROR: MethodError: no method matching 
# set_start_value(::Symmetric{VariableRef,Array{VariableRef,2}}, ::Array{Float64,2})

obj = c' * X_tl[2:n + 1,1]

@objective(sdp_model, Min, obj)

@constraints(sdp_model, begin
    con_sdp_equality_1, A * X_tl[2:n + 1,1] .== b
    con_bound_1[i=1:n + 1, j=1:n + 1], X_tl[i,j] <= 1
    con_bound_2[i=1:n + 1, j=1:n + 1], X_tl[i,j] >= 0
end
    )

set_silent(sdp_model)

JuMP.optimize!(sdp_model)

obj_val = JuMP.objective_value(sdp_model)

X_sol = JuMP.value.(X_tl)

```

If I run the code I get the error

```julia
ERROR: MethodError: no method matching 
set_start_value(::Symmetric{VariableRef,Array{VariableRef,2}}, ::Array{Float64,2})

```

If I comment the line `JuMP.set_start_value(...,...) `, then the code runs without any problem. I have tried the code with other solvers such as `Mosek` etc, but it is the same error.

Any help or suggestions will be much appreciated!

Best Regards,  
Shuvo

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [January 19, 2021, 5:41pm UTC](https://discourse.julialang.org/t/warm-starting-set-start-value-function-does-not-work-in-jump/53620/2 "2021-01-19T17:41:13Z")

</div>

Try broadcasting it with `JuMP.set_start_value.(X_tl, X_prev)` (note the added `.` at the end of the function name to broadcast the call to every element).

---

<div class="post-metadata">

**Author:** ![Shuvomoy\_Das\_Gupta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuvomoy_das_gupta/32/10069_2.png) [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Post date:** [January 19, 2021, 5:59pm UTC](https://discourse.julialang.org/t/warm-starting-set-start-value-function-does-not-work-in-jump/53620/3 "2021-01-19T17:59:27Z")

</div>

Yes, that solved it, thank you so much!
