Capacitated plant location - กรณีศึกษา P3

Supply Chain Analytics ด้วย Python

Aaren Stubberfield

Supply Chain Analytics Mgr.

โมเดลการหาที่ตั้งโรงงานแบบมีขีดจำกัด

การสร้างโมเดล

  • การผลิตในโรงงานระดับภูมิภาค
    • โรงงาน 2 ขนาด (ต่ำ / สูง)
  • การส่งออกสินค้าไปยังภูมิภาคอื่น
  • โรงงานผลิตเปิด / ปิด

ภาพลูกโลกพร้อมการผลิตระดับภูมิภาค

Supply Chain Analytics ด้วย Python

ช่วงค่าที่คาดหวัง

ค่าของตัวแปรการตัดสินใจควรอยู่ในช่วงใด?

ปริมาณการผลิต:

  • ผลิตสูงในภูมิภาคที่มีต้นทุนการผลิตและขนส่งต่ำ
  • ผลิตเต็มกำลังในภูมิภาคที่มีต้นทุนคงที่ค่อนข้างต่ำด้วย

โรงงานผลิต เปิด หรือ ปิด:

  • โรงงานกำลังสูงในภูมิภาคที่มีความต้องการสูง
  • โรงงานกำลังสูงในภูมิภาคที่มีต้นทุนคงที่ค่อนข้างต่ำ
Supply Chain Analytics ด้วย Python

การวิเคราะห์ความไวของข้อจำกัด

ปริมาณผลิตรวม = ความต้องการรวม:

  • shadow prices = การเปลี่ยนแปลงต้นทุนรวมต่อความต้องการที่เพิ่มขึ้นในแต่ละภูมิภาค
  • slack = ควรมีค่าเป็นศูนย์

ปริมาณผลิตรวม ≤ กำลังการผลิตรวม:

  • shadow prices = การเปลี่ยนแปลงต้นทุนรวมต่อกำลังการผลิตที่เพิ่มขึ้น
  • slack = ภูมิภาคที่มีกำลังการผลิตเหลือ
Supply Chain Analytics ด้วย Python
from pulp import *
import pandas as pd

# Initialize Class
model = 
    LpProblem("Capacitated Plant Location Model",
               LpMinimize)

# Define Decision Variables
loc = ['A', 'B', 'C', 'D', 'E']
size = ['Low_Cap','High_Cap']
x = LpVariable.dicts(
                "production_", 
                [(i,j) for i in loc for j in loc],
                 lowBound=0, upBound=None, 
                 cat='Continuous')

y = LpVariable.dicts(
               "plant_", 
               [(i,s) for s in size for i in loc], 
                cat='Binary')
# Define Objective Function
model += 
  (lpSum([fix_cost.loc[i,s]*y[(i,s)] 
          for s in size for i in loc])
 + lpSum([var_cost.loc[i,j]*x[(i,j)] 
          for i in loc for j in loc]))

# Define the Constraints
for j in loc: model += 
  lpSum([x[(i, j)] 
        for i in loc]) == demand.loc[j,'Dmd']
for i in loc: model += 
  lpSum([x[(i, j)] for j in loc]) <= lpSum(
             [cap.loc[i,s]*y[(i,s)]for s in size])
Supply Chain Analytics ด้วย Python
# Solve
model.solve()

# Print Decision Variables and Objective Value print(LpStatus[model.status]) o = [{'prod':"{} to {}".format(i,j), 'quant':x[(i,j)].varValue} for i in loc for j in loc] print(pd.DataFrame(o)) o = [{'loc':i, 'lc':y[(i,size[0])].varValue, 'hc':y[(i,size[1])].varValue} for i in loc] print(pd.DataFrame(o)) print("Objective = ", value(model.objective))
# Print Shadow Price and Slack o = [{'name':name, 'shadow price':c.pi, 'slack': c.slack} for name, c in model.constraints.items()] print(pd.DataFrame(o))
Supply Chain Analytics ด้วย Python

คำถามทางธุรกิจ

คำถามที่มักพบ:

  • ต้นทุนโดยรวมของโมเดลเครือข่าย supply chain นี้คือเท่าใด?

  • หากความต้องการในภูมิภาคหนึ่งเพิ่มขึ้น ต้องมีกำไรเท่าใดเพื่อครอบคลุมต้นทุนการผลิตและขนส่งไปยังภูมิภาคนั้น?

  • ภูมิภาคใดยังมีกำลังการผลิตเหลือสำหรับความต้องการในอนาคต?

Supply Chain Analytics ด้วย Python

สรุป

ทบทวนสิ่งที่เรียนไป:

  • ช่วงค่าที่คาดหวังของตัวแปรการตัดสินใจ
  • การตีความผลลัพธ์ของการวิเคราะห์ความไว (shadow prices และ slack)
  • โค้ดสำหรับแก้โจทย์และแสดงผลลัพธ์
  • คำถามทางธุรกิจที่มักพบ
Supply Chain Analytics ด้วย Python

เยี่ยมมาก! ถึงคิวคุณแล้ว

Supply Chain Analytics ด้วย Python

Preparing Video For Download...