Solver inputs
Solver Inputs
Solver inputs are the numerical objects that represent the LP: objective coefficients, constraint matrices, right-hand sides, and bounds.
Objective Vector
For:
\[\min c_1x_1+c_2x_2+\cdots+c_nx_n,\]the objective vector is:
\[c=\begin{bmatrix}c_1\\c_2\\\vdots\\c_n\end{bmatrix}.\]The solver computes $c^Tx$.
Inequality Matrix
For constraints:
\[a_{11}x_1+\cdots+a_{1n}x_n\le b_1\] \[\vdots\] \[a_{m1}x_1+\cdots+a_{mn}x_n\le b_m,\]write:
\[A_{ineq}x\le b_{ineq}.\]Each row of $A_{ineq}$ is one constraint.
Equality Matrix
For equality constraints, use:
\[A_{eq}x=b_{eq}.\]Do not split an equality into two inequalities unless the tool requires it. In MATLAB and most solvers, equality constraints have their own input fields.
Bounds
Bounds are constraints directly on variables:
\[lb_j\le x_j\le ub_j.\]Nonnegativity is:
\[lb_j=0.\]If $x_j$ is free, some solvers allow $lb_j=-\infty$ and $ub_j=\infty$. If not, replace the free variable by $x_j=x_j^+-x_j^-$ with $x_j^+,x_j^-\ge 0$.
Integer and Binary Inputs
For ILP problems, some variables must be declared integer or binary.
A binary variable satisfies:
\[y\in\{0,1\}.\]A general integer variable satisfies:
\[y\in\mathbb{Z}.\]Standard linprog does not solve integer programs. MATLAB uses tools such as intlinprog for ILP.
Checklist
When constructing solver inputs, verify:
- number of columns equals number of variables
- number of rows equals number of constraints
- each right-hand side matches the correct row
- objective vector length equals number of variables
- maximization has been converted if required
- all variable bounds are present
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.