我需要在matlab中使用quadprog来最小化alpha
1/2*alpha.'*H*alpha+(-1.')*alpha
subject to: y.'alpha=0 and 0<=alpha<=inf
我已经制作了矩阵H
for a=1:8
for b=1:8
H(a,b)=y(a)*y(b)*dot((x(a)).',x(b));
end
end
但我不确定是否必须制定约束
答案 0 :(得分:0)
这有用吗?
n = size(H,1);
f = -ones(n,1); // linear term
aeq = randn(1,n); // equality constraint
lb = zeros(n,1); // lower bound
ub = inf * ones(n,1); // upper bound
alpha = quadprog(H,f,[],[],aeq,0,lb,ub)