gringotopies

Kwadratowe 2

Dec 18th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. from cvxopt import matrix, solvers
  2. Q=matrix([[11.4312,1.1701,0.1232,1.6619,2.0254],
  3. [1.1701,7.7723,0.4983,1.1374,1.7056],
  4. [0.1232,0.4983,5.1598,-1.3094,-0.6307],
  5. [1.6619,1.1374,-1.3094,20.2858,2.2824],
  6. [2.0254,1.7056,-0.6307,2.2824,4.3189]])
  7.  
  8.  
  9. p = matrix( [0.0,0.0,0.0,0.0,0.0] )
  10. 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]])
  11. h = matrix([1.0,1.0,0.0,0.0,0.0,0.0,0.0])
  12.  
  13. sol=solvers.qp(Q, p, G, h)
  14.  
  15. print(sol['x'])
Add Comment
Please, Sign In to add comment