Decision variables
Decision Variables
Decision variables are the unknown quantities that we choose in an optimization problem.
They represent the decision to be made.
Basic Definition
If:
\[x=(x_1,x_2,\ldots,x_n)\]then each component:
\[x_1,x_2,\ldots,x_n\]is a decision variable.
Together, they form the decision vector:
\[x\]Meaning
A decision variable answers the question:
What are we trying to decide?
Examples:
- how many units to produce
- how many hours to operate a machine
- how much money to invest
- how much food to buy
- how many vehicles to use
- how many hectares to cultivate
Example: Production
Suppose a factory produces two products.
Define:
\[x_1 = \text{number of units of product A}\] \[x_2 = \text{number of units of product B}\]Then:
\[x= \begin{bmatrix} x_1\\ x_2 \end{bmatrix}\]is the decision vector.
Example: Transportation
Suppose goods are shipped from two factories to two warehouses.
Define:
\[x_1 = \text{units shipped from factory 1 to warehouse 1}\] \[x_2 = \text{units shipped from factory 1 to warehouse 2}\] \[x_3 = \text{units shipped from factory 2 to warehouse 1}\] \[x_4 = \text{units shipped from factory 2 to warehouse 2}\]Then:
\[x=(x_1,x_2,x_3,x_4)\]contains all shipping decisions.
Example: Investment
Suppose an investor can buy units of several funds.
Define:
\[x_j = \text{number of units purchased of fund } j\]Then the model decides how many units of each fund to buy.
Sign Restrictions
Many decision variables must be nonnegative:
\[x_j\ge 0\]This is because they represent quantities.
Examples:
- production amount cannot be negative
- investment amount cannot be negative
- food quantity cannot be negative
- hectares cultivated cannot be negative
In vector form:
\[x\ge 0\]means:
\[x_1\ge 0,\quad x_2\ge 0,\quad \ldots,\quad x_n\ge 0\]Free Variables
Some variables can be positive, zero, or negative.
These are called free variables.
Example:
\[x_j \in \mathbb{R}\]A free variable may represent a net balance, where positive means surplus and negative means deficit.
In standard form, free variables are usually replaced by two nonnegative variables:
\[x_j=x_j^+ - x_j^-\]where:
\[x_j^+\ge 0,\qquad x_j^-\ge 0\]Integer Variables
Some decisions must be integers.
Examples:
- number of workers
- number of vehicles
- number of machines
- number of products when fractional units are impossible
If $x_j$ must be an integer, we write:
\[x_j\in\mathbb{Z}\]If it must be nonnegative integer:
\[x_j\in\mathbb{Z}_{\ge 0}\]Binary Variables
A binary variable can only be $0$ or $1$:
\[x_j\in\{0,1\}\]Binary variables represent yes/no decisions.
Examples:
- open a facility or not
- select an item or not
- assign a task or not
- use a route or not
Choosing Good Decision Variables
Good decision variables should be:
- precise
- measurable
- directly connected to the decision
- enough to describe the whole solution
- not redundant when possible
Bad decision variables make the model confusing.
Common Mistake
Do not define the objective before defining the decision variables.
The objective and constraints must be written in terms of the decision variables.
So the first modeling step is usually:
Define the unknowns.
Units Matter
Always specify units.
Bad:
\[x_1 = \text{pasta}\]Good:
\[x_1 = \text{kilograms of pasta bought per day}\]or:
\[x_1 = \text{hundreds of grams of pasta bought per day}\]The unit affects the coefficients in the objective and constraints.
Decision Vector
When there are many variables, we collect them into a vector:
\[x= \begin{bmatrix} x_1\\ x_2\\ \vdots\\ x_n \end{bmatrix}\]This lets us write the model compactly.
For example:
\[\min c^Tx\]subject to:
\[Ax=b\] \[x\ge 0\]Decision Variables in Linear Programming
In linear programming, the decision variables appear linearly.
This means expressions are built using terms like:
\[c_1x_1+c_2x_2+\cdots+c_nx_n\]Variables are not multiplied together.
So LP does not allow terms like:
\[x_1x_2\]or:
\[x_1^2\]From Words to Variables
When reading a word problem, look for the quantities being decided.
Phrases that often signal decision variables:
- “how many…”
- “how much…”
- “determine the number…”
- “decide the amount…”
- “allocate…”
- “invest…”
- “produce…”
- “ship…”
Example Template
For a production problem:
\[x_j = \text{number of units of product } j \text{ produced}\]For a diet problem:
\[x_j = \text{quantity of food } j \text{ consumed}\]For an investment problem:
\[x_j = \text{amount invested in fund } j\]For a transportation problem:
\[x_{ij} = \text{quantity shipped from source } i \text{ to destination } j\]Checklist
You understand decision variables if you can:
- identify what the model chooses
- define each variable with units
- collect variables into a vector
- decide whether variables are nonnegative, free, integer, or binary
- write objective and constraints using the variables
- avoid vague variable definitions
See Also
- Optimization Foundations
- Objective Functions
- Constraints
- Feasible Sets
- LP Formulation
- Integer Variables
- Binary Variables
Exam checkpoint
In exam problems, translate the story into variables, objective, constraints, feasible set, and optimal value. Always state whether the problem is a maximization or minimization and what the units are.