问题标签 [cvxopt]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 如何在 Python 中安装 CVX,以及在 Windows 64 位中安装 chompack?
谁能给我下载链接以在 Phyton 中安装 CVX 以及 chompack 的链接?我尝试了几个版本,但始终无法安装 chompack。我在安装 chompack 时收到类似“构建轮 CVXOPT 失败”的错误消息。但在安装 cvxopt 时没有错误消息。我的机器windows 64位。
python-2.7 - chompack 不适合 windows 64 位机器吗?
我已经安装了 python、cython、cvxopt 但未能安装 chompack。错误消息是 Cython 似乎没有安装。但是 Cython 停滞不前,因为当我尝试安装它时说要求已经满足。有什么建议吗?我的机器是windows 64位。
python - 无尽的过程
我开始运行此代码,但没有完成。PS。Python 2.7 JupyterNotebook
python - 使用二次规划和凸求解器的 Markowitz 投资组合优化
我正在使用从 quantopian 博客中提取的 python 代码来找到优化的投资组合。
我已经完成了这里详述的整个练习:https ://blog.quantopian.com/markowitz-portfolio-optimization-2/
在optimal_portfolio函数中的最后一个方程之前,一切都像一个魅力:
wt = solvers.qp(opt.matrix(x1 * S), -pbar, G, h, A, b)['x']
我得到一个超级混乱的错误:
C:\Software\Anaconda2\envs\gl-env\lib\site-packages\cvxopt-1.1.8-py2.7-win-amd64.egg\cvxopt\coneprog.pyqp(P, q, G, h, A, b, solver, initvals, **kwargs)
4466 'residual as dual infeasibility certificate': dinfres}
4467
-> 4468 return coneqp(P, q, G, h, None, A, b, initvals, options = options)
C:\Software\Anaconda2\envs\gl-env\lib\site-packages\cvxopt-1.1.8-py2.7-win-amd64.egg\cvxopt\coneprog.pyconeqp(P, q, G, h, dims, A, b, initvals, kktsolver, xnewcopy, xdot, xaxpy, xscal, ynewcopy, ydot, yaxpy, yscal, **kwargs)
2241 # lmbdasq = lambda o lambda.
2242
-> 2243 if iters == 0: W = misc.compute_scaling(s, z, lmbda, dims)
2244 misc.ssqr(lmbdasq, lmbda, dims)
2245
C:\Software\Anaconda2\envs\gl-env\lib\site-packages\cvxopt-1.1.8-py2.7-win-amd64.egg\cvxopt\misc.pycompute_scaling(s, z, lmbda, dims, mnl)
283
284 m = dims['l']
--> 285 W['d'] = base.sqrt( base.div( s[mnl:mnl+m], z[mnl:mnl+m] ))
286 W['di'] = W['d']**-1
287 lmbda[mnl:mnl+m] = base.sqrt( base.mul( s[mnl:mnl+m], z[mnl:mnl+m] ) )
ValueError:域错误
看来我可能正在尝试采用负数的 sqrt。关于如何解决这个问题的任何想法?
python - 使用 CVXOPT 进行 Python 二次规划
我正在寻找关于制定具有二次约束的 CVXOPT 二次规划问题的权威指南。这里提供了很好的文件:
我正在处理的问题陈述与这里的问题相同:
矩阵G应该是什么样的?我已经制定了一个线性方程组,但是看看例子这似乎不正确?
我找到的最好的资源是https://courses.csail.mit.edu/6.867/wiki/images/a/a7/Qp-cvxopt.pdf,但最后的链接已经死了,无法阅读。
我有一个 ipython 笔记本试图使用这种编程方法,但它不断失败:https ://gist.github.com/jaredvacanti/62010beda0ccfc20d2eac3c900858e50
编辑:我已经编辑了笔记本中的数据源文件,以提供对该优化问题中使用的真实数据的访问。
python - Why does CVXOPT give a rank error for this nonlinear network flow optimisation?
I'm considering using cvxopt to solve some nonlinear network flow optimisation problems. In order to understand the basics, I am trying it with a very simple test network with just 4 vertices and 5 edges.
My network looks like this. The blue and red nodes are a source and sink respectively.
The cost on each edge is:
where x is the vector containing the flow on each edge, and alpha is some coefficient. My optimisation problem is then:
where E is the edge-arc incidence matrix and b is the vector containing sources and sinks. The matrix-vector equation Ex = b should therefore just enforce Kirchoff's laws (i.e. conservation of flow at each node).
My python script to do this is:
The error I get is:
I am unsure how to proceed from here. I assumed this optimisation problem would be soluble with cvxopt, since it is simple enough to find the optimal flow by hand. I would appreciate it if somebody could tell me how to rectify this code, or else tell me why this type of problem is not suitable for this software.
Thanks in advance.
python-2.7 - 将mpmath的mpf转换为python float以支持cvxopt
我正在使用二次规划问题研究 CVXOPT。要创建 G 矩阵,我需要对方程进行微分并计算值。对于微分,我使用了 Sympy.mpmath 和 lambda 函数,如下所示。我得到了 mpf 格式的输出。请建议我一种将 mpf 转换为支持 CVXOPT 的 python 浮点格式的方法。谢谢
mathematical-optimization - 用于凸优化的 CVXOPT 不收敛
我正在尝试解决以下形式的非线性凸优化问题,并c'x + f(x)
受到一些仿射约束。在此之前,我想确保我可以在没有f(x)
. 由于我有问题的分析一阶和二阶导数,我想用它们来获得更快的结果。我正在尝试使用 cvxopt 来解决问题。我为这个问题编写了以下代码。
但我无法使用 cvxopt 实现此问题的最佳解决方案。如果我使用 cvxopt 的建模功能,我可以轻松解决它。但不幸的是,我不确定我是否可以使用它提供分析一阶和二阶导数。
这是问题的代码
我可能在这段代码中犯了一些错误。任何帮助或指导将不胜感激。
python - 投资组合优化:如何使用 cvxopt.solver.qp 在承受目标风险的同时最大化回报?
尝试在这里优化投资组合权重分配,通过使用 cvxopt 模块限制风险来最大化我的回报函数。我的代码如下:
我应该使用蒙特卡洛模拟来获得目标风险同时最大化回报吗?解决这个问题的最佳方法是什么?谢谢你。
python - 在 cvxopt 中显示最优解
有没有办法只显示cvxopt中的最佳值而不显示迭代值,例如 pcost、dcost、gap 等,如下例所示,
输出:
我只想打印输出的最后 5 个值。