MATLAB: Do I get a warning and NaNs in the output when using the PORTOPT function from the Financial Toolbox 3.6 (R2009a)

Financial Toolbox

I am using the PORTOPT command from Financial Toolbox 3.6 (R2009a) and am getting a warning at the command prompt:
[PortRisk, PortReturn, PortWts] = portopt(eqrtns, covar, numport, [],ConSet);
Warning: Candidate solution is infeasible due to a bad pivot.
> In lcprog>lcprealitycheck at 299
In lcprog at 189
In qplcprog at 244
In portopt at 342
In cust_rep at 3
Warning: Candidate solution is infeasible due to a bad pivot.
> In lcprog>lcprealitycheck at 299
In lcprog at 189
In qplcprog at 244
In portopt at 342
In cust_rep at 3
Warning: Candidate solution is infeasible due to a bad pivot.
....
Also the evaluated PortRisk parameter contains NaNs:
>> PortRisk
PortRisk =
0.0425
0.0486
0.0617
NaN
NaN
NaN
0.1515
0.1865
0.2287
0.2911

Best Answer

This issue generally happens when the problem is degenerate (overconstrained in some instances). In such situations the solver will not be able find the optmimum point and the output can be NaNs.
To workaround this, re-evaluate your constraint matrix and see that the optimization problem is well posed.