14.2 Objective Functions & Decision Variables

Your goal (or objective) in linear optimisation is to optimise an objective function. This will be in the form of maximising or minimising some quantity of interest, by choosing the values of \(X\), our Decision Variables.

Decision variables (\(X\)) are the variables that you get to pick. How many croissants to make? How many stocks of company A should I hold?

In the objective function, we choose \(X\) to maximize or minimize some quantity of interest. Some common examples are to choose \(X\) to:

  • maximise profits.
  • minimise costs / time spent
  • minimise risk exposure

Where profits, costs, time spent, risk, etc, are given by some model of the world, that you as an analyst have come up with.

I should note that we have already seen similar “optimization” in earlier chapters. For example, in Ordinary Least Squares Regression, we want to choose our regression coefficients (\(b_0\), \(b_1\), \(b_2\)…) to minimise the sum of squared errors. Or, we may want to choose model hyper parameters that maximises our model’s accuracy (e.g., on the Validation Set)

Here, the difference is that we often formulate the objective function in terms of a real-world quantity (i.e., relevant to a business context) that we want to maximise or minimise, by choosing our X’s.

Jean the Farmer: Objective Function

Let’s get introduced to Farmer Jean, who runs a small farm in a little valley12, who will be with us throughout this chapter.

Farmer Jean has two types of crops, Parsnips and Kale. 
Parsnips cost $0.20 per plot to grow, and sell for $0.35 per plot.
Kale cost $0.70 per plot to grow, and sell for $1.10 per plot.

She has 200 plots of land, and a $100 budget. 
How many of each crop should she plant to maximise her profits?

Here, the decision variables are quite straightforward. We are just choosing how many plots of parsnips and plots of kale to grow. Let’s call them \(X_1\) and \(X_2\) respectively.

Define:
  X_1 = number of plots of parsnips grown
  X_2 = number of plots of kale grown

The objective function is just maximising profits, which is the selling price - cost price, multiplied by how many of each crop she grows. So Profits \(= (0.35 - 0.20) X_1 + (1.10 - 0.70) X_2 = 0.15X_1 + 0.40X_2\)

Objective function: Maximize Profits = 0.15 X_1 + 0.40 X_2

  1. Sprites and the costs/profits of Parsnips and Kale are borrowed from Stardew Valley, and this example is an optimization problem that could actually arise in the game.↩︎