def admm_phase1(x0, prob, tol=1e-2, num_iters=1000):
logging.info("Starting ADMM phase 1 with tol %.3f", tol)
z = np.copy(x0)
xs = [np.copy(x0) for i in range(prob.m)]
us = [np.zeros(prob.n) for i in range(prob.m)]
for t in range(num_iters):
if max(prob.violations(z)) < tol:
break
z = (sum(xs)-sum(us))/prob.m
for i in range(prob.m):
x, u, f = xs[i], us[i], prob.fi(i)
xs[i] = onecons_qcqp(z + u, f)
for i in range(prob.m):
us[i] += z - xs[i]
return z
评论列表
文章目录