Linear Constraints

If all the terms of a constraint are of the first order, the constraint is said to be linear. This means the constraint doesn’t contain a variable squared, cubed, or raised to any power other than one, a term divided by a variable, or variables multiplied by each other. Also, proportionality must exist. In other words, for every unit increase or decrease in a variable, the value of the constraint increases or decreases by a fixed amount.

Linear formulas are "straight line" relationships. The basic form of a linear formula is:

Y = m X + b

where m and b are constants.

For example, suppose you’re buying tomatoes for $1.50 per pound. The expression or function used to calculate the cost (C) in terms of the amount of tomatoes purchased (variable T) is:

C = 1.5 * T.

As you might expect, a graph of this function for cost is a straight line:

BMP00194

Linear expressions can have multiple variables. For example, if you added potatoes (P) at $0.75 per pound and apples (A) at $1.25 per pound, your cost function would become:

C = 1.5 * T + 0.75 * P + 1.25 * A

This new cost expression is also linear. You could think of it as the sum of three simpler linear expressions.

Because linear models can be solved orders of magnitude faster and with more accuracy than nonlinear models, it's preferable to formulate your models using linear expressions whenever possible. When the Solver|Solve command is issued, LINGO analyzes the relationships in the model. If all the expressions are linear, LINGO will recognize and take advantage of this fact.

Relative to other types of models, problems expressed using exclusively linear relationships can be solved quickly. If allowed to run to completion, LINGO will return the answer that yields the highest value for a maximization objective, or the lowest value for a minimization objective.

One way to learn whether or not all expressions in your model are linear is to note the classification statistics displayed during the solution process in the solver status window. The Nonlinear categories of the Variables and Constraints boxes display the number of nonlinear relationships in the model. If zeros appear in both these categories, the model is linear.

If LINGO displays a number greater than zero for the nonlinear relationships, you may want to investigate whether the constraints and variables in your model could be reformulated in a linear manner. For example, consider the following constraint:

X / Y = 10;

As written, this constraint is nonlinear because we are dividing by Y. By simply multiplying both sides of the equation through by Y, we can convert it to the equivalent linear constraint:

X = 10 * Y;