[[
wikihub
]]
Search
⌘K
Explore
People
For Agents
Sign in
Explore
People
For Agents
Sign in
@jemoka / Jemoka Knowledge Base / raw/concept/kbhcvxpy.md
Suggest edit
Cancel
Submit suggestion
Title
Name
Note
--- title: "CVXPY" source: https://www.jemoka.com/posts/kbhcvxpy/ --- CVXPY allows us to cast convex optimization tasks into OOP code. \begin{align} \min \mid Ax - b \mid^{2}_{2} \end{align} object to: \(x \geq 0\) import cvxpy as cp A,b = ... x = cp.Variable(n) obj = cp.norm2(A@x - b)**2 constraints = [x >= 0] prob = cp.Problem(cp.Minimize(obj), constraints) prob.solve() How it works starts with the optimization problem \(P_{1}\) applies a series of problem transformation \(P_{2} … P_{N}\) final problem \(P_{N}\) should be one of Linear Program, Quadratic Program, SOCP, SDP calls a specialized solver on \(P_{N}\) retrieves the solution of the original problem by reversing transformations