Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from cvxopt import solvers, matrix
- P = matrix([[4.0, 1.0], [1.0, 2.0]])
- q = matrix([1.0, 1.0])
- print(P)
- print(q)
- G = matrix([[-1.0, 0.0], [0.0, -1.0]])
- h = matrix([0.0, 0.0])
- A = matrix([[1.0], [1.0]])
- b = matrix([1.0])
- print(G)
- print(h)
- print(A)
- print(b)
- sol = solvers.qp(P, q, G, h, A, b)
- optimal = sol['x']
- print("Optimal")
- print(optimal)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement