Objective functions
Objective Functions
The objective function is the quantity we want to optimize.
It measures the quality of a decision.
Basic Definition
An objective function is a function:
\[f:\mathbb{R}^n\to\mathbb{R}\]It takes a decision vector:
\[x=(x_1,x_2,\ldots,x_n)\]and returns a scalar value:
\[f(x)\]This scalar is the value we want to maximize or minimize.
Maximization
Use maximization when the objective is a benefit.
Examples:
- profit
- revenue
- expected return
- number of hired workers
- production output
- utility
A maximization problem is written:
\[\max f(x)\]Minimization
Use minimization when the objective is a cost or loss.
Examples:
- cost
- time
- distance
- waste
- risk
- fuel consumption
A minimization problem is written:
\[\min f(x)\]Linear Objective Function
In linear programming, the objective function is linear.
It has the form:
\[f(x)=c_1x_1+c_2x_2+\cdots+c_nx_n\]In vector form:
\[f(x)=c^Tx\]where:
\[c=(c_1,c_2,\ldots,c_n)\]is the cost vector or profit vector.
Objective Coefficients
The numbers:
\[c_1,c_2,\ldots,c_n\]are the objective coefficients.
They tell us how much each variable contributes to the objective.
Example:
\[\max 5x_1+12x_2\]means:
- each unit of $x_1$ contributes $5$
- each unit of $x_2$ contributes $12$
Profit Objective
Suppose:
\[x_1 = \text{units of product A}\] \[x_2 = \text{units of product B}\]Product A gives profit $5$ per unit.
Product B gives profit $12$ per unit.
Then total profit is:
\[P=5x_1+12x_2\]The optimization problem may be:
\[\max P=5x_1+12x_2\]Cost Objective
Suppose:
\[x_1 = \text{days operating mine X}\] \[x_2 = \text{days operating mine Y}\]Mine X costs $180$ euros per day.
Mine Y costs $160$ euros per day.
Then total cost is:
\[C=180x_1+160x_2\]The optimization problem may be:
\[\min C=180x_1+160x_2\]Investment Return Objective
Suppose:
\[x_j = \text{number of units purchased of fund } j\]If fund $j$ costs $p_j$ euros per unit and has expected return rate $r_j$, then expected return per unit is:
\[r_jp_j\]The total expected return is:
\[\sum_j r_jp_jx_j\]A natural objective is:
\[\max \sum_j r_jp_jx_j\]Objective Function in Matrix Form
Let:
\[c= \begin{bmatrix} c_1\\ c_2\\ \vdots\\ c_n \end{bmatrix}\]and:
\[x= \begin{bmatrix} x_1\\ x_2\\ \vdots\\ x_n \end{bmatrix}\]Then:
\[c^Tx=c_1x_1+c_2x_2+\cdots+c_nx_n\]This is the standard compact notation for a linear objective.
Objective Value
For a specific feasible point $x$, the number:
\[f(x)\]is the objective value at that point.
Example:
\[f(x)=5x_1+12x_2\]At:
\[x=(6,3)\]we get:
\[f(6,3)=5(6)+12(3)=30+36=66\]So the objective value is:
\[66\]Optimal Value
The optimal value is the best objective value over the feasible set.
If $x^*$ is optimal, then:
\[z^*=f(x^*)\]The point $x^*$ is the optimal solution.
The scalar $z^*$ is the optimal value.
Contour Lines
For a two-variable linear objective:
\[f(x_1,x_2)=c_1x_1+c_2x_2\]a contour line is:
\[c_1x_1+c_2x_2=k\]where $k$ is constant.
Every point on the same contour line has the same objective value.
Example of Contour Lines
If:
\[f(x_1,x_2)=x_1+x_2\]then contour lines are:
\[x_1+x_2=k\]Examples:
\[x_1+x_2=0\] \[x_1+x_2=3\] \[x_1+x_2=5\]These lines are parallel.
Cost Vector and Direction
For:
\[f(x)=c^Tx\]the vector $c$ gives the direction in which the objective increases.
For maximization, move the contour line in the direction of $c$.
For minimization, move the contour line in the direction of $-c$.
Graphical Interpretation
In graphical LP:
- draw the feasible region
- draw a contour line of the objective
- move the contour line in the improving direction
- the last point of contact with the feasible region is optimal
If the last contact is a single vertex, the optimum is unique.
If the last contact is an edge, there are multiple optimal solutions.
Objective Must Match the Goal
The objective function must represent the real goal of the problem.
Examples:
| Goal | Objective |
|---|---|
| maximize profit | $\max$ total profit |
| minimize expense | $\min$ total cost |
| maximize annual gain | $\max$ total revenue or profit |
| minimize transport cost | $\min$ total shipping cost |
| maximize expected return | $\max$ total expected return |
Common Mistake: Mixing Units
All terms in the objective must have compatible units.
Example:
\[5x_1+12x_2\]is valid if both terms are in euros, dollars, hours, or another common unit.
Do not add unrelated quantities such as:
\[\text{euros}+\text{kilograms}\]unless they have been converted into the same objective scale.
Common Mistake: Forgetting Coefficients
If $x_j$ is measured in units, and profit is per unit, multiply them.
If:
\[x_j = \text{number of units}\]and:
\[p_j = \text{profit per unit}\]then contribution is:
\[p_jx_j\]not just:
\[x_j\]Linear vs Nonlinear Objectives
A linear objective allows:
\[c_1x_1+c_2x_2+\cdots+c_nx_n\]It does not allow:
\[x_1x_2\] \[x_1^2\] \[\sqrt{x_1}\] \[\frac{x_1}{x_2}\]Those would make the problem nonlinear.
Checklist
You understand objective functions if you can:
- identify whether the problem is max or min
- write the objective in terms of decision variables
- identify objective coefficients
- compute objective value at a point
- distinguish objective value from optimal value
- write a linear objective as $c^Tx$
- interpret contour lines
- explain the role of the cost vector
See Also
- Optimization Foundations
- Decision Variables
- Constraints
- Feasible Sets
- Optimal Solutions and Optimal Values
- Objective Contour Lines
- Cost Vector and Direction of Improvement
- Linear Programming
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.