A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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 = \...

Only top voted, non community-wiki answers of a minimum length are eligible