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

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.

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

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

2 Likes

Start values are documented here: Variables · JuMP