我正在尝试设置“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)
这给了我错误。我也尝试使用 'MSK_IPAR_INTPNT_SOLVE_FORM' = 'MSK_SOLVE_PRIMAL' 但无济于事。