0

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!

pqrz
  • 133
  • 5
  • 1
    As far as I can see from the code there is no such facility in the Mosek interface to CVXPY. – Michal Adamaszek May 07 '21 at 13:51
  • Ok, expected it to be as a mosek solver option in cvxpy – pqrz May 07 '21 at 15:22
  • Is this supported in any other framework, like Pyomo, JuMP? – pqrz May 07 '21 at 15:23
  • 1
    In Mosek warmstart is only possible if you use the simplex optimizer independent of the interface. – ErlingMOSEK May 18 '21 at 09:15
  • I guess Simplex optimizer only works for LP problem? Reference: https://docs.mosek.com/9.2/cxxfusion/cont-optimizers.html – pqrz May 20 '21 at 08:17
  • Does this mean: no warmstart support for all other problem type: MILP, QP, MIQP, QCQP, MIQCQP, SOCP, MISOCP ? – pqrz May 20 '21 at 08:17
  • 1
    @pqrz The mixed integer optimizer will always consume an initial point regardless of problem type https://docs.mosek.com/9.2/pythonapi/tutorial-mio-shared.html#specifying-an-initial-solution For continuous problems only LP simplex. – Michal Adamaszek May 21 '21 at 10:41
  • Thanks Michal, the solver option: [MSK_IPAR_MIO_CONSTRUCT_SOL](https://docs.mosek.com/6.0/toolbox/node021.html#common-const*mosek*iparam*mio-construct-sol) seems to exactly satisfy our requirement, is this depreciated / any alternative? – pqrz May 21 '21 at 11:11
  • 1
    @pqrz The parameter is gone, Mosek 9 does it by default. – Michal Adamaszek May 21 '21 at 11:39
  • Oh, mistakened it for solution insertion parameter. Sorry for the confusion. – pqrz May 21 '21 at 11:54
  • We know that mosek's python API have [putsolution](https://docs.mosek.com/9.2/pythonapi/optimizer-task.html#mosek.task.putsolution) to insert a solution explicitly, do we also have a solver option to achieve that? – pqrz May 21 '21 at 11:54

1 Answers1

1

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.

  • could you confirm initialization works for other problem types other then LP? – pqrz May 21 '21 at 07:34
  • 1
    Pyomo should let you initialize the variable values in all problem types. BUT, the initialization only impacts MOSEK when you are solving LPs with the simplex optimizer, or when solving mixed-integer variants of LPs or SOCPs. This is because only the simplex and the mixed-integer optimizer benefit from warm-start. – Utkarsh Detha May 25 '21 at 10:28