All problems
ADMM One Step 1D
Problem
Perform one ADMM iteration minimizing 0.5 * (x - a_val) ** 2 + lam * abs(z) subject to x - z = 0, with scaled dual u and penalty rho.
Set x to (a_val + rho * (z - u)) / (1 + rho), set z by soft-thresholding x + u at lam / rho, then set u = u + x - z. Return [x, z, u].
Hint
The z update is soft thresholding of x + u at lam / rho.
Test cases
case 1
in: [0,0,0,3,0.5,1]
expected: [1.5,1,0.5]
case 2
in: [1,0,0,2,0.1,2]
expected: [0.6666666666666666,0.6166666666666666,0.050000000000000044]
case 3
in: [0,0.5,0.2,-1,1,0.5]
expected: [-0.5666666666666667,0,-0.36666666666666664]
Starter codePython
def admm_step(x, z, u, a_val, lam, rho):
# Returns [x, z, u]
# Your code here
pass3 test cases · run your code against them in the editor