2012-06-07 139 views
8

我使用的是CVXOPT二次規劃可選MOSEK求解,即CVXOPT抑制輸出與MOSEK

sol = cvxopt.solvers.qp(-Q,-p,G,h,A,b,solver='mosek') 

現在不使用MOSEK求解,即

sol = cvxopt.solvers.qp(-Q,-p,G,h,A,b) 
通過CVXOPT產生

端子輸出可以被命令壓制

cvxopt.solvers.options['show_progress'] = False 

但是,這在使用MOSEK解算器時不起作用選項。 MOSEK求解器,我在幾個循環中產生了很多我不感興趣的輸出,這意味着我看不到我感興趣的輸出(即我選擇使用'print'輸出的輸出)。

有誰知道是否可以抑制MOSEK輸出?或者,如果沒有,潛在的解決方法(將輸出管道輸出到文件或其他東西)?

非常感謝!

P.S抱歉,我不能有更具體的標籤(我不能創建新的代碼)。

回答

0

這個問題應該在CVXOPT谷歌組(從 CVXOPT主頁鏈接)問:

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

無論如何,從DOC-字符串:

>>> 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. 
+0

謝謝。我仍然遇到麻煩(我對使用CVXOPT和MOSEK都很陌生)。我會在Google羣組中重新發布我的問題。 – Dan

+1

Stackoverflow是一個問答網站 - 這是一個完美的問題。此外,這並不真正回答這個問題,不像@ petter-nilsson的回答 – Zero

3

我不能」不知道如何通過CVXOPT傳遞這些選項,但經過一些CVXOPT源代碼的篩選後,我想出了這個解決方案:

from cvxopt import matrix, solvers 
from mosek import iparam 
solvers.options['MOSEK'] = {iparam.log: 0} 

它適用於mosek 6.

+0

這實際上適用於我;而不是{mosek.iparam.log:0}我用{iparam.log:0}。謝謝! – Arash