小编Dan*_*Dan的帖子

使用MOSEK进行CVXOPT输出抑制

我正在使用可选的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抱歉,我无法包含更多特定标签(我不允许创建新标签).

python mathematical-optimization mosek

9
推荐指数
1
解决办法
4226
查看次数

JADE无法找到代理商

我是JADE的新手,在加载代理时遇到了一些麻烦.

我创建了一个新的IntelliJ项目并在"Dependencies"中添加了"jade.jar"和"commons-codec-1.3.jar"(我使用的是JADE 4.1.1)并勾选了导出框(我也试过没有它们打勾).然后我将示例中的"HelloWorldAgent.java"添加到src中.我将运行配置设置为:

  • 主要类:jade.Boot
  • 程序参数:-gui testAgent:HelloWorldAgent
  • 使用模块的类路径:jadeCW(我的项目名称)

当我使用这个配置运行时,JADE的人确实启动但它找不到"HelloWorldAgent".输出是:

14-Feb-2012 21:43:08 jade.core.Runtime beginContainer
INFO: ----------------------------------
    This is JADE 4.1.1 - revision 6532 of 2011/11/18 16:21:34
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
----------------------------------------
Retrieving CommandDispatcher for platform null
14-Feb-2012 21:43:08 jade.imtp.leap.LEAPIMTPManager initialize
INFO: Listening for intra-platform commands on address:
- jicp://192.168.1.66:1099

14-Feb-2012 21:43:08 jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
14-Feb-2012 21:43:08 jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
14-Feb-2012 21:43:08 jade.core.BaseService init
INFO: Service jade.core.resource.ResourceManagement initialized
14-Feb-2012 21:43:08 jade.core.BaseService init …
Run Code Online (Sandbox Code Playgroud)

java agents-jade

6
推荐指数
2
解决办法
7024
查看次数

Python numpy添加错误

我在python中使用基本的快捷方法得到一个非常奇怪的错误.似乎,除非我非常愚蠢,否则我得到A = A + B和A + = B的不同值.这是我的代码:

def variance(phi,sigma,numberOfIterations):
    variance = sigma
    for k in range(1,numberOfIterations):
        phik = np.linalg.matrix_power(phi,k)
        variance = variance + phik*sigma*phik.T
    return variance
Run Code Online (Sandbox Code Playgroud)

这基本上只计算向量自回归的协方差.因此对于:

phi    = np.matrix('0.7 0.2 -0.1; 0.001 0.8 0.1; 0.001 0.002 0.9')
sigma  = np.matrix('0.07 0.01 0.001; 0.01 0.05 0.004; 0.001 0.004 0.01')
Run Code Online (Sandbox Code Playgroud)

我明白了:

variance(phi,sigma,10) = 
[[ 0.1825225   0.07054728  0.00430524]
 [ 0.07054728  0.14837229  0.02659357]
 [ 0.00430524  0.02659357  0.04657858]]
Run Code Online (Sandbox Code Playgroud)

这是正确的我相信(与Matlab一致).现在,如果我将上面的行更改为

variance += phik*sigma*(phik.T)
Run Code Online (Sandbox Code Playgroud)

我明白了:

variance(phi,sigma,10) =
[[ 0.34537165  0.20258329  0.04365378]
 [ 0.20258329  0.33471052  0.1529369 …
Run Code Online (Sandbox Code Playgroud)

python numpy

6
推荐指数
1
解决办法
219
查看次数