From a Described Problem to a Model
What you will be able to do
Given a decision problem described in words, the learner can define decision variables with meanings and units, write the objective with its direction, write one constraint per stated restriction, and state which described quantities are data rather than variables.
Orientation
A paragraph describing a decision does not say which of its numbers you are allowed to change. Deciding that is the first move, and it is the one most often skipped.
Three questions produce a model: what is chosen, what counts as better, and what limits the choice. Each has a form it takes on the page, and answering them out of order is where the familiar faults come from. An objective written before the variables have meanings acquires its symbols retroactively, and by the time the units stop matching the mistake is several lines back.
The discipline is cheap and it transfers. It does not depend on the expressions being linear, so it is the same procedure whether the model that follows is a linear program, an integer program, or something this subject does not cover.
This unit assumes you can name the three parts of a constrained optimization problem.
Intuition
Three questions, three grammatical roles
The three parts of a model answer three different questions, and most modelling trouble is a sentence assigned to the wrong one.
What may I set? A decision variable is something the decision maker can walk out and change. Weekly production of a product: yes. The market price of a raw material: no, that is data. This test is worth applying before any algebra exists, because it is much harder to apply afterwards, when a symbol has already appeared in four expressions.
What counts as better? The objective needs a direction as well as an expression. The same function of the same variables describes two different problems depending on whether it is pushed up or down, so a model with the expression and no direction is not yet a model.
What am I not allowed to do? Each constraint should forbid something. The check is to name an assignment it rules out that the rest of the model would otherwise permit. "Production is nonnegative" forbids negative production, which is real work. "Total production equals the sum of the products" usually forbids nothing, because the sum is how total production was defined.
Units catch errors before reasoning does. If one side of a constraint is in tonnes and the other in machine-hours, the constraint is wrong, and noticing that requires only that the units were written down when the variables were defined.
Definition
What each part of a model is
Decision variables. The quantities the decision maker sets. Each carries a symbol, a meaning, and a unit:
The unit is part of the definition. Without it, dimensional consistency cannot be checked later, and a constraint mixing tonnes with hours looks exactly like a correct one.
Data. Every other number in the description: prices, capacities, requirements, rates. Data appears as coefficients. A quantity is data when the decision maker does not set it, whatever role it plays in the story.
Objective. A function of the variables, with a direction:
Each coefficient
Constraints. One per restriction, each a relation between functions of the variables:
The coefficient
Sign restrictions. A statement about which values a variable may take, written explicitly:
This is a modelling decision, not a default. A quantity that can genuinely go either way, a net cash position, a temperature difference, must not carry it.
Procedure
Turning a description into a model
Read the description once without writing anything. The aim is to find the decision being made. A description usually contains one, stated somewhere other than the first sentence.
List the quantities, and sort them into chosen and given. For each, ask whether the decision maker sets it. The ones they set become variables; the rest are data. Disputed cases are worth settling here rather than later: a quantity promoted to a variable becomes something the solution selects, which answers a different question than the one asked.
Define each variable with a symbol, a meaning, and a unit. Write the unit in every case. It is the input to every dimensional check that follows, and it costs one word.
Write the objective, with its direction. Check that each coefficient times its variable carries the unit of the objective. A mismatch here means a variable was defined in the wrong unit, and it is cheaper to fix now than after the constraints are written in terms of it.
Go through the description one sentence at a time and classify each. A sentence either states a restriction, supplies data, or is commentary. Only the first produces a constraint.
Write one constraint per restriction, and name what it forbids. If nothing comes to mind, the sentence was data or commentary, or the restriction is already implied by another constraint. A constraint that forbids nothing costs the solver time and tells a reader the model is more careful than it is.
Decide sign restrictions deliberately. Ask of each variable whether a negative value would mean anything. If it would, do not restrict it; if it would not, say so explicitly.
Read the model back as English. Each line should map onto a sentence of the description, and each restriction in the description should map onto a line. A restriction with no line is the common failure; a line with no restriction is the other one.
Worked example
A workshop description, translated
Description. A workshop makes chairs and tables. A chair uses 2 hours of carpentry and 1 hour of finishing; a table uses 4 hours of carpentry and 1 hour of finishing. There are 80 carpentry hours and 30 finishing hours available each week. Chairs sell at a profit of £20, tables at £45. Timber costs £8 per cubic metre and is not in short supply. At least 5 chairs must be made each week to hold a standing order. Plan a week to maximise profit.
---
Step 1: find the decision. The last sentence names it: plan a week's production. What is produced is what the workshop sets.
Step 2: sort the quantities. Chairs made and tables made are chosen. Hours per item, hours available, profit per item, the timber price and the standing order quantity are all given. The timber price is data that turns out to be irrelevant and is therefore not modelled: it constrains nothing and appears in no objective term, because profit per item is already stated net.
Step 3: define the variables.
Both are counts per week.
Step 4: write the objective with its direction.
Pounds per chair times chairs gives pounds. The units check.
Step 5: classify each remaining sentence.
| Sentence | Kind | Line |
|---|---|---|
| A chair uses 2h carpentry, a table 4h | data | coefficients |
| 80 carpentry hours available | restriction | constraint |
| A chair uses 1h finishing, a table 1h | data | coefficients |
| 30 finishing hours available | restriction | constraint |
| Timber costs £8/m³, not scarce | commentary | none |
| At least 5 chairs | restriction | constraint |
Step 6: write one constraint per restriction.
Forbids: any plan needing more than 80 carpentry hours. Hours per chair times chairs gives hours; the units check.
Forbids: any plan needing more than 30 finishing hours.
Forbids: honouring the standing order incompletely.
Step 7: sign restrictions. Negative production means nothing here, so
The first constraint already forces
Step 8: read it back. Three restrictions in the description, three constraints. One sentence produced no line, and the reason is recorded: the timber price restricts nothing.
The complete model.
Non-example
Four lines that are not constraints
A definition restated as a constraint. A modeller defines
A price that nobody chooses. The description mentions a raw material at £8 per cubic metre, so the model includes
A restriction the data already enforces. A workshop with 30 finishing hours, one hour per item, is given the constraint
A sentence about the world. "Demand for tables is seasonal." True, relevant to the business, and not a restriction on this week's plan unless it is turned into one: a maximum, a minimum, a relationship between the two products. As written there is nothing to encode, and inventing a number to make it encodable puts data into the model that the description never supplied.
What unites these is that each passes a reading test and fails a forbidding test. Checking that a proposed line rules something out is what separates the two.
Contrast
Decision or data
The same quantity can be a decision in one model and data in another, decided by who is doing the deciding. The question is never what kind of thing it is, but whether this decision maker sets it.
| Quantity | Decision when | Data when |
|---|---|---|
| Selling price | The firm sets its own price | The price is quoted by the market |
| Staff hours | Overtime can be authorised | The roster is fixed for the period |
| Machine capacity | New capacity can be bought this period | The plant is what it is this week |
| Order quantity | The buyer is placing the order | The order has arrived and must be met |
| Delivery route | The planner chooses routes | A carrier has already committed |
The consequence of getting it wrong runs in one direction more often than the other. Treating data as a decision gives the model freedom the decision maker does not have, and it returns a plan that cannot be carried out: an answer that assumes a price nobody will pay, or capacity that does not exist. Treating a decision as data gives away freedom that was available, and returns a plan that is feasible but worse than necessary.
Both are wrong, and the first is harder to notice, because a model with extra freedom still reports an optimum and still looks solved.
The test: can the decision maker walk out and change this number, within the period the model covers? A capacity that could be expanded next year is data in a weekly plan and a decision in an annual one, and the same description supports both models. Which one is being built has to be stated, because the algebra does not record it.
Exercise
1. A haulier has three lorries and a list of twelve loads to move tomorrow. Fuel costs 1.60 per litre, each lorry burns 0.35 litres per kilometre, and drivers are paid by the hour under an existing contract. Which quantities are decisions and which are data? State one quantity whose classification depends on how far ahead the plan looks.
2. A model defines
3. A bakery description ends: "Flour costs 0.70 per kilogram and is delivered weekly." Give the circumstances under which this sentence produces a constraint, and the circumstances under which it produces none.
4. For each line, say what assignment it forbids, or that it forbids nothing: (a)
5. A planner writes
6. Take the workshop model from the worked example and suppose the standing order is removed. Which lines change, and which constraint becomes the only thing keeping chair production above zero?