I cannot figure out what I am doing wrong with this portfolio optimization (find optimal weights) using quadprog in numeric.js
My portfolio constraints are simple: weights should sum up to 1 and all weights (for each of the 3 assets) should be between 0 and 1 (no short selling, no leverage). Constraints are not recognized and weights get very high (and also negative).
var constraintsmatrix = [[0,0,0,0], [1,0,1,0], [1,0,0,0]];
var covmatrix = [[0.00020817,0.00016281,0.00009747],[0.00016281,0.00026680,0.00009912],[0.00009747,0.00009912,0.00019958]];
var returnsmatrix = [0.1,0.05,0.1];
var bvec = 1; // [1,0,0,0,0,0,0,1,1,1];
var result = numeric.solveQP(covmatrix, returnsmatrix, constraintsmatrix, bvec);
Any hint appreciated. Thanks