Skip to content

Instantly share code, notes, and snippets.

@SteveDiamond
Created April 5, 2016 03:42
Show Gist options
  • Save SteveDiamond/22c0609e7e37281956afa269153896f5 to your computer and use it in GitHub Desktop.
Save SteveDiamond/22c0609e7e37281956afa269153896f5 to your computer and use it in GitHub Desktop.
epsilon bug?
import numpy as np
import cvxpy as cp
import epopt as ep
# Form lasso problem with CVXPY
m = 500
n = 2000
lam = 1
np.random.seed(1)
A = np.random.randn(m,n)
b = np.random.randn(m)
x = cp.Variable(n)
f = cp.norm2(A*x - b) + lam*cp.norm1(x)
prob = cp.Problem(cp.Minimize(f), [x + 1 >= 0])
prob.solve(solver=cp.SCS, verbose=True)
print prob.value
prob.solve(solver=cp.ECOS, verbose=True)
print prob.value
# Solve with Epsilon
ep.solve(prob, verbose=True)
# Print solution value
print
print "solution:"
# print x.value
print f.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment