All problems
ADMM Residual Norms
Problem
Compute the primal and dual residuals of an ADMM step.
Return [primal, dual] where primal = ||x - z|| and dual = rho * ||z - z_prev||. These are the standard quantities compared against tolerances for stopping.
Hint
The dual residual measures how much z changed from the previous iteration.
Test cases
case 1
in: [[1,2],[0.5,1.5],[0,1],1]
expected: [0.7071067811865476,0.7071067811865476]
case 2
in: [[0,0,0],[0,0,0],[0,0,0],2]
expected: [0,0]
case 3
in: [[1,-1],[1,-1],[0.5,-0.5],0.5]
expected: [0,0.3535533905932738]
Starter codePython
def admm_residual_norms(x, z, z_prev, rho):
# Returns [primal, dual]
# Your code here
pass3 test cases · run your code against them in the editor