| Optimization Toolbox | ![]() |
Linear Programming with Equalities and Inequalities
and you can load the matrices and vectors A, Aeq, b, beq, f, and the lower bounds lb into the MATLAB workspace with
This problem in sc50b.mat has 48 variables, 30 inequalities, and 20 equalities.
You can use linprog to solve the problem:
Because the iterative display was set using optimset, the results displayed are
Residuals: Primal Dual Duality Total Infeas Infeas Gap Rel A*x-b A'*y+z-f x'*z Error ------------------------------------------------------ Iter 0: 1.50e+003 2.19e+001 1.91e+004 1.00e+002 Iter 1: 1.15e+002 2.94e-015 3.62e+003 9.90e-001 Iter 2: 1.16e-012 2.21e-015 4.32e+002 9.48e-001 Iter 3: 3.23e-012 5.16e-015 7.78e+001 6.88e-001 Iter 4: 5.78e-011 7.61e-016 2.38e+001 2.69e-001 Iter 5: 9.31e-011 1.84e-015 5.05e+000 6.89e-002 Iter 6: 2.96e-011 1.62e-016 1.64e-001 2.34e-003 Iter 7: 1.51e-011 2.74e-016 1.09e-005 1.55e-007 Iter 8: 1.51e-012 2.37e-016 1.09e-011 1.51e-013 Optimization terminated successfully.
For this problem, the large-scale linear programming algorithm quickly reduces the scaled residuals below the default tolerance of 1e-08.
The exitflag value is positive, telling you linprog converged. You can also get the final function value in fval and the number of iterations in output.iterations:
| Linear Least-Squares with Bound Constraints | Linear Programming with Dense Columns in the Equalities | ![]() |