The Objective Function
What you'll learn: You'll learn what an objective function is and how to write and interpret it to represent real-world quantities you want to maximize or minimize.
What Is an Objective Function?
An objective function is a mathematical expression that represents the quantity you're trying to optimize—either maximize (make as large as possible) or minimize (make as small as possible). Think of it as your goal equation.
In real-world scenarios, you might want to:
- Maximize profit, revenue, nutrition, or production output
- Minimize cost, waste, time, or pollution
The objective function captures this goal mathematically using variables that represent the decisions you can make.
Structure of an Objective Function
The general form looks like:
P = ax + by (for two variables)
Where:
- P (or sometimes z, C, R) represents the quantity to optimize
- x and y are decision variables (things you control)
- a and b are coefficients showing how much each variable contributes
Example
A bakery makes cookies and brownies. Cookies earn 5 profit each. If x = number of cookies and y = number of brownies, the objective function for profit is:
P = 3x + 5y
This tells us: Total profit equals 5 times the brownies. You want to maximize P.
Writing Your Own
To write an objective function:
- Identify what you want to maximize or minimize
- Define your variables clearly
- Determine each variable's contribution (coefficient)
- Assemble the linear expression
Key Takeaway: The objective function is the formula representing the quantity you want to maximize or minimize, written in terms of the decision variables in your problem.