Linear Programming With Python and PuLP - Part 3 - Ben Alex Keen
Linear Programming With Python and PuLP - Part 3 - Ben Alex Keen
Linear Programming With Python and PuLP - Part 3 - Ben Alex Keen
Resourcing Problem¶
We’re consulting for a boutique car manufacturer, producing luxury cars.
They run on one month (30 days) cycles, we have one cycle to show we can provide value.
There is one robot, 2 engineers and one detailer in the factory. The detailer has some holiday o , so only h
days available.
benalexkeen.com/linear-programming-with-python-and-pulp-part-3/ 1/4
3/9/2021 Linear Programming with Python and PuLP – Part 3 – Ben Alex Keen
At the moment, they produce 4 of each cars per month, for €300,000 pro t. Not bad at all, but we think w
do better for them.
Maximise
Subject to:
A ≥ 0
B ≥ 0
3A + 4B ≤ 30
5A + 6B ≤ 60
1.5A + 3B ≤ 21
In [1]:
import pulp
In [2]:
Unlike our previous problem, the decision variables in this case won’t be continuous (We can’t sell half a c
the category is integer.
In [3]:
benalexkeen.com/linear-programming-with-python-and-pulp-part-3/ 2/4
3/9/2021 Linear Programming with Python and PuLP – Part 3 – Ben Alex Keen
In [4]:
# Objective function
model += 30000 * A + 45000 * B, "Profit"
# Constraints
model += 3 * A + 4 * B <= 30
model += 5 * A + 6 * B <= 60
model += 1.5 * A + 3 * B <= 21
In [5]:
Out[5]:
'Optimal'
In [6]:
In [7]:
330000.0
benalexkeen.com/linear-programming-with-python-and-pulp-part-3/ 3/4
3/9/2021 Linear Programming with Python and PuLP – Part 3 – Ben Alex Keen
So that’s €330,000 monthly pro t, compared to their original monthly pro t of €300,000
By producing 2 cars of Car A and 4 cars of Car B, we bolster the pro ts at the factory by €30,000 per mon
We take our consultancy fee and leave the company with €360,000 extra pro t for the factory every year
Introduction
Part 1 – Introduction to Linear Programming
benalexkeen.com/linear-programming-with-python-and-pulp-part-3/ 4/4