PolyJuMP.jl icon indicating copy to clipboard operation
PolyJuMP.jl copied to clipboard

Support setting starting values

Open PaioPaio opened this issue 2 years ago • 5 comments

Hello :)

I've seen this old thread on discourse https://discourse.julialang.org/t/warm-start-mosek-in-a-linear-polynomial-optimization-problem/90478 and since there wasn't an open issue I obliged. I'm planning to translate a bit of MATLAB code which I've written using SOSTOOLS to Julia using SumOfSquares.jl. In particular the code uses an iterative algorithm to approximate the RAS of a non-linear system. It would be nice to be able to warm start the SOS optimization at each iteration using the polynomial obtained from the previous step.

PaioPaio avatar Oct 11 '23 12:10 PaioPaio

Sure, let's do it then :) Note that Mosek does not support starting values. SCS/COSMO do support it though

blegat avatar Oct 11 '23 15:10 blegat

Is this still broken? For the QCQP this can be quite important too -- along with propagating the start values of monomials to the lifted variables.

votroto avatar Mar 14 '24 16:03 votroto

It's not the same as QCQP, it should work for QCQP after https://github.com/jump-dev/PolyJuMP.jl/pull/115

blegat avatar Mar 21 '24 08:03 blegat

Are you sure? Compare Gurobi's output on the projection done by hand

using JuMP, PolyJuMP, Gurobi

m = Model(Gurobi.Optimizer)
@variable(m, x >= 0, start=1/sqrt(3))
@variable(m, y >= 0, start=1-start_value(x))
@variable(m, xx, start=start_value(x)*start_value(x))

@constraint(m, xx == x*x)
@constraint(m, x + y == 1)

@objective(m, Min, xx*x + y)
optimize!(m)

versus the current implementation

m = Model(() -> PolyJuMP.QCQP.Optimizer(Gurobi.Optimizer()))
@variable(m, x >= 0, start=1/sqrt(3))
@variable(m, y >= 0, start=1-start_value(x))

@constraint(m, x + y == 1)

@objective(m, Min, x*x*x + y)
optimize!(m)

The first one explicitly writes Loaded user MIP start with objective 0.6151 , while the second one does not.

I believe it would be necessary to track the variables in the QCQP.Optimizer though, as the variables get copied to the model after final_touch. That might not be the worst thing, maybe the polyvar/moivar maps should be kept in the optimizer too, instead of the ScalarPolynomialFunction objects.

votroto avatar Mar 22 '24 13:03 votroto

@votroto https://github.com/jump-dev/PolyJuMP.jl/pull/119 should fix this

blegat avatar Mar 25 '24 16:03 blegat