-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFurniture Optimization.py
More file actions
91 lines (50 loc) · 1.7 KB
/
Furniture Optimization.py
File metadata and controls
91 lines (50 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python
# coding: utf-8
from IPython.display import Image
Image(filename = r"Veerman Example.PNG", width=875)
import pandas as pd
from pulp import *
# initialize problem
prob = LpProblem("Title",LpMaximize)
# Create Variables
C = LpVariable("Chair",0)
# Objective Function
# Objective Function
prob += , "Total Profit"
# Constraints
# Constraints
#Fabrication Constraint
prob += , "Fabrication Constraint"
# Assembly Constraint
# Shipping Constraint
# Demand Constraints
# Maximization so C >= 0, D >=0, T >= 0 is implicit
# Solve and Status
prob.solve()
print("Status:", LpStatus[prob.status])
# Objective Solve
print("Total Profit = ", value(prob.objective))
# Optimal Values
# Each of the variables is printed with it's resolved optimum value
for v in prob.variables():
print(v.name, "=", v.varValue)
# Shadow Prices and Slack
o = [{'name':name, 'shadow price':c.pi, 'slack': c.slack}
for name, c in prob.constraints.items()]
print(pd.DataFrame(o))
# Complete LP Problem Setup
print(prob)
# What Constraints are binding? <br>
# Increase fabrication to 1851, what happens to the objecctive value? <br>
#
# Is Assembly a binding constraint? <br>
# Increase Assembly to 2401, what happens to the objective value?
# So if we have a new product "Stool" and it takes: <br>
# - 3 hours fabrication <br>
# - 2 hours assembly <br>
# - 2 hours shipping <br>
# Is it profitable to make this new product? <br>
# Profit - Hours_Fabrication x Shadow_Price - Hours_Assembly x Shadow_Price - Hours_Shipping x Shadow_Price <br>
# 10 - 3 x (4) - 2 x (0) - 2 x (0) = -2 <br>
# <br>
# This is good for small changes, if other factors change, rerunning the problem is better <br>