Created
April 5, 2016 03:42
-
-
Save SteveDiamond/22c0609e7e37281956afa269153896f5 to your computer and use it in GitHub Desktop.
epsilon bug?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "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