I have a question about this algorithm that I need answered, as I'm auditing my model and this inconsistency is concerning.
I am doing mean-variance optimization with constraints they must sum to 1, and the weights must be within my specified ranges. My inputs are as follows:
Dmat = Sigma
dvec = rep(0, ncol(Sigma))
Amat = rbind(rep(1, ncol(Sigma)), diag(ncol(Sigma)), -diag(ncol(Sigma)),
ncol=ncol(Sigma))
bvec = c(1, MinWeights, -MaxWeights)
Then I run:
Out = solve.QP(Dmat, dvec, t(Amat), bvec, meq=1)
Weights = Out$solution
Var = t(Weights) %*% Sigma %*% Weights
Var == Out$value
The problem is I get FALSE for that last command. It's not a rounding issue, they are off by a magnitude of almost 20%.
Anyone know what the problem is?