How do I formulate a sum constraint in quadratic programming?

205 Views Asked by At

I am attempting to solve a quadratic programming problem of the form:

$$\mathrm{min} \ \frac{1}{2}\alpha^T G \alpha$$ $$ \mathrm{s.t.} \ \sum_{i=1}^{n} \alpha_i y_i = 0$$ $$0 \leq \alpha_i \leq C$$

where

$$ G = y_i y_j \cdot K(\mathbf{x_i},\ \mathbf{x_j})$$

and $$ K(\mathbf{x_i},\ \mathbf{x_j}) = \exp(\frac{-\|\mathbf{x_i} - \mathbf{x_j}\|^2}{2\sigma^2})$$

is the Gaussian kernel function.

My question pertains to the first constraint; how do I formulate $\sum_{i=1}^{n} \alpha_i y_i$ such that I can pass it as an argument into a quadratic programming solver that accepts constraints as $\mathbf{A}x = b$, where $x = \alpha$? Currently I am simply passing $\mathbf{A} = y$, but I have a feeling that this is not correct.