Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dict={}
- start = time.time()
- d=x.shape[1]
- N=x.shape[0]
- C=1
- #G[:N,d:d+N]=np.diag(np.diag(-1*np.ones((N,N))))
- q=C*np.ones(N+d)
- q[0:d]=0
- P=np.zeros((N+d,N+d))
- P[:d,:d]=np.diag(np.diag(np.ones((d,d))))
- h=np.zeros(2*N)
- h[:N]-=np.ones(N)
- G=np.zeros((N+N, d+N))
- G[:N,d:d+N]=np.diag(np.diag(-1*np.ones((N,N))))
- G[N:2*N,d:d+N]=np.diag(np.diag(-1*np.ones((N,N))))
- e=x.transpose()*y
- G[:N,:d]=e.transpose()
- S=qp(matrix(P), matrix(q), matrix(G), matrix(h))
- # print(S['primal objective'])
- # print(S['dual objective'])
- finish=time.time()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement