hi~
I used to use R to solve this kind of problem.
I can give you some hint here (cause I don't have your data, so I can't write the program for you):
once you installed R, follow the steps here: packages -> install packages -> select cran -> download "quadprog", then click packages -> load package -> "quadprog"
then in the R console type in: help(solve.QP), then press "Enter"
you'll get a help file of R.
like:
solve.QP(Dmat, dvec, Amat, bvec, meq=0, factorized=FALSE)
Dmat: matrix appearing in the quadratic function to be minimized.
dvec: vector appearing in the quadratic function to be minimized.
Amat: matrix defining the constraints under which we want to minimize the quadratic function.
bvec: vector holding the values of b_0 (defaults to zero).
meq: the first ‘meq’ constraints are treated as equality constraints, all further as inequality constraints (defaults to 0).
factorized: logical flag: if ‘TRUE’, then we are passing R^(-1) (where D = R^T R) instead of the matrix D in the argument ‘Dmat’.
Follow the instruction, apply to your data, then you'll find the answer~
Good Luck