svm算法,说到底就是二次优化问题。
带有约束的二次优化问题。
1、线性优化问题,课件Leture5-QP
python代码:
# problem
def qp_test1():
prob = LpProblem("qp_test1", LpMinimize)
x1 = LpVariable("x1", 0, None, LpInteger)
x2 = LpVariable("x2", 0, None, LpInteger)
prob += 50*x1+36*x2, "Cost"
prob += x1>=0, "x1"
prob += x2>=0, "x2"
prob += 5*x1+3*x2>=45, "cond1"
prob.solve()
print("Status:", LpStatus[prob.status])
for v in prob.variables():
print(v.name, "=", v.varValue)
2.二次优化问题
原文:http://www.cnblogs.com/liuhuiwisdom/p/6513972.html