Company X Problem

The Company X wants to know, How many products the company should make monthly. This company makes, tables, sofas and chairs. The requirements of each product is in the next Diagram:

  • The Company needs to pay $\$ 75000$ monthly, this includes, $1540$ hours of work ($\$ 48.70$ per hour).

  • Prices of each product:

    • Tables: $\$ 400$ per unit.
    • Sofas: $\$ 750$ per unit.
    • Chairs: $\$ 240$ per unit.

Variables

  • $X_{1}$ = Table
  • $X_{2}$ = Sofa
  • $X_{3}$ = Chair

Objective function

  • $z(max) = (400-100) X_{1} + (750-75-175) X_{2} + (240-40) X_{3} - 75000$
  • $z(max) = 300 X_{1} + 500 X_{2} + 200 X_{3} - 75000$

Constraints:

  • $C_1$(Wood): $10 X_{1} + 7.5 X_{2} + 4 X_{3} \leq 4350$
  • $C_2$(Cloth): $10 X_{2} \leq 2500$
  • $C_3$(Saw): $0.5 X_{1} + 0.4 X_{2} + 0.5 X_{3} \leq 280$
  • $C_4$(Cut Cloth): $0.4 X_{2} \leq 140$
  • $C_5$(Sand): $0.5 X_{1} + 0.1 X_{2} + 0.5 X_{3} \leq 280$
  • $C_6$(Inky): $0.4 X_{1} + 0.2 X_{2} + 0.4 X_{3} \leq 140$
  • $C_7$(Assembly): $1 X_{1} + 1.5 X_{2} + 0.5 X_{3} \leq 700$

Demand

  • $C_8$(Tables): $X_{1} \leq 300$
  • $C_9$(Sofas): $X_{2} \leq 180$
  • $C_{10}$(Chairs): $X_{3} \leq 400$

In [1]:
from scipy.optimize import linprog
import numpy as np

Objective Function


In [2]:
z = np.array([300,500,200])
expense = 75000

Constraints


In [3]:
C = np.array([
    [ 10, 7.5,   4],        #C1
    [  0,  10,   0],        #C2
    [0.5, 0.4, 0.5],        #C3
    [  0, 0.4,   0],        #C4
    [0.5, 0.1, 0.5],        #C5
    [0.4, 0.2, 0.4],        #C6
    [  1, 1.5, 0.5],        #C7
    [  1,   0,   0],        #C8
    [  0,   1,   0],        #C9
    [  0,   0,   1]         #C10
])

b = np.array([4350, 2500, 280, 140, 280, 140, 700, 300, 180, 400])

Bounds


In [4]:
x1 = (0, None)
x2 = (0, None)
x3 = (0, None)

Solution


In [5]:
sol = linprog(-z, A_ub = C, b_ub = b, bounds = (x1, x2, x3), method='simplex')

#Profit Monthly
profit = (sol.fun*-1) - expense

sol


Out[5]:
     fun: -168000.0
 message: 'Optimization terminated successfully.'
     nit: 2
   slack: array([400., 700.,  78.,  68., 132.,   0., 170.,  40.,   0., 400.])
  status: 0
 success: True
       x: array([260., 180.,   0.])

In [6]:
print(f"x1 = {sol.x[0]}, x2 = {sol.x[1]}, x3 = {sol.x[2]}, z = {profit}")


x1 = 260.0, x2 = 180.0, x3 = 0.0, z = 93000.0

The Company X should make monthly:

  • Tables: $260$ units.
  • Sofas: $180$ units.
  • Chairs: $0$ unit.

Profit: $\$ 93000$.