Your question has a two-part answer: how JuMP handles successive solves, and how the solvers handle successive solves.
How JuMP handles successive solves
Recall that JuMP is a modeling layer, not an optimization solver.
Therefore, when you build a problem in JuMP and then call optimize!(model)
, what JuMP does is it passes the model to the underlying solver, then calls that solver's API to solve the model and retrieve the solution.
Thus, let's assume a workflow like build the model, solve, get the solution, add one or more constraints, solve again, get the solution add one or more constraints, solve again, get the solution, add one or more constraints, etc.
What happens under the hood is the following:
- build the model
- call solver XXXX API to pass the model and solve it
- call solver XXXX API to retrieve the solution
- call solver XXXX API to add one or more constraints
- call solver XXXX API to solve the model
- call solver XXXX API to retrieve the solution
- etc...
There is nothing in JuMP's optimize!
function that does something specific in the case where "I have just solved a very similar version of the problem": this is handled by the solver.
Side note: by default, JuMP caches the model in JuMP-owned data structures before passing it to the solver when the user calls optimize!
, which may prevent incremental solves. To bypass this and hook into the solver's API directly, use direct mode. (if you have more questions on this, I would recommend you ask them on the Julia discourse forum as linked by odow)
How solvers handle successive solves
TLDR: it's solver-dependent. Some are able to re-use previous information, some aren't.
In the case of Mosek and nonlinear problems: Mosek will solve nonlinear conic problems with its interior-point algorithm.
This algorithm is not able to warm-start, and as far as I know, Mosek's API does not permit to pass a warm-start solution anyway. They may do something smart internally, but it's not documented and the user probably has no control over it.
This is a limitation of interior-point algorithms, not Mosek as a software.
An alternative is to use a first-order solver such as SCS or COSMO (see the supported solvers in JuMP), which support warm-starts. However, they are first-order methods and may not give you the same precision as interior-point solvers.