cvxpycvx

mosek parameter settings in cvxpy


I am trying to set "mosek_param" settings, but, am getting errors. For instance, for the following case

MSK_IPAR_INTPNT_SOLVE_FORM

Controls whether the primal or the dual problem is solved.
Default:
  "FREE"
Accepted:
  "FREE", "PRIMAL", "DUAL"
Example:
  param.MSK_IPAR_INTPNT_SOLVE_FORM = 'MSK_SOLVE_FREE'
Groups:
  Interior-point method

from https://docs.mosek.com/9.0/toolbox/parameters.html --> I tried

prob.solve(solver=MOSEK,
mosek_params={mosek.iparam.intpnt_solve_form: mosek.solve.primal},     # mosek.iparam.presolve_use:mosek.presolvemode.off
verbose=True)

but, run into errors .... the commented part works.

When I was working in Matlab --> using

cvx_solver_settings('MSK_IPAR_INTPNT_SOLVE_FORM','MSK_SOLVE_PRIMAL')

worked well for me. But, doesn't work in the present case. Also, I was able to set precision as follows

cvx_precision low

but, cannot do so now. Is there another way to do both of these in cvxpy? thank you.

PS: this question has also been posted in the CVXPY forum --> https://groups.google.com/forum/#!topic/cvxpy/MEAewGMlqjI


Below is an example

# Solves a bounded least-squares problem.

import mosek
from cvxpy import *
import numpy

# Problem data.
m = 10
n = 5
numpy.random.seed(1)
A = numpy.random.randn(m, n)
b = numpy.random.randn(m)

# Construct the problem
x = Variable(n)
objective = Minimize(sum_squares(A*x - b))
constraints = [0 <= x, x <= 1]
prob = Problem(objective, constraints)

prob.solve(solver=MOSEK,
mosek_params={mosek.iparam.intpnt_solve_form: mosek.solve.primal},     # mosek.iparam.presolve_use:mosek.presolvemode.off
verbose=True)

which gives me the error. I also tried using 'MSK_IPAR_INTPNT_SOLVE_FORM' = 'MSK_SOLVE_PRIMAL' but to no avail.


Solution

  • Look at

    https://docs.mosek.com/9.1/pythonapi/parameters.html#mosek.iparam.intpnt_solve_form

    The correct form is

    mosek.solveform.primal