使用MOSEK进行CVXOPT输出抑制

Dan*_*Dan 9 python mathematical-optimization mosek

我正在使用可选的MOSEK求解器和CVXOPT二次规划,即

sol = cvxopt.solvers.qp(-Q,-p,G,h,A,b,solver='mosek')
Run Code Online (Sandbox Code Playgroud)

现在不使用MOSEK求解器,即

sol = cvxopt.solvers.qp(-Q,-p,G,h,A,b)
Run Code Online (Sandbox Code Playgroud)

使用该命令可以抑制CVXOPT生成的终端输出

cvxopt.solvers.options['show_progress'] = False
Run Code Online (Sandbox Code Playgroud)

但是,使用MOSEK求解器选项时,这不起作用.我在几个循环中的MOSEK求解器产生了很多我不感兴趣的输出,这意味着我看不到我感兴趣的输出(即我选择使用'print'输出的内容).

有谁知道是否有可能抑制MOSEK输出?或者如果没有,潜在的解决方法(将输出传输到文件或其他东西)?

非常感谢!

ps抱歉,我无法包含更多特定标签(我不允许创建新标签).

小智 0

这个问题应该在 CVXOPT google-group 上提出(链接自 CVXOPT 主页):

http://groups.google.com/forum/?fromgroups#!forum/cvxopt

无论如何,从文档字符串来看:

>>> help(cvxopt.msk.qp)
.
.
   Options are passed to MOSEK solvers via the msk.options dictionary, 
    e.g., the following turns off output from the MOSEK solvers

        >>> msk.options = {mosek.iparam.log: 0} 

    see chapter 15 of the MOSEK Python API manual.
Run Code Online (Sandbox Code Playgroud)