Page 1 of 1
QuadProg (Matlab) help
Posted: February 6th, 2011, 3:14 pm
by chartreuse
Hello,I have set up my optimization problem to minimize variance, but I keep on getting the "wrong" weights, in the sense that they don't add up to 1. The assumption I am taking here is that there is no short -selling. The error message I get in Matlab is: The system of equality constraints is consistent.Removing the following dependent constraints before continuing: 2 3 4The equality constraints are dependent.Exiting: the constraints are overly stringent;Can someone please explain to me what I might be doing?I have attached my code. Note on the code: I have thought about making ub = zeros(4,1). However, then, that just allocates the weights to some number (28.9017)- all allocation is the same. I don't think this is correct. Thanks for your feedback!
QuadProg (Matlab) help
Posted: February 6th, 2011, 4:53 pm
by acastaldo
The Aeq matrix does not make much sense to me at all.What constraints are you trying to represent? You need only one constraint: that the weights add up to one, and you don't have that. The coefficients for that constraint would be a row of ones, and the right hand side would be a scalar 1.
QuadProg (Matlab) help
Posted: February 7th, 2011, 4:50 am
by chartreuse
I think the code is a result of my doing various testing of inputs. How does one represent that the weights equal one? If I put a row of 1's for Aeq, I get an error message saying that it should be a matrix. If I make it then, a row matrix, with zeros below into a 4x4, then I get all weights to be zero. I don't think this is correct at all. Have I misunderstood your explanation? Thank you very much for your contribution.
QuadProg (Matlab) help
Posted: February 7th, 2011, 1:51 pm
by acastaldo
maybe try Aeq= transpose(ones(4));orAeq= reshape(ones(4),[1 4]);
QuadProg (Matlab) help
Posted: February 9th, 2011, 3:56 am
by chartreuse
The first Aeq works when I change f to equal zeros(4,1).