New answers tagged


You can probably also do this with scipy but there is a specific convex optimiser cvxopt that suits this problem. from cvxopt import solvers, matrix For your problem suppose you seek $N$ variables $w$, then let $x$ be a vector where the first $N$ elements are $w$ and the latter $N$ elements are slack variables $t$. i.e. $x=[w,t]^T$ For your problem $P = \...


Your problem formulation is wrong, you must use the Charnes and Cooper transformation. This means that your constraint (mu-mu0)@y==1 must be (mu-mu0)@y==k and w=y/k, which implies that k==cp.sum(y).

Top 50 recent answers are included