예제 #1
0
 def graph_implementation(var_args, size):
     A = var_args[0]
     n,m = A.size
     # Requires that A is symmetric.
     obj,constr = transpose.graph_implementation([A], (m,n))
     constr += [AffEqConstraint(obj, A)]
     t = Variable(*size).canonical_form()[0]
     I = Constant(np.eye(n,m)).canonical_form()[0]
     return (t, [SDP(A - I*t)] + constr)
예제 #2
0
파일: norm_nuc.py 프로젝트: Russell91/cvxpy
 def graph_implementation(var_args, size):
     A = var_args[0] # m by n matrix.
     n,m = A.size
     # Create the equivalent problem:
     #   minimize (trace(U) + trace(V))/2
     #   subject to:
     #            [U A; A.T V] is positive semidefinite
     X = Variable(n+m, n+m)
     # Expand A.T.
     obj,constr = transpose.graph_implementation([A], (m,n))
     # Fix X using the fact that A must be affine by the DCP rules.
     constr += [AffEqConstraint(X[0:n,n:n+m], A),
                     AffEqConstraint(X[n:n+m,0:n], obj)]
     trace = 0.5*sum([X[i,i] for i in range(n+m)])
     # Add SDP constraint.
     return (trace, [SDP(X)] + constr)
예제 #3
0
 def graph_implementation(var_args, size):
     A = var_args[0] # m by n matrix.
     n,m = A.size
     # Create a matrix with Schur complement I*t - (1/t)*A.T*A.
     X = Variable(n+m, n+m)
     t = Variable().canonical_form()[0]
     I_n = Constant(np.eye(n)).canonical_form()[0]
     I_m = Constant(np.eye(m)).canonical_form()[0]
     # Expand A.T.
     obj,constr = transpose.graph_implementation([A], (m,n))
     # Fix X using the fact that A must be affine by the DCP rules.
     constr += [AffEqConstraint(X[0:n,0:n], I_n*t),
                AffEqConstraint(X[0:n,n:n+m], A),
                AffEqConstraint(X[n:n+m,0:n], obj),
                AffEqConstraint(X[n:n+m,n:n+m], I_m*t),
     ]
     # Add SDP constraint.
     return (t, [SDP(X)] + constr)