I am solving non-convex continuous-variable quadratic problem by Cplex on python. I want to add initial points to the problem to warm start the optimizer. Would you please help me how to warm-start the problem?
import numpy as np
Sigma = np.array([[1.64376756, 0.7943303 , 0. , 0. , 0.86711768,
0.48220733],
[0.7943303 , 1.64376756, 0. , 0.73540312, 0. ,
0.7844131 ],
[0. , 0. , 1.64376756, 0.58192547, 0.28885922,
0.34554198],
[0. , 0.73540312, 0.58192547, 1.64376756, 0.81631243,
0. ],
[0.86711768, 0. , 0.28885922, 0.81631243, 1.64376756,
0. ],
[0.48220733, 0.7844131 , 0.34554198, 0. , 0. ,
1.64376756]])
Mu = np.array([[2.14365531, 2.31414651, 1.21632667, 2.13364102, 1.97228933,
1.61216241]])
from docplex.mp.model import Model
mdl = Model(name='buses')
x = [mdl.continuous_var(0,1,"x%s" % i) for i in range(len(Sigma))]
objective = mdl.sum([Mu[0][i] * x[i] for i in range(len(Sigma))])
objective -= 2 * mdl.sum(
[Sigma[i, j] * x[i] * x[j] for i in range(len(Sigma)) for j in range(len(Sigma))]
)
mdl.maximize(objective)
mdl.parameters.qpmethod(3)
mdl.parameters.optimalitytarget.set(3)
mdl.parameters.advance(1)
sol=mdl.solve(log_output=True)
for v in mdl.iter_continuous_vars():
print(v," = ",v.solution_value)
The log output is:
Version identifier: 22.1.1.0 | 2022-11-28 | 9160aff4d
CPXPARAM_Read_DataCheck 1
CPXPARAM_QPMethod 3
CPXPARAM_OptimalityTarget 3
Warning: global optimality target changes problem type to MIQP.
Found incumbent of value 0.000000 after 0.00 sec. (0.00 ticks)
Tried aggregator 2 times.
MIQP Presolve added 0 rows and 6 columns.
Aggregator did 1 substitutions.
Reduced MIQP has 5 rows, 12 columns, and 22 nonzeros.
Reduced MIQP has 0 binaries, 0 generals, 0 SOSs, and 0 indicators.
Reduced MIQP objective Q matrix has 6 nonzeros.
Presolve time = 0.00 sec. (0.02 ticks)
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 8 threads.
Root relaxation solution time = 0.00 sec. (0.08 ticks)
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap
* 0 0 integral 0 0.7813 0.7813 9 0.00%
0 0 cutoff 0.7813 0.7813 9 0.00%
Elapsed time = 0.01 sec. (0.14 ticks, tree = 0.01 MB, solutions = 1)
Root node processing (before b&c):
Real time = 0.01 sec. (0.14 ticks)
Parallel b&c, 8 threads:
Real time = 0.02 sec. (0.01 ticks)
Sync time (average) = 0.00 sec.
Wait time (average) = 0.00 sec.
------------
Total (root+branch&cut) = 0.03 sec. (0.14 ticks)
x0 = 0.27665954428146156
x1 = 0.012015928776195062
x2 = 0.046643070773653816
x3 = 0.3026163337875378
x4 = 0
x5 = 0.1484946882416252
------------------------------
Shadi Beheshti
------------------------------