cvxpy中的mosek参数设置

mosek parameter settings in cvxpy

我正在尝试设置 "mosek_param" 设置,但是出现错误。例如,对于以下情况

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

来自 https://docs.mosek.com/9.0/toolbox/parameters.html --> 我试过了

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

但是,运行 出现错误....注释部分有效。

当我在 Matlab 工作时 --> 使用

cvx_solver_settings('MSK_IPAR_INTPNT_SOLVE_FORM','MSK_SOLVE_PRIMAL')

对我来说效果很好。但是,在目前的情况下不起作用。另外,我能够按如下方式设置精度

cvx_precision low

但是,现在不能这样做。在 cvxpy 中是否有另一种方法来完成这两项操作?谢谢。

PS: 这个问题也已经在 CVXPY 论坛上发过了 --> https://groups.google.com/forum/#!topic/cvxpy/MEAewGMlqjI


下面是一个例子

# 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)

这给了我 error。我也尝试使用 'MSK_IPAR_INTPNT_SOLVE_FORM' = 'MSK_SOLVE_PRIMAL' 但无济于事。

看看

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

正确的形式是

mosek.solveform.primal