Initialize a nonlinear model


#1

Hi folks,

In GAMS, we can initialize a nonlinear model by setting variable.l = initial_value. I’m wondering how this can be done in JuMP, i.e., how can we initialize the primal variables of a JuMP model before we use the nonlinear solvers to solve it? I don’t mean to initialize the same model with its previous solutions. I mean if we have the flexibility to initialize any single variable.
Does that depend on the solvers we use? If it does depend on solvers, does anyone know how to do it for Ipopt and Mosek?

Thanks a lot!

Best regards,
Can


#2

You can use setvalue:

m = Model()
@variable(m, x)
setvalue(x, 1.23)

#3

Thanks! I find this works for Ipopt.

I’m also using Mosek to solve general convex optimization problems. I find that the initial value of Mosek is not affected by the setvalue. It seems that it can be set by the option MSK_DPAR_INTPNT_TOL_PSAFE
https://docs.mosek.com/7.0/capi/MSK_DPAR_INTPNT_TOL_PSAFE.html
This option will set all the variables to the same value. Does anyone know how to set each variable to a different value in Mosek.

Or is there any solver in JuMP that is robust in solving general convex problems and allow warmstart for each variable? The reason I’m using Mosek is that I find that Ipopt is not very robust in solving convex problems. It sometimes converges to an infeasible point when the problem is convex and feasible.

Thanks!

Best,
Can