Basically, the problem is that your equality constraint matrix xAeq is full rank:
>> rank(xAeq)
ans =
8
>> cond(xAeq)
ans =
10.206330042860493
I think this was unintentional on your part, because it means the constraints can have no more than one unique solution. Normally, you wouldn't make your constraints this tight, since it trivializes the optimization.
Anyway, the point is that this is apparently a numerically sensitive situation for linprog. It cannot tell the difference between the case where there is a single solution (up to floating point errors) and the case where there are none at all. It is worth pointing out though that the weights vector that you've provided in your data.mat file, and which you believe to be feasible, doesn't satisfy the constraints especially well. This is easiest to see in long precision.
>> format long; [xAeq*weights,xbeq]
ans =
0.000003546232588 0
-0.000003546232595 0
0.000000000000000 0
-0.000003546232584 0
0.000003546232600 0
-0.000003482138166 0
0.000000000000000 0
0.000003482138164 0
1.000000000000000 1.000000000000000
The least squares solution to your equality constraints also don't even satisfy the equations all that well,
>> weightsLSQ=xAeq\xbeq;
>> norm(xAeq*weightsLSQ-xbeq)
ans =
4.970015269326972e-06
I still do find it a little curious that your provided weights are considered infeasible by linprog since they do satisfy the constraints to within the ConstraintTolerance parameter. Hopefully, someone from the MathWorks will comment on that.
Best Answer