Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from cvxopt import matrix, solvers
- Q=matrix([[11.4312,1.1701,0.1232,1.6619,2.0254],
- [1.1701,7.7723,0.4983,1.1374,1.7056],
- [0.1232,0.4983,5.1598,-1.3094,-0.6307],
- [1.6619,1.1374,-1.3094,20.2858,2.2824],
- [2.0254,1.7056,-0.6307,2.2824,4.3189]])
- p = matrix( [0.0,0.0,0.0,0.0,0.0] )
- G = matrix([[-0.94,1.0,-1.0,0.0,0.0,0.0,0.0],[-1.2,1.0,0.0,-1.0,0.0,0.0,0.0],[0.02,1.0,0.0,0.0,-1.0,0.0,0.0],[-0.81,1.0,0.0,0.0,0.0,-1.0,0.0],[-0.45,1.0,0.0,0.0,0.0,0.0,-1.0]])
- h = matrix([1.0,1.0,0.0,0.0,0.0,0.0,0.0])
- sol=solvers.qp(Q, p, G, h)
- print(sol['x'])
Add Comment
Please, Sign In to add comment