1

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.

  • What exactly errors did you run into when you tried it in cvxpy? Please post the whole error message. How can anyone help without knowing what the error was? – Michal Adamaszek Nov 14 '19 at 07:20
  • Regarding precision, you would have to set the parameters mentioned here https://docs.mosek.com/9.1/pythonapi/solving-conic.html#adjusting-optimality-criteria – Michal Adamaszek Nov 14 '19 at 07:24
  • @MichalAdamaszek I just added an example along with the error message I get. – user11726509 Nov 14 '19 at 15:07

1 Answers1

1

Look at

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

The correct form is

mosek.solveform.primal

  • Thank you for your help! can you pls tell me how the tolerance precision in https://docs.mosek.com/9.1/pythonapi/solving-conic.html#adjusting-optimality-criteria relates to various `cvx precision` tolerances in http://cvxr.com/cvx/doc/solver.html#interpreting? In particular, I would like to know which params I could set to achieve the scenario of `cvx_precision low` – user11726509 Nov 21 '19 at 20:00
  • @user11726509 In most cases you have to relax all parameters mentioned in the table simultaneously. The question is why you would want to do it? – Michal Adamaszek Nov 21 '19 at 21:07
  • i would like to avoid tuning each of those (4) tolerances: ε_p, ε_d, ε_g, ε_i thus, I was looking for an equivalent of cvx_precision low that adjusts the (3) tolerances--ϵ_solver,ϵ_standard,ϵ_reduced--each of which are defined in terms of Matlab's machine precision: ϵ. However, I am not sure how these (3) tolerances translate in terms of mosek's (4) tolerances:? Thus, I was looking at the documentation of cvx_precision here: https://github.com/cvxr/CVX/blob/master/commands/cvx_precision.m but, didn't really see the connection. Any assistance towards this would be much appreciated. – user11726509 Nov 21 '19 at 21:48
  • using `cvx_precision low` worked well for me when i was working on the Matlab end. – user11726509 Nov 21 '19 at 21:49
  • @user11726509 You would have to look into cvx code and see exactly what it does when precision is set to low. Surely it can be reverse engineered to see what parameters are set. – Michal Adamaszek Nov 21 '19 at 22:06
  • @MichalAdamaszek Hi, it's me again :) When setting `prob.solve(solver=cp.MOSEK, mosek_params={'MSK_DPAR_INTPNT_CO_TOL_REL_GAP': 1e-4}, verbose=True)`, it just igonres that parameter. Same thing happens with Gurobi and ECOS. Why doesn't cvxpy take these arguments correclty? – iarbel84 Jan 08 '21 at 20:51