From a Practical Goal to a Mathematical Model
Applied optimization begins before any calculation aimed at finding a best design. First, the situation must be expressed as a model: a collection of decision variables, an objective function, and constraints that describe which decisions are allowed. A model that omits a requirement or uses inconsistent units can produce a mathematically correct answer to the wrong problem.
The purpose of this tutorial is to formulate models, not to solve them. In particular, writing down a constraint does not establish that a model has a feasible solution or identify an optimum. Those are separate questions. Here the central task is to translate the stated goal and requirements carefully enough that the mathematical model represents them.
Decision Variables, Objectives, and Constraints
Decision variables represent quantities a planner or designer can choose. Each variable needs a clear meaning and a unit, such as hours, kilograms, hectares, or pallets per day. The unit is part of the interpretation: a variable representing daily flow is not interchangeable with one representing stored inventory.
The objective function assigns a value to each decision. It encodes what the model is intended to improve, such as maximizing estimated benefit or minimizing cost. An objective is not itself a requirement. For example, minimizing cost does not automatically impose a budget limit; a budget limit must be written as a constraint if the situation specifies one.
Constraints express required conditions and limits. An exact requirement is commonly represented by an equality. A maximum resource allowance is commonly represented by a “less than or equal to” inequality; a minimum performance requirement is commonly represented by a “greater than or equal to” inequality. Physical restrictions such as nonnegative quantities must also be included.
A common notation is to write equality constraints as \(g_i(\mathbf{x})=0\) and inequality constraints as \(h_j(\mathbf{x})\leq 0\), for specified functions \(g_i\) and \(h_j\). Constraints written with \(\geq\) are equally valid; they can be rearranged into the \(\leq 0\) form by multiplying by \(-1\). The form used should make the original requirement easy to interpret.
This notation is a template, not a recipe that determines the model by itself. The variables, objective, functions, and domains must come from the particular application. For a continuous calculus model, variables typically range over real values in specified intervals or regions. If the real decisions must be whole numbers, that integrality requirement is part of the model too.
A Reliable Formulation Process
Define a variable for each independent decision, with units and an allowed domain.
Decide what quantity is to be maximized or minimized, and specify the objective's units or interpretation.
Use an equality for an exact balance, or an inequality for a cap or minimum. Include nonnegativity, bounds, and integrality when required.
Substitute a test decision into the equations and inequalities, and confirm that both sides of each constraint have compatible units.
Separating these steps helps prevent a frequent modeling error: putting a condition into the objective when it should be a constraint, or treating a preference as if it were a required condition. It also makes assumptions visible. For example, a model might assume a quoted cost per unit stays constant across the range of decisions; that is a modeling choice, not an algebraic consequence.
Worked Example: Choosing a Water Blend
Worked Example: Choosing a Water Blend
A utility chooses daily volumes from two water sources. Let \(x\) be the volume from source A and \(y\) the volume from source B, both measured in cubic metres per day. The required total is \(100\) cubic metres per day. Their contaminant concentrations are \(2.0\) milligrams per litre and \(0.5\) milligrams per litre, respectively. The blended concentration must be at most \(1.4\) milligrams per litre. Source costs are \(\$0.30\) and \(\$0.50\) per cubic metre. Formulate a minimum-cost model.
The total-volume requirement is exact, so it gives \(x+y=100\). The objective is daily cost, measured in dollars per day:
Because the volume variables are in cubic metres per day while the concentrations use litres, convert both source volumes to litres before writing contaminant mass. One cubic metre is \(1000\) litres. The mass entering per day is therefore \(1000(2.0x+0.5y)\) milligrams. The maximum allowed mass is the concentration limit times the total volume in litres, or \(1.4\cdot1000(x+y)\) milligrams. Thus the concentration requirement is:
Volumes cannot be negative. The complete formulation is:
Here \(x,y\) are in cubic metres per day, the equality is in cubic metres per day, and both sides of the contaminant inequality are in milligrams per day. The cost objective is in dollars per day. As a check, test \(x=60\) and \(y=40\). The total is \(60+40=100\) cubic metres per day. The contaminant mass is \(1000(2.0\cdot60+0.5\cdot40)=1000(120+20)=140{,}000\) milligrams per day. The limit is \(1.4\cdot1000(60+40)=140{,}000\) milligrams per day, so the inequality holds with equality. The daily cost at this test choice is \(0.30\cdot60+0.50\cdot40=18+20=\$38\) per day. Both volumes are nonnegative. These checks show that the test choice satisfies the stated model; they do not establish that it minimizes cost.
Why the Concentration Constraint Has This Form
The blend condition in the example follows from the definition of concentration as mass divided by volume. If the source volumes are \(x\) and \(y\) cubic metres per day, their total volume is \(1000(x+y)\) litres per day. Their total contaminant mass is \(1000(2.0x+0.5y)\) milligrams per day. Therefore the blend concentration is:
Requiring this concentration to be no more than \(1.4\) gives \((2.0x+0.5y)/(x+y)\leq1.4\). Since the total volume is \(100\), the denominator is positive, so multiplication by \(x+y\) preserves the inequality direction. Equivalently, one can multiply by the positive conversion factor \(1000\) and write \(1000(2.0x+0.5y)\leq1.4\cdot1000(x+y)\). This derivation explains why the concentration requirement compares contaminant mass with the maximum permitted mass for the total volume. It also shows why the positivity of the total volume matters when removing a denominator.
Worked Example: Allocating Restoration Areas
Worked Example: Allocating Restoration Areas
A planning team allocates land to two restoration projects. Let \(x\) and \(y\) be the areas, in hectares, assigned to project A and project B. The team uses an estimated benefit score \(B(x,y)=8x+10y-0.2x^2-0.25y^2\), measured in benefit points. The coefficients are based on an assumed response model; the squared terms represent diminishing estimated returns. Project costs are \(\$3{,}000\) per hectare for A and \(\$5{,}000\) per hectare for B. The total budget is \(\$60{,}000\); at least \(8\) hectares must be restored; and project A has a maximum area of \(12\) hectares. Formulate a model to maximize estimated benefit.
The objective is to maximize the given score. The budget constraint compares total cost in dollars with the dollar limit. The minimum total area and maximum project area give separate inequalities. The model is:
Areas in the budget expression are in hectares, so each cost coefficient must be interpreted as dollars per hectare. The score coefficients must likewise carry the units needed for each term to produce benefit points: the linear coefficients are points per hectare and the quadratic coefficients are points per hectare squared. Test \(x=5\), \(y=4\). Total cost is \(3000\cdot5+5000\cdot4=15{,}000+20{,}000=\$35{,}000\), which is at most \(\$60{,}000\). Total area is \(5+4=9\) hectares, which is at least \(8\). Also \(0\leq5\leq12\) and \(4\geq0\). The objective value at this test allocation is \(8\cdot5+10\cdot4-0.2\cdot25-0.25\cdot16=40+40-5-4=71\) benefit points. Thus the test allocation satisfies every stated constraint, and the objective has the specified units. It is only a model check, not a claim that this allocation is optimal.
Worked Example: Planning Deliveries to Two Clinics
Worked Example: Planning Deliveries to Two Clinics
Two depots deliver supplies to two clinics. Let \(x_{11}\) and \(x_{12}\) be daily deliveries, in pallets per day, from depot 1 to clinics 1 and 2. Let \(x_{21}\) and \(x_{22}\) be the corresponding deliveries from depot 2. Clinic 1 requires exactly \(30\) pallets per day, and clinic 2 exactly \(20\). Depot 1 can dispatch at most \(35\) pallets per day and depot 2 at most \(25\). The route from depot 1 to clinic 2 can carry at most \(10\) pallets per day. The route costs, in dollars per pallet, are \(4,6,5,3\), respectively. Formulate a minimum-cost model.
The objective adds the cost of all four routes. Each clinic's exact requirement gives an equality, while each depot capacity and the route limit give inequalities. All deliveries are nonnegative:
Each objective term has units \((\text{dollars per pallet})(\text{pallets per day})=\text{dollars per day}\). Test \(x_{11}=20\), \(x_{12}=10\), \(x_{21}=10\), and \(x_{22}=10\). Clinic 1 receives \(20+10=30\) pallets per day, and clinic 2 receives \(10+10=20\). Depot 1 dispatches \(20+10=30\leq35\), while depot 2 dispatches \(10+10=20\leq25\). The restricted route carries \(x_{12}=10\leq10\). All deliveries are nonnegative. The cost is \(4\cdot20+6\cdot10+5\cdot10+3\cdot10=80+60+50+30=\$220\) per day. This verifies that the test deliveries satisfy the model; it does not show that their cost is the smallest possible.
Units, Domains, and Modeling Assumptions
A useful check is dimensional consistency: terms that are added must have compatible units, and the two sides of a physical equality or inequality must measure the same kind of quantity. In a cost constraint, for example, multiplying dollars per unit by units gives dollars. In a balance equation, both sides must represent the same flow or amount. Unit conversion factors should be written explicitly when needed, as in the water-blend example.
Domain restrictions are also part of the model. A volume, area, or delivery amount is normally nonnegative. A variable may also have an upper or lower bound from a capacity, design specification, or policy. If a decision counts indivisible items, it must be an integer. For instance, a model of whole vehicles cannot faithfully allow \(3.6\) vehicles unless the model deliberately uses a continuous approximation. Standard calculus methods for continuous variables apply to the continuous model, not automatically to an integer-restricted one.
Finally, distinguish what the scenario requires from what it merely suggests. An exact demand is an equality; a minimum target is a \(\geq\) inequality; an available-resource limit is a \(\leq\) inequality. A preference such as “use the cheaper source when possible” is not a substitute for defining an objective and the required constraints. State assumptions behind estimated objective formulas, too: an objective is only as representative as the relationship it encodes.
A Common Modeling Mistake
Suppose the two-source blend uses \(x=60\) and \(y=40\), with source concentrations \(2.0\) and \(0.5\) milligrams per litre. A tempting but incorrect calculation is to compare \(2.0x+0.5y=140\) directly with the limit \(1.4\). This compares a concentration-weighted volume with a concentration; the units do not match. It also leaves out the total volume used to define the blended concentration.
The correction is to divide total contaminant mass by total volume, or equivalently to compare mass with the allowed mass for the total volume. In this example, the blended concentration is \((2.0\cdot60+0.5\cdot40)/(60+40)=140/100=1.4\) milligrams per litre. The corresponding mass comparison is \(1000\cdot140=140{,}000\) milligrams per day versus \(1.4\cdot1000\cdot100=140{,}000\) milligrams per day. Both forms give the same valid check.
Check Your Understanding
For each question, identify the modeling choice or check that would make the formulation precise.
- A planner must use exactly \(40\) staff-hours. What type of constraint expresses this requirement, and what units should both sides have?
- A design must process at least \(500\) litres per day. Should the requirement use \(=\), \(\leq\), or \(\geq\), and what does the inequality compare?
- What is the difference between a decision variable and an objective function?
- Why is it invalid to compare a cost measured in dollars with a limit measured in hours?
- If a model chooses a number of whole machines, what domain restriction should be included, and why might a continuous model be only an approximation?