cvxopt

scipy sparse matrix to cvxopt spmatrix?

佐手、 提交于 2020-01-23 06:32:49
问题 I need to convert a scipy sparse matrix to cvxopt's sparse matrix format, spmatrix, and haven't come across anything yet (the matrix is too big to be converted to dense, of course). Any ideas how to do this? 回答1: The more robust answer is a combination of hpaulj's answer and OferHelman's answer. def scipy_sparse_to_spmatrix(A): coo = A.tocoo() SP = spmatrix(coo.data.tolist(), coo.row.tolist(), coo.col.tolist(), size=A.shape) return SP Defining the shape variable preserves the dimensionality

scipy sparse matrix to cvxopt spmatrix?

。_饼干妹妹 提交于 2020-01-23 06:31:25
问题 I need to convert a scipy sparse matrix to cvxopt's sparse matrix format, spmatrix, and haven't come across anything yet (the matrix is too big to be converted to dense, of course). Any ideas how to do this? 回答1: The more robust answer is a combination of hpaulj's answer and OferHelman's answer. def scipy_sparse_to_spmatrix(A): coo = A.tocoo() SP = spmatrix(coo.data.tolist(), coo.row.tolist(), coo.col.tolist(), size=A.shape) return SP Defining the shape variable preserves the dimensionality

How to install cvxopt for Python 3.5 on Windows 7

岁酱吖の 提交于 2020-01-03 15:36:13
问题 I recently updated to python 3.5.0 and want to install cvxopt, so far without luck. So I tried python 2.7 and following the instructions here i installed mingw (4.9.3) and built blas and lapack from source without issue. When I run python setup.py build --compiler=mingw32 I get the following output: running build running build_py running build_ext building 'base' extension C:\minGW\bin\gcc.exe -mdll -O -Wall -IC:\Python27\include -IC:\Python27\ c/C/base.c -o build\temp.win32-2.7\Release\src\c

How to install CVXOPT with Enthought python (Canopy)

a 夏天 提交于 2020-01-01 12:06:27
问题 Before I start, let me put alternative titles for this post: How to compile CVXOPT with Intel MKL ? How to change __init__.py in CVXOPT to compile with Intel MKL ? Let me explain the issue. I am trying to install pystruct with Enthought python because Enthought python provides significant speed up in comparison to python in the Ubuntu package manager. The speed-up are mostly due to compiling back-end linear algebra libraries with Intel MKL libraries. I have to say that CVXOPT and pystruc

Linear Programming with cvxpy

戏子无情 提交于 2019-12-25 20:05:53
问题 I would like to ask you regarding on the Linear Program for optimization. I have an objective function, and constraint functions as below, variables(x1, x2, x3, x4, x5, x6) are quantities of the products, and the quantities of products have to be fixed numbers now. the goal of this problem is the optimizing the quantities of products. Objective Function (c.T * [x1, x2, x3, x4, x5, x6]) [[c11, c12, c13, c14, c15 c16], [c21, c22, c23, c24, c25, c26], X [x1, x2, x3, x4, x5, x6] [c31, c32, c33,

How to perform operations on cvxopt-matrices a la numpy?

♀尐吖头ヾ 提交于 2019-12-24 06:33:34
问题 I am working with cvxopt matrices in order to use them in picos library. In general I want to take a matrix, evaluate it on a certain vector, subtract something, then take the biggest absolute value of its entries import picos as pic import cvxopt as cvx import numpy as np (...) P = pic.Problem() theta = P.add_variable('theta', size=k, vtype='continuous', lower=-10, upper=10) theta P.add_constraint(max(abs(M*theta - b)) <= 5) P.minimize(theta) (Here b is some vector treated as cvxopt matrix.)

The integer linear programming(ILP) function in CVXOPT returns non integers

旧时模样 提交于 2019-12-23 03:33:02
问题 I wanted to optimize a function using ILP implementing by CVXOPT , GLPK in python. I wrote this code, but it gives me non integer solution especially 0.5. Could anyone help me? import math import numpy as np import cvxopt from cvxopt import glpk from cvxopt import matrix G = np.array([ [-1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., -1., 0., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., -1., 0., 1., -1

How to install cvxopt on on windows 10 on python 3.6

坚强是说给别人听的谎言 提交于 2019-12-20 10:45:05
问题 How do I install cvxopt on windows 10 on python 3.6? When running conda install cvxopt Fetching package metadata ........... Solving package specifications: . UnsatisfiableError: The following specifications were found to be in conflict: - cvxopt -> python 3.5* - python 3.6* Use "conda info <package>" to see the dependencies for each package. I apologize i am on windows... Any ideas? 回答1: After much trial and error, I found that we need to install both the numpy+mkl package and the

CVXPY throws SolverError

旧巷老猫 提交于 2019-12-12 18:27:36
问题 When using CVXPY, I frequently get "SolverError". Their doc just says this is caused by numerical issues, but no further information is given about how to avoid them. The following code snippet is an example, the problem is trivial, but the 'CVXOPT' solver just throws "SolverError". It is true that if we change the solver to another one, like 'ECOS', the problem will be solved as expected. But the point is, 'CVXOPT' should in principle solve this trivial problem and it really baffles me why

cvxopt installation on windows 7/64bit

自闭症网瘾萝莉.ら 提交于 2019-12-11 03:02:58
问题 I'm trying to install cvxopt package on python 3.4. I'm using pip but I get the error message "command 'c:\MinGW\bin\gcc.exe' failed with exit status 1" I tried numerous stuff like installing numpy+mkl which is not running as well I don't know why, or installing atlas but none of those helps resolve my problem so I'm stuck. Should I install atlas or something else ? Could you help me please? Thanks in advance! 来源: https://stackoverflow.com/questions/29182761/cvxopt-installation-on-windows-7