Checking solver output
Checking Solver Output
Solver output must be checked. A numerical answer is only useful if it satisfies the constraints and matches the original model.
Feasibility Check
Given a reported solution $x^*$, substitute it into every constraint.
For inequalities:
\[A_{ineq}x^*\le b_{ineq}.\]For equalities:
\[A_{eq}x^*=b_{eq}.\]For bounds:
\[lb\le x^*\le ub.\]Objective Value Check
Compute the objective manually:
\[z^*=c^Tx^*.\]If the solver minimized $-c^Tx$ for a maximization problem, convert back:
\[\max c^Tx^*=-fval.\]Active Constraints and Slack
For a $\le$ constraint:
\[a_i^Tx\le b_i,\]the slack is:
\[s_i=b_i-a_i^Tx^*.\]If $s_i=0$, the constraint is active. If $s_i>0$, the constraint is not fully used.
Status Messages
A solver may report:
- optimal solution found
- infeasible problem
- unbounded problem
- numerical difficulty
- iteration limit reached
Only the first one is a clean final answer. The others require explanation.
Rounding
Small numerical errors are normal. Values such as:
\[-10^{-9}\]may be treated as zero in a continuous LP.
Do not round integer variables casually. If a problem is integer, it must be solved as an integer program, not by rounding an LP solution.
Interpretation
Translate the result back into the original context.
Instead of only writing:
\[x^*=(4,16),\quad z^*=2320,\]write what the variables mean, such as: produce $4$ hectares of barley and $16$ hectares of swedes, giving profit $2320$.
See Also
Exam checkpoint
For solver questions, the solver result is not enough. Also report the LP model, variable meanings, objective value, active constraints, and whether the result matches algebraic expectations.