Problem: Maximizing Car Sales Profits Using PuLP

Learn how to solve a car-selling problem in linear programming to maximize profits, given a set of constraints.

In this lesson, we will demonstrate the power of the PuLP library by using it to solve a real-life problem. Let’s consider a car manufacturing system where the manufacturer wants to maximize their profits. The following points summarize the problem:

  • We have two models of a car: Car A and Car B.
  • Car A gives us a profit of $20k while Car B gives us a profit of $45k.
  • The designer takes 4 days to build Car A and 5 days to build Car B.
  • The engineer takes 3 days to build Car A and 6 days to build Car B.
  • The machine takes 2 days to build Car A and 7 days to build Car B.
  • The designer, engineer, and machine can all work for 30 days.

We need to maximize the profits. The first point gives us our decision variables while the remaining points give us the objective function, which we need to maximize.

The objective function is the following:

20,000 A + 45,000 B

The constraints are below:

A,B0A, B \ge 0

4A+5B304A + 5B \le 30

3A+6B303A + 6B \le 30

2A+7B302A + 7B \le 30

One way to solve it is to plot the inequalities on a graph, find the feasible area, and then plug in the value of the vertices or the points of intersection. This is shown in the figure below:

Get hands-on with 1200+ tech skills courses.