qcqp.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:qcqp 作者: cvxgrp 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号