Initialization of decision variable's value in Mosek solver (via Cvxpy framework)

494 views Asked by At

We have a optimization problem and want to initialize its decision variable's value for fast convergence.

We are using Mosek solver (via its Cvxpy interface).

Any help appreciated, Thank you very much!

1

There are 1 answers

2
Utkarsh Detha On

Regarding your question about Pyomo in the comments: Yes, Pyomo's MOSEK interface will let you initialize the variables. The following code provides you an example of what you can do in Pyomo-MOSEK:

import mosek
import pyomo.kernel as pmo

solver = pmo.SolverFactory('mosek')

model = pmo.block()

# Integer variables with initial solution
init_sol = [1, 1, 0]
model.x = pmo.variable_list(pmo.variable(
    domain=pmo.NonNegativeIntegers, value=init_sol[i]) for i in range(3))
# Continuous variable
model.x.append(pmo.variable(domain=pmo.NonNegativeReals))

model.con_1 = pmo.constraint(sum(model.x) <= 2.5)

model.obj = pmo.objective(
    7*model.x[0] + 10*model.x[1] + model.x[2] + 5*model.x[3], sense=pmo.maximize)

# Solve "model" with warmstart set to True.
solver.solve(model, tee=True, warmstart=True)

print("Initial solution utilization = {}".format(
    solver._solver_model.getintinf(mosek.iinfitem.mio_construct_solution)))
print("Initial solution objective value = {}".format(
    solver._solver_model.getdouinf(mosek.dinfitem.mio_construct_solution_obj)))

PS: I did not have enough reputation to respond to the comment directly, hence the answer. Sorry about that.