1D - Tom and Pie Eating

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Tom’s pie eating contest

an example of linear programming


and more
Tom’s pie eating contest
Example.
• Tom is in a pie eating contest that lasts 1 hour.
• Each torte that he eats takes 2 minutes.
• Each apple pie that he eats takes 3 minutes.
• He receives 4 points for each torte
• He receives 5 points for each pie.
• What should Tom eat so as to get the most
points?

2
Formulating as an optimization
problem

Step 1. Determine Tom’s decisions.


Represent his decisions as decision variables.

What are the decision variables

3
The decision variables
One set of decision variables
• Let x be the number of tortes that Tom eats
• Let y be the number of pies that Tom eats

Another possible set of decision variables


• Let v be the total time that Tom spends eating
tortes.
• Let w be the total time that Tom spends eating pies.
4
Step 2. Determine the objective function. Express it
in terms of the decision variables.

Number of Tortes

0 1 2 3

0 0 4 8 12
Number of Pies

1 5 9 13 17
2 10 14 18 22
3 15 19 23 27
Points for eating tortes and pies
5
The objective function
• x = number of tortes eaten
• y = number of pies eaten

Objective function
maximize 4x + 5y

This is called a linear function.

6
Constraints.
What limitations or restrictions are there on the
decision variables?
Max has only 60 minutes to eat pies and tortes.

Number of Tortes
0 10 20
Number of Pies

0 0 20 30
10 30 50 70
20 60 80 100

Minutes taken to eat pies and tortes


7
The constraints
• x = number of tortes eaten
• y = number of pies eaten

Constraint on time
2x + 3y ≤ 60 (minutes)

This is called a linear inequality.


8
The optimization problem, so far
• x = number of tortes eaten
• y = number of pies eaten

Maximize 4x + 5y
subject to 2x + 3y ≤ 60 (minutes)

9
The optimization problem, so far
• x = number of tortes eaten
• y = number of pies eaten

Maximize 4x + 5y
subject to 2x + 3y ≤ 60 (minutes)

x ≥ 0, y ≥ 0 Non-negativity constraints

x integer,
Integrality constraints.
y integer, 10
Tom’s pie eating contest:
LP terminology
and geometry
Linear programs

• x = number of tortes eaten


• y = number of pies eaten

Max 4x + 5y
s.t. 2x + 3y ≤ 60
x ≥ 0, y ≥ 0

The linear program

12
Terminology
Decision variables: e.g., x and y.
Constraints: e.g., 2x + 3y ≤ 60 , x ≥ 0 , y ≥ 0
Objective Function. e.g., maximize 4x + 5y
Feasible solution:
e.g., x = 0, y = 0
x = 10, y = 10.
Optimal solution: a feasible solution with the best
(max) objective value.

13
The feasible region(s)
20

2x + 3y ≤= 60
Pies

10

0
0 10 20 30
Tortes 14
Finding the optimal solution
20
Number of pies

10

0
0 10 20 30
Number of tortes 15
The unique optimal solution: x = 30; y = 0.
– For other problems there may be more than one
optimal solutions.
– It is also possible that the optimum value is
unbounded.

16

You might also like