MATLAB: Do I obtain an error code -2_4 with LINPROG

dual-simplexintlinproglinprogOptimization Toolbox

Trying to solve a specific optimization problem with LINPROG, I get the following error message:
Error using linprog (line 345)
LINPROG encountered an internal error that caused the solution to lose feasibility. We are sorry for the inconvenience.
Please contact technical support for assistance with your problem, quoting the code "-2_4".

Best Answer

This might be related to a bug with the dual-simplex solver in LINPROG, which was fixed in MATLAB R2019a and I would recommend downloading this release of MATLAB. However, if you would prefer not to install MATLAB R2019a or are unable to do so, please try the workaround below:
1) Disable Pre-Processing by using the name-value pair 'PreProcess','none' when setting the solver options, like
options = optimoptions('linprog','PreProcess','none');
2) Use the interior-point algorithm rather than dual-simplex, like
options = optimoptions('linprog','Algorithm','interior-point');