Class exercise: Furniture manufacturing#
Added in version v2024.1.0: After class February 19th
Solutions in text and downloads
A furniture manufacturing company wishes to determine how many tables, chairs, desks and bookcases it should make to optimize its profit.
These products utilize two different types of lumber, the company has on hand:
1500 m of type 1
1000 m of type 2.
There are 800 labour-hours available for the job.
Sales forecasts plus back orders require the company to make at least:
40 tables
130 chair
30 desk
no more than 10 bookcases.
Each table, chair, desk, and bookcase requires:
of lumber type 1: 5, 1, 9, and 12 m, respectively
of lumber type 2: 2, 3, 4, and 1 m, respectively.
A table requires 3 labour-hours to make, a chair 2 hours, a desk 5 hours, and a bookcase 3 hours.
The company makes a total of profit:
€12 on a table
€5 on a chair
€15 on a desk
€10 on a bookcase.
Exercise 24 (Model)
Write out the linear programming model of this problem.
Solution to Exercise 24 (Model)
Exercise 25 (Method)
Now let’s solve this problem using an optimization method.
Click –> Live Code to activate live coding on this page!
import scipy as sp
import numpy as np
#YOUR CODE HERE
Solution to Exercise 25 (Method)
import scipy as sp
import numpy as np
c = np.array([-12, -5, -15, -10])
A_ub = np.array([[5, 1, 9, 12],
[2, 3, 4, 1 ],
[3, 2, 5, 3]])
b_ub = np.array([1500, 1000, 800])
bounds = np.array([[40, None],
[130, None],
[30, None],
[0, 10]])
result = sp.optimize.linprog(c, A_ub=A_ub, b_ub=b_ub, A_eq=None, b_eq=None, bounds=bounds)
print(result.x)
print(result.fun)
[130. 130. 30. 0.]
-2660.0
The optimal solution is:
130 tables
130 chairs
30 desk
0 bookcases
With a profit of €2660
Exercise 26 (Additional exercise)
What happens if you impose that four chairs should be made for every table?
#YOUR CODE HERE
Solution to Exercise 26 (Additional exercise)
A_eq = np.array([[4,-1,0,0]])
b_eq = np.array([0])
result = sp.optimize.linprog(c, A_ub=A_ub, b_ub=b_ub, A_eq=A_eq, b_eq=b_eq, bounds=bounds)
print(result.x)
print(result.fun)
[ 40. 160. 66. 10.]
-2370.0
A different solution is found with a lower profit:
40 tables
160 chairs
66 desk
10 bookcases
With a profit of €2370