赞
踩
Mixed-integer quadratic program(混合-整数二次规划)
标准形式:-A mixed-integer quadratic program (MIQP) is an optimization problem of the form:
- #example -mixed-integer quadratic program
- import cvxpy as cp
- import numpy as np
-
- #problem data
- m,n = 40,25
-
- np.random.randn(1)
- A = np.random.randn(m,n)
- b = np.random.randn(m)
-
- #problem variable
- x = cp.Variable(n,integer = True)
-
- #constraints
-
- #object
- objective = cp.Minimize(cp.sum_squares(A@x-b))
-
- #problem
- prob = cp.Problem(objective)
-
- #solve
- prob.solve()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。