capacity-planning
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCapacity Planning
产能规划
You are an expert in capacity planning and resource optimization. Your goal is to help organizations match capacity with demand, optimize resource utilization, identify bottlenecks, and make cost-effective capacity investment decisions.
您是产能规划与资源优化领域的专家。您的目标是帮助企业匹配产能与需求、优化资源利用率、识别瓶颈,并做出高性价比的产能投资决策。
Initial Assessment
初始评估
Before developing capacity plans, understand:
-
Planning Context
- What type of capacity? (production, warehouse, transportation, labor)
- Planning horizon? (short-term loading, tactical planning, strategic investment)
- Current capacity utilization rates?
- Known capacity constraints or bottlenecks?
-
Demand Profile
- Demand forecast and variability?
- Seasonality patterns?
- Growth expectations?
- Product mix changes expected?
-
Current State
- Existing capacity levels?
- Equipment, facilities, headcount?
- Operating schedules (shifts, days/week)?
- Current performance (OEE, yield, throughput)?
-
Constraints & Requirements
- Service level targets?
- Budget constraints for expansion?
- Lead times for capacity additions?
- Union agreements or labor rules?
- Regulatory requirements?
制定产能计划前,需了解以下内容:
-
规划背景
- 涉及哪类产能?(生产、仓储、运输、人力)
- 规划周期?(短期负载、战术规划、战略投资)
- 当前产能利用率?
- 已知的产能限制或瓶颈?
-
需求概况
- 需求预测及波动情况?
- 季节性规律?
- 增长预期?
- 产品组合是否有预期变化?
-
当前状态
- 现有产能水平?
- 设备、设施、员工数量?
- 运营排班(班次、每周工作天数)?
- 当前绩效(OEE、良率、吞吐量)?
-
限制条件与要求
- 服务水平目标?
- 产能扩张的预算限制?
- 新增产能的交付周期?
- 工会协议或用工规则?
- 合规要求?
Capacity Planning Framework
产能规划框架
Types of Capacity Planning
产能规划类型
1. Long-Term Strategic Capacity Planning
- Horizon: 2-5+ years
- Focus: Major investments, facility additions
- Decisions: Build new plant? Add warehouse? Outsource?
- Approach: Scenario analysis, economic modeling
2. Medium-Term Tactical Capacity Planning
- Horizon: 3-18 months
- Focus: Adjust workforce, add equipment, modify schedules
- Decisions: Hire staff? Add shift? Lease equipment?
- Approach: Aggregate planning, linear programming
3. Short-Term Operational Capacity Planning
- Horizon: Days to weeks
- Focus: Load balancing, scheduling, overtime
- Decisions: How to allocate work? Overtime? Outsource batch?
- Approach: Scheduling algorithms, queuing theory
1. 长期战略产能规划
- 周期:2-5年及以上
- 重点:重大投资、新增设施
- 决策内容:新建工厂?新增仓库?外包?
- 方法:场景分析、经济建模
2. 中期战术产能规划
- 周期:3-18个月
- 重点:调整人员规模、新增设备、修改排班
- 决策内容:招聘员工?新增班次?租赁设备?
- 方法:综合规划、线性规划
3. 短期运营产能规划
- 周期:数天至数周
- 重点:负载均衡、排班、加班安排
- 决策内容:如何分配工作?是否安排加班?外包批次生产?
- 方法:调度算法、排队论
Capacity Strategies
产能策略
Leading Strategy
- Add capacity in anticipation of demand
- Ensures availability, avoids stockouts
- Higher costs, risk of underutilization
- Best for: Growing markets, high service requirements
Lagging Strategy
- Add capacity only after demand materializes
- Lower costs, minimizes waste
- Risk of lost sales, poor service
- Best for: Uncertain demand, cost-sensitive markets
Matching Strategy
- Closely match capacity to demand
- Balance of cost and service
- Requires flexible capacity options
- Best for: Moderate growth, predictable demand
Cushion Strategy
- Maintain buffer capacity above expected demand
- Handles variability and surges
- Higher fixed costs but operational flexibility
- Best for: High variability, premium service
领先策略
- 提前新增产能以应对预期需求
- 确保产能可用,避免缺货
- 成本较高,存在利用率不足风险
- 适用场景:增长型市场、高服务要求
滞后策略
- 仅在需求实际出现后才新增产能
- 成本较低,浪费最小化
- 存在销售额损失、服务质量下降风险
- 适用场景:需求不确定、成本敏感型市场
匹配策略
- 使产能与需求紧密匹配
- 在成本与服务之间取得平衡
- 需要灵活的产能选项
- 适用场景:温和增长、需求可预测
缓冲策略
- 维持高于预期需求的缓冲产能
- 应对需求波动与峰值
- 固定成本较高,但具备运营灵活性
- 适用场景:高波动需求、高端服务
Capacity Analysis Methods
产能分析方法
Capacity Measurement
产能计量
Production Capacity Metrics:
1. Design Capacity
- Maximum possible output under ideal conditions
- Theoretical maximum
2. Effective Capacity
- Capacity under normal working conditions
- Accounts for breaks, maintenance, changeovers
3. Actual Output
- What's currently achieved
- Reality of operations
Key Formulas:
python
def calculate_capacity_metrics(design_capacity, effective_capacity, actual_output):
"""
Calculate capacity utilization and efficiency
Returns:
- utilization: actual / design capacity
- efficiency: actual / effective capacity
"""
utilization = (actual_output / design_capacity) * 100
efficiency = (actual_output / effective_capacity) * 100
return {
'utilization': utilization,
'efficiency': efficiency,
'design_capacity': design_capacity,
'effective_capacity': effective_capacity,
'actual_output': actual_output
}生产产能指标:
1. 设计产能
- 理想条件下的最大可能产出
- 理论最大值
2. 有效产能
- 正常工作条件下的产能
- 考虑休息、维护、换产等因素
3. 实际产出
- 当前实际达成的产出
- 运营实际情况
核心公式:
python
def calculate_capacity_metrics(design_capacity, effective_capacity, actual_output):
"""
Calculate capacity utilization and efficiency
Returns:
- utilization: actual / design capacity
- efficiency: actual / effective capacity
"""
utilization = (actual_output / design_capacity) * 100
efficiency = (actual_output / effective_capacity) * 100
return {
'utilization': utilization,
'efficiency': efficiency,
'design_capacity': design_capacity,
'effective_capacity': effective_capacity,
'actual_output': actual_output
}Example
Example
design = 10000 # units per month
effective = 8500 # accounting for maintenance, breaks
actual = 7500 # what's produced
metrics = calculate_capacity_metrics(design, effective, actual)
print(f"Utilization: {metrics['utilization']:.1f}%") # 75%
print(f"Efficiency: {metrics['efficiency']:.1f}%") # 88.2%
**Overall Equipment Effectiveness (OEE):**
```python
def calculate_oee(availability, performance, quality):
"""
Calculate OEE (Overall Equipment Effectiveness)
Parameters:
- availability: uptime / planned production time
- performance: actual output / theoretical output at 100% speed
- quality: good units / total units produced
World-class OEE: > 85%
"""
oee = availability * performance * quality * 100
return {
'oee': oee,
'availability': availability * 100,
'performance': performance * 100,
'quality': quality * 100
}design = 10000 # units per month
effective = 8500 # accounting for maintenance, breaks
actual = 7500 # what's produced
metrics = calculate_capacity_metrics(design, effective, actual)
print(f"Utilization: {metrics['utilization']:.1f}%") # 75%
print(f"Efficiency: {metrics['efficiency']:.1f}%") # 88.2%
**设备综合效率(OEE):**
```python
def calculate_oee(availability, performance, quality):
"""
Calculate OEE (Overall Equipment Effectiveness)
Parameters:
- availability: uptime / planned production time
- performance: actual output / theoretical output at 100% speed
- quality: good units / total units produced
World-class OEE: > 85%
"""
oee = availability * performance * quality * 100
return {
'oee': oee,
'availability': availability * 100,
'performance': performance * 100,
'quality': quality * 100
}Example
Example
availability = 0.90 # 90% uptime
performance = 0.85 # 85% of theoretical speed
quality = 0.95 # 95% good units
oee_metrics = calculate_oee(availability, performance, quality)
print(f"OEE: {oee_metrics['oee']:.1f}%") # 72.7%
undefinedavailability = 0.90 # 90% uptime
performance = 0.85 # 85% of theoretical speed
quality = 0.95 # 95% good units
oee_metrics = calculate_oee(availability, performance, quality)
print(f"OEE: {oee_metrics['oee']:.1f}%") # 72.7%
undefinedBottleneck Analysis
瓶颈分析
Theory of Constraints (TOC):
python
import pandas as pd
import numpy as np
def identify_bottleneck(process_steps):
"""
Identify bottleneck in production process
Parameters:
- process_steps: list of dicts with 'name', 'capacity_per_hour', 'hours_available'
Returns bottleneck step and throughput
"""
df = pd.DataFrame(process_steps)
# Calculate total capacity per period
df['total_capacity'] = df['capacity_per_hour'] * df['hours_available']
# Identify bottleneck (minimum capacity)
bottleneck_idx = df['total_capacity'].idxmin()
bottleneck = df.loc[bottleneck_idx]
# System throughput limited by bottleneck
system_throughput = bottleneck['total_capacity']
# Calculate utilization based on bottleneck
df['utilization'] = (system_throughput / df['total_capacity']) * 100
return {
'bottleneck_step': bottleneck['name'],
'system_throughput': system_throughput,
'bottleneck_capacity': bottleneck['total_capacity'],
'process_analysis': df
}约束理论(TOC):
python
import pandas as pd
import numpy as np
def identify_bottleneck(process_steps):
"""
Identify bottleneck in production process
Parameters:
- process_steps: list of dicts with 'name', 'capacity_per_hour', 'hours_available'
Returns bottleneck step and throughput
"""
df = pd.DataFrame(process_steps)
# Calculate total capacity per period
df['total_capacity'] = df['capacity_per_hour'] * df['hours_available']
# Identify bottleneck (minimum capacity)
bottleneck_idx = df['total_capacity'].idxmin()
bottleneck = df.loc[bottleneck_idx]
# System throughput limited by bottleneck
system_throughput = bottleneck['total_capacity']
# Calculate utilization based on bottleneck
df['utilization'] = (system_throughput / df['total_capacity']) * 100
return {
'bottleneck_step': bottleneck['name'],
'system_throughput': system_throughput,
'bottleneck_capacity': bottleneck['total_capacity'],
'process_analysis': df
}Example: Manufacturing process
Example: Manufacturing process
process = [
{'name': 'Cutting', 'capacity_per_hour': 100, 'hours_available': 160},
{'name': 'Assembly', 'capacity_per_hour': 80, 'hours_available': 160},
{'name': 'Testing', 'capacity_per_hour': 120, 'hours_available': 160},
{'name': 'Packaging', 'capacity_per_hour': 90, 'hours_available': 160}
]
bottleneck_analysis = identify_bottleneck(process)
print(f"Bottleneck: {bottleneck_analysis['bottleneck_step']}")
print(f"System Throughput: {bottleneck_analysis['system_throughput']:,.0f} units/month")
print("\nProcess Analysis:")
print(bottleneck_analysis['process_analysis'])
**Drum-Buffer-Rope (DBR) Scheduling:**
```python
class DrumBufferRope:
"""
Theory of Constraints scheduling method
- Drum: Bottleneck sets the pace
- Buffer: Protect bottleneck from disruptions
- Rope: Pull mechanism to control material release
"""
def __init__(self, bottleneck_capacity, buffer_time_days=3):
self.bottleneck_capacity = bottleneck_capacity
self.buffer_time = buffer_time_days
def calculate_schedule(self, demand, lead_times):
"""
Create production schedule based on DBR
Parameters:
- demand: array of daily demand
- lead_times: dict of process step lead times
"""
schedule = []
for day, daily_demand in enumerate(demand):
# Bottleneck sets the pace (DRUM)
bottleneck_output = min(daily_demand, self.bottleneck_capacity)
# Buffer: Start production earlier to protect bottleneck
buffer_start_day = max(0, day - self.buffer_time)
# Rope: Material release tied to bottleneck schedule
material_release = bottleneck_output
schedule.append({
'day': day,
'demand': daily_demand,
'bottleneck_output': bottleneck_output,
'buffer_start': buffer_start_day,
'material_release': material_release
})
return pd.DataFrame(schedule)process = [
{'name': 'Cutting', 'capacity_per_hour': 100, 'hours_available': 160},
{'name': 'Assembly', 'capacity_per_hour': 80, 'hours_available': 160},
{'name': 'Testing', 'capacity_per_hour': 120, 'hours_available': 160},
{'name': 'Packaging', 'capacity_per_hour': 90, 'hours_available': 160}
]
bottleneck_analysis = identify_bottleneck(process)
print(f"Bottleneck: {bottleneck_analysis['bottleneck_step']}")
print(f"System Throughput: {bottleneck_analysis['system_throughput']:,.0f} units/month")
print("\nProcess Analysis:")
print(bottleneck_analysis['process_analysis'])
**鼓-缓冲-绳(DBR)调度:**
```python
class DrumBufferRope:
"""
Theory of Constraints scheduling method
- Drum: Bottleneck sets the pace
- Buffer: Protect bottleneck from disruptions
- Rope: Pull mechanism to control material release
"""
def __init__(self, bottleneck_capacity, buffer_time_days=3):
self.bottleneck_capacity = bottleneck_capacity
self.buffer_time = buffer_time_days
def calculate_schedule(self, demand, lead_times):
"""
Create production schedule based on DBR
Parameters:
- demand: array of daily demand
- lead_times: dict of process step lead times
"""
schedule = []
for day, daily_demand in enumerate(demand):
# Bottleneck sets the pace (DRUM)
bottleneck_output = min(daily_demand, self.bottleneck_capacity)
# Buffer: Start production earlier to protect bottleneck
buffer_start_day = max(0, day - self.buffer_time)
# Rope: Material release tied to bottleneck schedule
material_release = bottleneck_output
schedule.append({
'day': day,
'demand': daily_demand,
'bottleneck_output': bottleneck_output,
'buffer_start': buffer_start_day,
'material_release': material_release
})
return pd.DataFrame(schedule)Example usage
Example usage
dbr = DrumBufferRope(bottleneck_capacity=800, buffer_time_days=3)
dbr = DrumBufferRope(bottleneck_capacity=800, buffer_time_days=3)
Daily demand for next 10 days
Daily demand for next 10 days
demand = np.array([750, 850, 800, 900, 700, 800, 950, 800, 850, 800])
lead_times = {'cutting': 1, 'assembly': 2, 'testing': 1}
schedule = dbr.calculate_schedule(demand, lead_times)
print(schedule)
---demand = np.array([750, 850, 800, 900, 700, 800, 950, 800, 850, 800])
lead_times = {'cutting': 1, 'assembly': 2, 'testing': 1}
schedule = dbr.calculate_schedule(demand, lead_times)
print(schedule)
---Capacity Planning Models
产能规划模型
Aggregate Planning (Linear Programming)
综合规划(线性规划)
Objective: Minimize total costs while meeting demand
Decision Variables:
- Production quantity per period
- Workforce levels
- Overtime hours
- Inventory levels
- Subcontracting quantities
Costs:
- Regular time production
- Overtime production
- Hiring and firing
- Inventory holding
- Stockout/backorder
- Subcontracting
python
from pulp import *
import pandas as pd
import numpy as np
def aggregate_planning(demand, costs, constraints, periods=12):
"""
Aggregate production planning optimization
Parameters:
- demand: array of demand by period
- costs: dict with cost parameters
- constraints: dict with capacity constraints
- periods: planning horizon
Returns optimal plan
"""
# Create problem
prob = LpProblem("Aggregate_Planning", LpMinimize)
# Decision variables
P = LpVariable.dicts("Production", range(periods), lowBound=0)
W = LpVariable.dicts("Workforce", range(periods), lowBound=0, cat='Integer')
O = LpVariable.dicts("Overtime", range(periods), lowBound=0)
I = LpVariable.dicts("Inventory", range(periods), lowBound=0)
H = LpVariable.dicts("Hire", range(periods), lowBound=0, cat='Integer')
F = LpVariable.dicts("Fire", range(periods), lowBound=0, cat='Integer')
B = LpVariable.dicts("Backorder", range(periods), lowBound=0)
S = LpVariable.dicts("Subcontract", range(periods), lowBound=0)
# Objective function
prob += lpSum([
# Regular production cost
costs['regular_cost'] * P[t] +
# Workforce cost
costs['labor_cost'] * W[t] +
# Overtime cost
costs['overtime_cost'] * O[t] +
# Inventory holding cost
costs['holding_cost'] * I[t] +
# Hiring cost
costs['hiring_cost'] * H[t] +
# Firing cost
costs['firing_cost'] * F[t] +
# Backorder cost
costs['backorder_cost'] * B[t] +
# Subcontracting cost
costs['subcontract_cost'] * S[t]
for t in range(periods)
])
# Constraints
# Initial conditions
initial_workforce = constraints['initial_workforce']
initial_inventory = constraints['initial_inventory']
for t in range(periods):
# Production capacity constraint
prob += P[t] <= W[t] * constraints['units_per_worker'], f"Capacity_{t}"
# Overtime capacity
prob += O[t] <= W[t] * constraints['overtime_per_worker'], f"Overtime_{t}"
# Subcontracting capacity
prob += S[t] <= constraints['max_subcontract'], f"Subcontract_{t}"
# Workforce balance
if t == 0:
prob += W[t] == initial_workforce + H[t] - F[t], f"Workforce_{t}"
else:
prob += W[t] == W[t-1] + H[t] - F[t], f"Workforce_{t}"
# Inventory balance
if t == 0:
prob += I[t] == initial_inventory + P[t] + O[t] + S[t] - demand[t] + B[t], f"Inventory_{t}"
else:
prob += I[t] == I[t-1] + P[t] + O[t] + S[t] - demand[t] + B[t] - B[t-1], f"Inventory_{t}"
# Minimum service level (max backorder)
prob += B[t] <= demand[t] * constraints['max_backorder_pct'], f"Service_{t}"
# Solve
prob.solve(PULP_CBC_CMD(msg=0))
# Extract results
results = {
'status': LpStatus[prob.status],
'total_cost': value(prob.objective),
'production': [P[t].varValue for t in range(periods)],
'workforce': [W[t].varValue for t in range(periods)],
'overtime': [O[t].varValue for t in range(periods)],
'inventory': [I[t].varValue for t in range(periods)],
'hired': [H[t].varValue for t in range(periods)],
'fired': [F[t].varValue for t in range(periods)],
'backorders': [B[t].varValue for t in range(periods)],
'subcontract': [S[t].varValue for t in range(periods)]
}
# Create summary DataFrame
df = pd.DataFrame({
'Period': range(1, periods + 1),
'Demand': demand,
'Production': results['production'],
'Workforce': results['workforce'],
'Overtime': results['overtime'],
'Inventory': results['inventory'],
'Backorders': results['backorders'],
'Subcontract': results['subcontract']
})
results['summary'] = df
return results目标: 在满足需求的同时最小化总成本
决策变量:
- 每期生产数量
- 员工规模
- 加班时长
- 库存水平
- 外包数量
成本项:
- 常规生产时间成本
- 加班生产成本
- 招聘与解雇成本
- 库存持有成本
- 缺货/延期交货成本
- 外包成本
python
from pulp import *
import pandas as pd
import numpy as np
def aggregate_planning(demand, costs, constraints, periods=12):
"""
Aggregate production planning optimization
Parameters:
- demand: array of demand by period
- costs: dict with cost parameters
- constraints: dict with capacity constraints
- periods: planning horizon
Returns optimal plan
"""
# Create problem
prob = LpProblem("Aggregate_Planning", LpMinimize)
# Decision variables
P = LpVariable.dicts("Production", range(periods), lowBound=0)
W = LpVariable.dicts("Workforce", range(periods), lowBound=0, cat='Integer')
O = LpVariable.dicts("Overtime", range(periods), lowBound=0)
I = LpVariable.dicts("Inventory", range(periods), lowBound=0)
H = LpVariable.dicts("Hire", range(periods), lowBound=0, cat='Integer')
F = LpVariable.dicts("Fire", range(periods), lowBound=0, cat='Integer')
B = LpVariable.dicts("Backorder", range(periods), lowBound=0)
S = LpVariable.dicts("Subcontract", range(periods), lowBound=0)
# Objective function
prob += lpSum([
# Regular production cost
costs['regular_cost'] * P[t] +
# Workforce cost
costs['labor_cost'] * W[t] +
# Overtime cost
costs['overtime_cost'] * O[t] +
# Inventory holding cost
costs['holding_cost'] * I[t] +
# Hiring cost
costs['hiring_cost'] * H[t] +
# Firing cost
costs['firing_cost'] * F[t] +
# Backorder cost
costs['backorder_cost'] * B[t] +
# Subcontracting cost
costs['subcontract_cost'] * S[t]
for t in range(periods)
])
# Constraints
# Initial conditions
initial_workforce = constraints['initial_workforce']
initial_inventory = constraints['initial_inventory']
for t in range(periods):
# Production capacity constraint
prob += P[t] <= W[t] * constraints['units_per_worker'], f"Capacity_{t}"
# Overtime capacity
prob += O[t] <= W[t] * constraints['overtime_per_worker'], f"Overtime_{t}"
# Subcontracting capacity
prob += S[t] <= constraints['max_subcontract'], f"Subcontract_{t}"
# Workforce balance
if t == 0:
prob += W[t] == initial_workforce + H[t] - F[t], f"Workforce_{t}"
else:
prob += W[t] == W[t-1] + H[t] - F[t], f"Workforce_{t}"
# Inventory balance
if t == 0:
prob += I[t] == initial_inventory + P[t] + O[t] + S[t] - demand[t] + B[t], f"Inventory_{t}"
else:
prob += I[t] == I[t-1] + P[t] + O[t] + S[t] - demand[t] + B[t] - B[t-1], f"Inventory_{t}"
# Minimum service level (max backorder)
prob += B[t] <= demand[t] * constraints['max_backorder_pct'], f"Service_{t}"
# Solve
prob.solve(PULP_CBC_CMD(msg=0))
# Extract results
results = {
'status': LpStatus[prob.status],
'total_cost': value(prob.objective),
'production': [P[t].varValue for t in range(periods)],
'workforce': [W[t].varValue for t in range(periods)],
'overtime': [O[t].varValue for t in range(periods)],
'inventory': [I[t].varValue for t in range(periods)],
'hired': [H[t].varValue for t in range(periods)],
'fired': [F[t].varValue for t in range(periods)],
'backorders': [B[t].varValue for t in range(periods)],
'subcontract': [S[t].varValue for t in range(periods)]
}
# Create summary DataFrame
df = pd.DataFrame({
'Period': range(1, periods + 1),
'Demand': demand,
'Production': results['production'],
'Workforce': results['workforce'],
'Overtime': results['overtime'],
'Inventory': results['inventory'],
'Backorders': results['backorders'],
'Subcontract': results['subcontract']
})
results['summary'] = df
return resultsExample usage
Example usage
demand = np.array([1000, 1200, 1500, 1800, 2000, 1800,
1600, 1400, 1300, 1200, 1100, 1000])
costs = {
'regular_cost': 50,
'labor_cost': 2000, # per worker per period
'overtime_cost': 75,
'holding_cost': 5,
'hiring_cost': 1000,
'firing_cost': 1500,
'backorder_cost': 100,
'subcontract_cost': 80
}
constraints = {
'initial_workforce': 40,
'initial_inventory': 500,
'units_per_worker': 30,
'overtime_per_worker': 10,
'max_subcontract': 500,
'max_backorder_pct': 0.10
}
plan = aggregate_planning(demand, costs, constraints)
print(f"Optimal Total Cost: ${plan['total_cost']:,.0f}")
print("\nProduction Plan:")
print(plan['summary'])
undefineddemand = np.array([1000, 1200, 1500, 1800, 2000, 1800,
1600, 1400, 1300, 1200, 1100, 1000])
costs = {
'regular_cost': 50,
'labor_cost': 2000, # per worker per period
'overtime_cost': 75,
'holding_cost': 5,
'hiring_cost': 1000,
'firing_cost': 1500,
'backorder_cost': 100,
'subcontract_cost': 80
}
constraints = {
'initial_workforce': 40,
'initial_inventory': 500,
'units_per_worker': 30,
'overtime_per_worker': 10,
'max_subcontract': 500,
'max_backorder_pct': 0.10
}
plan = aggregate_planning(demand, costs, constraints)
print(f"Optimal Total Cost: ${plan['total_cost']:,.0f}")
print("\nProduction Plan:")
print(plan['summary'])
undefinedCapacity Requirements Planning (CRP)
产能需求规划(CRP)
Process:
- Start with Master Production Schedule (MPS)
- Explode to component requirements (BOM)
- Calculate work center loads
- Identify overload/underload periods
- Adjust capacity or schedule
python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
class CapacityRequirementsPlanning:
"""
CRP - Calculate and analyze capacity requirements
based on production schedule and routings
"""
def __init__(self, work_centers):
"""
Parameters:
- work_centers: dict {name: {'capacity': hours, 'efficiency': 0-1}}
"""
self.work_centers = work_centers
def calculate_requirements(self, schedule, routings):
"""
Calculate capacity requirements
Parameters:
- schedule: DataFrame with 'product', 'period', 'quantity'
- routings: dict {product: [(work_center, hours_per_unit)]}
Returns DataFrame with requirements by work center and period
"""
requirements = []
for idx, row in schedule.iterrows():
product = row['product']
period = row['period']
quantity = row['quantity']
# Get routing for product
routing = routings.get(product, [])
for work_center, hours_per_unit in routing:
total_hours = quantity * hours_per_unit
# Adjust for efficiency
efficiency = self.work_centers[work_center]['efficiency']
required_hours = total_hours / efficiency
requirements.append({
'period': period,
'work_center': work_center,
'product': product,
'quantity': quantity,
'hours_required': required_hours
})
df = pd.DataFrame(requirements)
# Aggregate by work center and period
summary = df.groupby(['period', 'work_center'])['hours_required'].sum().reset_index()
# Add capacity and utilization
summary['capacity'] = summary['work_center'].map(
lambda wc: self.work_centers[wc]['capacity']
)
summary['utilization'] = (summary['hours_required'] / summary['capacity']) * 100
summary['variance'] = summary['capacity'] - summary['hours_required']
return summary
def identify_overloads(self, requirements, threshold=100):
"""
Identify periods/work centers with overload
Parameters:
- requirements: output from calculate_requirements
- threshold: utilization % threshold
Returns overloaded resources
"""
overloads = requirements[requirements['utilization'] > threshold].copy()
overloads = overloads.sort_values(['period', 'work_center'])
return overloads
def plot_capacity_profile(self, requirements):
"""Visualize capacity requirements vs. available"""
work_centers = requirements['work_center'].unique()
fig, axes = plt.subplots(len(work_centers), 1,
figsize=(12, 4 * len(work_centers)),
squeeze=False)
for i, wc in enumerate(work_centers):
wc_data = requirements[requirements['work_center'] == wc]
ax = axes[i, 0]
# Plot capacity line
ax.axhline(y=wc_data['capacity'].iloc[0],
color='green', linestyle='--',
linewidth=2, label='Capacity')
# Plot requirements
ax.bar(wc_data['period'], wc_data['hours_required'],
alpha=0.7, label='Required')
# Highlight overloads
overload = wc_data[wc_data['utilization'] > 100]
if not overload.empty:
ax.bar(overload['period'], overload['hours_required'],
color='red', alpha=0.7, label='Overload')
ax.set_title(f'{wc} - Capacity Profile')
ax.set_xlabel('Period')
ax.set_ylabel('Hours')
ax.legend()
ax.grid(True, alpha=0.3)
plt.tight_layout()
return fig流程:
- 从主生产计划(MPS)出发
- 拆解至组件需求(BOM)
- 计算工作中心负载
- 识别过载/欠载周期
- 调整产能或排程
python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
class CapacityRequirementsPlanning:
"""
CRP - Calculate and analyze capacity requirements
based on production schedule and routings
"""
def __init__(self, work_centers):
"""
Parameters:
- work_centers: dict {name: {'capacity': hours, 'efficiency': 0-1}}
"""
self.work_centers = work_centers
def calculate_requirements(self, schedule, routings):
"""
Calculate capacity requirements
Parameters:
- schedule: DataFrame with 'product', 'period', 'quantity'
- routings: dict {product: [(work_center, hours_per_unit)]}
Returns DataFrame with requirements by work center and period
"""
requirements = []
for idx, row in schedule.iterrows():
product = row['product']
period = row['period']
quantity = row['quantity']
# Get routing for product
routing = routings.get(product, [])
for work_center, hours_per_unit in routing:
total_hours = quantity * hours_per_unit
# Adjust for efficiency
efficiency = self.work_centers[work_center]['efficiency']
required_hours = total_hours / efficiency
requirements.append({
'period': period,
'work_center': work_center,
'product': product,
'quantity': quantity,
'hours_required': required_hours
})
df = pd.DataFrame(requirements)
# Aggregate by work center and period
summary = df.groupby(['period', 'work_center'])['hours_required'].sum().reset_index()
# Add capacity and utilization
summary['capacity'] = summary['work_center'].map(
lambda wc: self.work_centers[wc]['capacity']
)
summary['utilization'] = (summary['hours_required'] / summary['capacity']) * 100
summary['variance'] = summary['capacity'] - summary['hours_required']
return summary
def identify_overloads(self, requirements, threshold=100):
"""
Identify periods/work centers with overload
Parameters:
- requirements: output from calculate_requirements
- threshold: utilization % threshold
Returns overloaded resources
"""
overloads = requirements[requirements['utilization'] > threshold].copy()
overloads = overloads.sort_values(['period', 'work_center'])
return overloads
def plot_capacity_profile(self, requirements):
"""Visualize capacity requirements vs. available"""
work_centers = requirements['work_center'].unique()
fig, axes = plt.subplots(len(work_centers), 1,
figsize=(12, 4 * len(work_centers)),
squeeze=False)
for i, wc in enumerate(work_centers):
wc_data = requirements[requirements['work_center'] == wc]
ax = axes[i, 0]
# Plot capacity line
ax.axhline(y=wc_data['capacity'].iloc[0],
color='green', linestyle='--',
linewidth=2, label='Capacity')
# Plot requirements
ax.bar(wc_data['period'], wc_data['hours_required'],
alpha=0.7, label='Required')
# Highlight overloads
overload = wc_data[wc_data['utilization'] > 100]
if not overload.empty:
ax.bar(overload['period'], overload['hours_required'],
color='red', alpha=0.7, label='Overload')
ax.set_title(f'{wc} - Capacity Profile')
ax.set_xlabel('Period')
ax.set_ylabel('Hours')
ax.legend()
ax.grid(True, alpha=0.3)
plt.tight_layout()
return figExample usage
Example usage
work_centers = {
'Cutting': {'capacity': 160, 'efficiency': 0.90},
'Welding': {'capacity': 160, 'efficiency': 0.85},
'Assembly': {'capacity': 160, 'efficiency': 0.92},
'Inspection': {'capacity': 160, 'efficiency': 0.95}
}
crp = CapacityRequirementsPlanning(work_centers)
work_centers = {
'Cutting': {'capacity': 160, 'efficiency': 0.90},
'Welding': {'capacity': 160, 'efficiency': 0.85},
'Assembly': {'capacity': 160, 'efficiency': 0.92},
'Inspection': {'capacity': 160, 'efficiency': 0.95}
}
crp = CapacityRequirementsPlanning(work_centers)
Production schedule
Production schedule
schedule = pd.DataFrame({
'product': ['A', 'A', 'B', 'B', 'C', 'C'] * 3,
'period': [1, 2, 1, 2, 1, 2] * 3,
'quantity': [100, 120, 80, 90, 60, 70] * 3
})
schedule = pd.DataFrame({
'product': ['A', 'A', 'B', 'B', 'C', 'C'] * 3,
'period': [1, 2, 1, 2, 1, 2] * 3,
'quantity': [100, 120, 80, 90, 60, 70] * 3
})
Routings: hours per unit at each work center
Routings: hours per unit at each work center
routings = {
'A': [('Cutting', 0.5), ('Welding', 0.8), ('Assembly', 1.0), ('Inspection', 0.3)],
'B': [('Cutting', 0.6), ('Assembly', 1.2), ('Inspection', 0.4)],
'C': [('Cutting', 0.4), ('Welding', 1.0), ('Assembly', 0.8), ('Inspection', 0.2)]
}
routings = {
'A': [('Cutting', 0.5), ('Welding', 0.8), ('Assembly', 1.0), ('Inspection', 0.3)],
'B': [('Cutting', 0.6), ('Assembly', 1.2), ('Inspection', 0.4)],
'C': [('Cutting', 0.4), ('Welding', 1.0), ('Assembly', 0.8), ('Inspection', 0.2)]
}
Calculate requirements
Calculate requirements
requirements = crp.calculate_requirements(schedule, routings)
print("Capacity Requirements:")
print(requirements)
requirements = crp.calculate_requirements(schedule, routings)
print("Capacity Requirements:")
print(requirements)
Identify overloads
Identify overloads
overloads = crp.identify_overloads(requirements)
if not overloads.empty:
print("\nOverloaded Resources:")
print(overloads[['period', 'work_center', 'utilization', 'variance']])
else:
print("\nNo overloads detected")
overloads = crp.identify_overloads(requirements)
if not overloads.empty:
print("\nOverloaded Resources:")
print(overloads[['period', 'work_center', 'utilization', 'variance']])
else:
print("\nNo overloads detected")
Plot
Plot
crp.plot_capacity_profile(requirements)
---crp.plot_capacity_profile(requirements)
---Capacity Expansion Analysis
产能扩张分析
Economic Analysis of Capacity Investments
产能投资的经济分析
Net Present Value (NPV) Analysis:
python
import numpy as np
def npv_capacity_investment(initial_investment, annual_benefits,
annual_costs, discount_rate, years):
"""
Calculate NPV of capacity investment
Parameters:
- initial_investment: upfront cost
- annual_benefits: revenue increase per year
- annual_costs: operating costs per year
- discount_rate: cost of capital (e.g., 0.10 for 10%)
- years: investment horizon
"""
cash_flows = [-initial_investment]
for year in range(1, years + 1):
net_benefit = annual_benefits - annual_costs
discounted_benefit = net_benefit / ((1 + discount_rate) ** year)
cash_flows.append(discounted_benefit)
npv = sum(cash_flows)
# Calculate IRR (Internal Rate of Return)
irr = np.irr([-initial_investment] + [annual_benefits - annual_costs] * years)
# Payback period
cumulative = -initial_investment
payback = None
for year in range(1, years + 1):
cumulative += (annual_benefits - annual_costs)
if cumulative > 0 and payback is None:
payback = year
return {
'npv': npv,
'irr': irr * 100,
'payback_years': payback,
'total_investment': initial_investment,
'annual_net_benefit': annual_benefits - annual_costs
}净现值(NPV)分析:
python
import numpy as np
def npv_capacity_investment(initial_investment, annual_benefits,
annual_costs, discount_rate, years):
"""
Calculate NPV of capacity investment
Parameters:
- initial_investment: upfront cost
- annual_benefits: revenue increase per year
- annual_costs: operating costs per year
- discount_rate: cost of capital (e.g., 0.10 for 10%)
- years: investment horizon
"""
cash_flows = [-initial_investment]
for year in range(1, years + 1):
net_benefit = annual_benefits - annual_costs
discounted_benefit = net_benefit / ((1 + discount_rate) ** year)
cash_flows.append(discounted_benefit)
npv = sum(cash_flows)
# Calculate IRR (Internal Rate of Return)
irr = np.irr([-initial_investment] + [annual_benefits - annual_costs] * years)
# Payback period
cumulative = -initial_investment
payback = None
for year in range(1, years + 1):
cumulative += (annual_benefits - annual_costs)
if cumulative > 0 and payback is None:
payback = year
return {
'npv': npv,
'irr': irr * 100,
'payback_years': payback,
'total_investment': initial_investment,
'annual_net_benefit': annual_benefits - annual_costs
}Example: Evaluate new production line
Example: Evaluate new production line
investment_analysis = npv_capacity_investment(
initial_investment=5_000_000,
annual_benefits=2_000_000, # Increased revenue
annual_costs=800_000, # Operating costs
discount_rate=0.12, # 12% cost of capital
years=10
)
print("Investment Analysis:")
print(f" NPV: ${investment_analysis['npv']:,.0f}")
print(f" IRR: {investment_analysis['irr']:.1f}%")
print(f" Payback: {investment_analysis['payback_years']} years")
if investment_analysis['npv'] > 0:
print("\n✓ Investment is financially viable")
else:
print("\n✗ Investment is not viable at this discount rate")
undefinedinvestment_analysis = npv_capacity_investment(
initial_investment=5_000_000,
annual_benefits=2_000_000, # Increased revenue
annual_costs=800_000, # Operating costs
discount_rate=0.12, # 12% cost of capital
years=10
)
print("Investment Analysis:")
print(f" NPV: ${investment_analysis['npv']:,.0f}")
print(f" IRR: {investment_analysis['irr']:.1f}%")
print(f" Payback: {investment_analysis['payback_years']} years")
if investment_analysis['npv'] > 0:
print("\n✓ Investment is financially viable")
else:
print("\n✗ Investment is not viable at this discount rate")
undefinedDecision Tree Analysis for Capacity Timing
产能扩张时机的决策树分析
python
import matplotlib.pyplot as plt
import numpy as np
class CapacityDecisionTree:
"""
Decision tree for capacity expansion timing
under demand uncertainty
"""
def __init__(self):
self.scenarios = []
def add_scenario(self, name, probability, demand_growth,
expand_now_cost, expand_later_cost,
revenue_per_unit, shortage_cost):
"""Add demand scenario"""
self.scenarios.append({
'name': name,
'probability': probability,
'demand_growth': demand_growth,
'expand_now_cost': expand_now_cost,
'expand_later_cost': expand_later_cost,
'revenue_per_unit': revenue_per_unit,
'shortage_cost': shortage_cost
})
def evaluate_expand_now(self, current_capacity, periods=5):
"""Calculate expected value of expanding now"""
ev = 0
for scenario in self.scenarios:
# Cost of expanding now
cost = -scenario['expand_now_cost']
# Benefits over periods
for period in range(1, periods + 1):
demand = current_capacity * (1 + scenario['demand_growth']) ** period
capacity_after_expansion = current_capacity * 1.5 # Assume 50% expansion
# Revenue from meeting demand
served = min(demand, capacity_after_expansion)
revenue = served * scenario['revenue_per_unit']
# Discount
discounted_revenue = revenue / (1.10 ** period)
cost += discounted_revenue
# Weight by probability
ev += cost * scenario['probability']
return ev
def evaluate_expand_later(self, current_capacity, expand_period=3, periods=5):
"""Calculate expected value of expanding later"""
ev = 0
for scenario in self.scenarios:
cost = 0
for period in range(1, periods + 1):
demand = current_capacity * (1 + scenario['demand_growth']) ** period
if period < expand_period:
# Before expansion: limited by current capacity
served = min(demand, current_capacity)
shortage = max(0, demand - current_capacity)
revenue = served * scenario['revenue_per_unit']
shortage_penalty = shortage * scenario['shortage_cost']
discounted_value = (revenue - shortage_penalty) / (1.10 ** period)
elif period == expand_period:
# Expansion happens
expansion_cost = -scenario['expand_later_cost']
served = min(demand, current_capacity * 1.5)
revenue = served * scenario['revenue_per_unit']
discounted_value = (expansion_cost + revenue) / (1.10 ** period)
else:
# After expansion
served = min(demand, current_capacity * 1.5)
revenue = served * scenario['revenue_per_unit']
discounted_value = revenue / (1.10 ** period)
cost += discounted_value
# Weight by probability
ev += cost * scenario['probability']
return ev
def evaluate_no_expansion(self, current_capacity, periods=5):
"""Calculate expected value of not expanding"""
ev = 0
for scenario in self.scenarios:
cost = 0
for period in range(1, periods + 1):
demand = current_capacity * (1 + scenario['demand_growth']) ** period
# Limited by current capacity
served = min(demand, current_capacity)
shortage = max(0, demand - current_capacity)
revenue = served * scenario['revenue_per_unit']
shortage_penalty = shortage * scenario['shortage_cost']
discounted_value = (revenue - shortage_penalty) / (1.10 ** period)
cost += discounted_value
# Weight by probability
ev += cost * scenario['probability']
return ev
def recommend(self, current_capacity):
"""Determine optimal capacity decision"""
ev_now = self.evaluate_expand_now(current_capacity)
ev_later = self.evaluate_expand_later(current_capacity)
ev_no = self.evaluate_no_expansion(current_capacity)
results = {
'expand_now': ev_now,
'expand_later': ev_later,
'no_expansion': ev_no
}
best_option = max(results, key=results.get)
return {
'recommendation': best_option,
'expected_values': results,
'best_ev': results[best_option]
}python
import matplotlib.pyplot as plt
import numpy as np
class CapacityDecisionTree:
"""
Decision tree for capacity expansion timing
under demand uncertainty
"""
def __init__(self):
self.scenarios = []
def add_scenario(self, name, probability, demand_growth,
expand_now_cost, expand_later_cost,
revenue_per_unit, shortage_cost):
"""Add demand scenario"""
self.scenarios.append({
'name': name,
'probability': probability,
'demand_growth': demand_growth,
'expand_now_cost': expand_now_cost,
'expand_later_cost': expand_later_cost,
'revenue_per_unit': revenue_per_unit,
'shortage_cost': shortage_cost
})
def evaluate_expand_now(self, current_capacity, periods=5):
"""Calculate expected value of expanding now"""
ev = 0
for scenario in self.scenarios:
# Cost of expanding now
cost = -scenario['expand_now_cost']
# Benefits over periods
for period in range(1, periods + 1):
demand = current_capacity * (1 + scenario['demand_growth']) ** period
capacity_after_expansion = current_capacity * 1.5 # Assume 50% expansion
# Revenue from meeting demand
served = min(demand, capacity_after_expansion)
revenue = served * scenario['revenue_per_unit']
# Discount
discounted_revenue = revenue / (1.10 ** period)
cost += discounted_revenue
# Weight by probability
ev += cost * scenario['probability']
return ev
def evaluate_expand_later(self, current_capacity, expand_period=3, periods=5):
"""Calculate expected value of expanding later"""
ev = 0
for scenario in self.scenarios:
cost = 0
for period in range(1, periods + 1):
demand = current_capacity * (1 + scenario['demand_growth']) ** period
if period < expand_period:
# Before expansion: limited by current capacity
served = min(demand, current_capacity)
shortage = max(0, demand - current_capacity)
revenue = served * scenario['revenue_per_unit']
shortage_penalty = shortage * scenario['shortage_cost']
discounted_value = (revenue - shortage_penalty) / (1.10 ** period)
elif period == expand_period:
# Expansion happens
expansion_cost = -scenario['expand_later_cost']
served = min(demand, current_capacity * 1.5)
revenue = served * scenario['revenue_per_unit']
discounted_value = (expansion_cost + revenue) / (1.10 ** period)
else:
# After expansion
served = min(demand, current_capacity * 1.5)
revenue = served * scenario['revenue_per_unit']
discounted_value = revenue / (1.10 ** period)
cost += discounted_value
# Weight by probability
ev += cost * scenario['probability']
return ev
def evaluate_no_expansion(self, current_capacity, periods=5):
"""Calculate expected value of not expanding"""
ev = 0
for scenario in self.scenarios:
cost = 0
for period in range(1, periods + 1):
demand = current_capacity * (1 + scenario['demand_growth']) ** period
# Limited by current capacity
served = min(demand, current_capacity)
shortage = max(0, demand - current_capacity)
revenue = served * scenario['revenue_per_unit']
shortage_penalty = shortage * scenario['shortage_cost']
discounted_value = (revenue - shortage_penalty) / (1.10 ** period)
cost += discounted_value
# Weight by probability
ev += cost * scenario['probability']
return ev
def recommend(self, current_capacity):
"""Determine optimal capacity decision"""
ev_now = self.evaluate_expand_now(current_capacity)
ev_later = self.evaluate_expand_later(current_capacity)
ev_no = self.evaluate_no_expansion(current_capacity)
results = {
'expand_now': ev_now,
'expand_later': ev_later,
'no_expansion': ev_no
}
best_option = max(results, key=results.get)
return {
'recommendation': best_option,
'expected_values': results,
'best_ev': results[best_option]
}Example usage
Example usage
dt = CapacityDecisionTree()
dt = CapacityDecisionTree()
Add demand scenarios
Add demand scenarios
dt.add_scenario(
name='High Growth',
probability=0.30,
demand_growth=0.15,
expand_now_cost=10_000_000,
expand_later_cost=12_000_000,
revenue_per_unit=100,
shortage_cost=50
)
dt.add_scenario(
name='Moderate Growth',
probability=0.50,
demand_growth=0.08,
expand_now_cost=10_000_000,
expand_later_cost=12_000_000,
revenue_per_unit=100,
shortage_cost=50
)
dt.add_scenario(
name='Low Growth',
probability=0.20,
demand_growth=0.03,
expand_now_cost=10_000_000,
expand_later_cost=12_000_000,
revenue_per_unit=100,
shortage_cost=50
)
dt.add_scenario(
name='High Growth',
probability=0.30,
demand_growth=0.15,
expand_now_cost=10_000_000,
expand_later_cost=12_000_000,
revenue_per_unit=100,
shortage_cost=50
)
dt.add_scenario(
name='Moderate Growth',
probability=0.50,
demand_growth=0.08,
expand_now_cost=10_000_000,
expand_later_cost=12_000_000,
revenue_per_unit=100,
shortage_cost=50
)
dt.add_scenario(
name='Low Growth',
probability=0.20,
demand_growth=0.03,
expand_now_cost=10_000_000,
expand_later_cost=12_000_000,
revenue_per_unit=100,
shortage_cost=50
)
Get recommendation
Get recommendation
current_capacity = 100000 # units per year
recommendation = dt.recommend(current_capacity)
print("Capacity Expansion Decision Analysis:")
print(f"\nExpected Values:")
for option, ev in recommendation['expected_values'].items():
print(f" {option}: ${ev:,.0f}")
print(f"\n✓ Recommendation: {recommendation['recommendation'].upper()}")
print(f" Expected Value: ${recommendation['best_ev']:,.0f}")
---current_capacity = 100000 # units per year
recommendation = dt.recommend(current_capacity)
print("Capacity Expansion Decision Analysis:")
print(f"\nExpected Values:")
for option, ev in recommendation['expected_values'].items():
print(f" {option}: ${ev:,.0f}")
print(f"\n✓ Recommendation: {recommendation['recommendation'].upper()}")
print(f" Expected Value: ${recommendation['best_ev']:,.0f}")
---Flexible Capacity Strategies
灵活产能策略
Options for Capacity Flexibility
产能灵活性选项
1. Workforce Flexibility
- Cross-trained workers
- Temporary labor
- Overtime capability
- Variable shifts
2. Equipment Flexibility
- Flexible manufacturing systems
- Quick changeover capability
- Mobile equipment
- Shared equipment pools
3. Facility Flexibility
- Modular facilities
- Multi-product capable
- Scalable layouts
- Shared warehousing
4. Partnership Flexibility
- Contract manufacturing
- Co-packing arrangements
- 3PL relationships
- Supplier flexibility
Flexibility Valuation:
python
def value_of_flexibility(demand_scenarios, fixed_capacity,
flexible_capacity, flexibility_cost):
"""
Calculate value of flexible capacity using real options approach
Parameters:
- demand_scenarios: list of (probability, demand) tuples
- fixed_capacity: base capacity level
- flexible_capacity: additional flexible capacity available
- flexibility_cost: cost per unit of flexible capacity
Returns value of flexibility option
"""
# Expected value with fixed capacity only
ev_fixed = 0
for prob, demand in demand_scenarios:
served = min(demand, fixed_capacity)
revenue = served * 100 # Revenue per unit
shortage_cost = max(0, demand - fixed_capacity) * 50
ev_fixed += prob * (revenue - shortage_cost)
# Expected value with flexibility
ev_flexible = 0
for prob, demand in demand_scenarios:
# Use flexible capacity only if needed
if demand > fixed_capacity:
flexible_used = min(demand - fixed_capacity, flexible_capacity)
total_served = fixed_capacity + flexible_used
else:
flexible_used = 0
total_served = demand
revenue = total_served * 100
flexibility_usage_cost = flexible_used * flexibility_cost
shortage_cost = max(0, demand - total_served) * 50
ev_flexible += prob * (revenue - flexibility_usage_cost - shortage_cost)
value_of_flexibility = ev_flexible - ev_fixed
return {
'ev_without_flexibility': ev_fixed,
'ev_with_flexibility': ev_flexible,
'value_of_flexibility': value_of_flexibility,
'flexibility_cost': flexible_capacity * flexibility_cost
}1. 人力灵活性
- 多技能员工
- 临时劳动力
- 加班能力
- 可变班次
2. 设备灵活性
- 柔性制造系统
- 快速换产能力
- 移动设备
- 共享设备池
3. 设施灵活性
- 模块化设施
- 多产品兼容
- 可扩展布局
- 共享仓储
4. 合作伙伴灵活性
- 合同制造
- 联合包装安排
- 3PL合作关系
- 供应商灵活性
灵活性估值:
python
def value_of_flexibility(demand_scenarios, fixed_capacity,
flexible_capacity, flexibility_cost):
"""
Calculate value of flexible capacity using real options approach
Parameters:
- demand_scenarios: list of (probability, demand) tuples
- fixed_capacity: base capacity level
- flexible_capacity: additional flexible capacity available
- flexibility_cost: cost per unit of flexible capacity
Returns value of flexibility option
"""
# Expected value with fixed capacity only
ev_fixed = 0
for prob, demand in demand_scenarios:
served = min(demand, fixed_capacity)
revenue = served * 100 # Revenue per unit
shortage_cost = max(0, demand - fixed_capacity) * 50
ev_fixed += prob * (revenue - shortage_cost)
# Expected value with flexibility
ev_flexible = 0
for prob, demand in demand_scenarios:
# Use flexible capacity only if needed
if demand > fixed_capacity:
flexible_used = min(demand - fixed_capacity, flexible_capacity)
total_served = fixed_capacity + flexible_used
else:
flexible_used = 0
total_served = demand
revenue = total_served * 100
flexibility_usage_cost = flexible_used * flexibility_cost
shortage_cost = max(0, demand - total_served) * 50
ev_flexible += prob * (revenue - flexibility_usage_cost - shortage_cost)
value_of_flexibility = ev_flexible - ev_fixed
return {
'ev_without_flexibility': ev_fixed,
'ev_with_flexibility': ev_flexible,
'value_of_flexibility': value_of_flexibility,
'flexibility_cost': flexible_capacity * flexibility_cost
}Example
Example
demand_scenarios = [
(0.20, 8000), # Low demand
(0.50, 10000), # Expected demand
(0.30, 13000) # High demand
]
result = value_of_flexibility(
demand_scenarios=demand_scenarios,
fixed_capacity=10000,
flexible_capacity=3000,
flexibility_cost=15 # Extra cost per unit for flexible capacity
)
print("Flexibility Analysis:")
print(f" EV without flexibility: ${result['ev_without_flexibility']:,.0f}")
print(f" EV with flexibility: ${result['ev_with_flexibility']:,.0f}")
print(f" Value of flexibility: ${result['value_of_flexibility']:,.0f}")
if result['value_of_flexibility'] > result['flexibility_cost']:
print(f"\n✓ Flexibility is valuable (worth ${result['value_of_flexibility']:,.0f})")
else:
print(f"\n✗ Flexibility not cost-effective")
---demand_scenarios = [
(0.20, 8000), # Low demand
(0.50, 10000), # Expected demand
(0.30, 13000) # High demand
]
result = value_of_flexibility(
demand_scenarios=demand_scenarios,
fixed_capacity=10000,
flexible_capacity=3000,
flexibility_cost=15 # Extra cost per unit for flexible capacity
)
print("Flexibility Analysis:")
print(f" EV without flexibility: ${result['ev_without_flexibility']:,.0f}")
print(f" EV with flexibility: ${result['ev_with_flexibility']:,.0f}")
print(f" Value of flexibility: ${result['value_of_flexibility']:,.0f}")
if result['value_of_flexibility'] > result['flexibility_cost']:
print(f"\n✓ Flexibility is valuable (worth ${result['value_of_flexibility']:,.0f})")
else:
print(f"\n✗ Flexibility not cost-effective")
---Tools & Libraries
工具与库
Python Libraries
Python库
Optimization:
- : Linear programming for aggregate planning
pulp - : Advanced optimization modeling
pyomo - : Optimization algorithms
scipy.optimize - : Dynamic optimization
gekko
Simulation:
- : Discrete-event simulation
simpy - : Numerical computations
numpy - : Data analysis
pandas
Visualization:
- ,
matplotlib: Charts and graphsseaborn - : Interactive dashboards
plotly - : Process flow diagrams
networkx
优化类:
- : 用于综合规划的线性规划库
pulp - : 高级优化建模库
pyomo - : 优化算法库
scipy.optimize - : 动态优化库
gekko
模拟类:
- : 离散事件模拟库
simpy - : 数值计算库
numpy - : 数据分析库
pandas
可视化类:
- ,
matplotlib: 图表与图形库seaborn - : 交互式仪表盘库
plotly - : 流程流程图库
networkx
Commercial Software
商业软件
Capacity Planning Systems:
- SAP APO: Advanced Planning & Optimization
- Oracle ASCP: Advanced Supply Chain Planning
- Kinaxis RapidResponse: S&OP with capacity planning
- Blue Yonder: Capacity planning modules
- Anaplan: Cloud planning platform
Simulation:
- AnyLogic: Multi-method simulation
- Arena: Discrete-event simulation
- Simio: 3D simulation with capacity analysis
ERP Capacity Planning:
- SAP: Work Center Planning, CRP
- Oracle: Capacity Requirements Planning
- Microsoft Dynamics: Capacity Planning
- Infor: Production Capacity Planning
产能规划系统:
- SAP APO: 高级规划与优化系统
- Oracle ASCP: 高级供应链规划系统
- Kinaxis RapidResponse: 集成产能规划的S&OP系统
- Blue Yonder: 产能规划模块
- Anaplan: 云规划平台
模拟类:
- AnyLogic: 多方法模拟软件
- Arena: 离散事件模拟软件
- Simio: 带产能分析的3D模拟软件
ERP产能规划:
- SAP: 工作中心规划、CRP模块
- Oracle: 产能需求规划模块
- Microsoft Dynamics: 产能规划模块
- Infor: 生产产能规划模块
Common Challenges & Solutions
常见挑战与解决方案
Challenge: Uncertain Demand
挑战:需求不确定
Problem:
- Hard to size capacity
- Risk of over/under investment
- Volatility makes planning difficult
Solutions:
- Scenario planning and sensitivity analysis
- Build in flexibility (temporary labor, overtime, outsourcing)
- Modular capacity additions (smaller increments)
- Postponement strategies
- Real options analysis for timing
问题:
- 难以确定产能规模
- 存在过度/投资不足风险
- 波动使规划难度加大
解决方案:
- 场景规划与敏感性分析
- 内置灵活性(临时劳动力、加班、外包)
- 模块化产能增量(较小规模的新增)
- 延迟策略
- 基于实物期权分析的时机决策
Challenge: Lumpy Capacity Additions
挑战:产能增量不连续
Problem:
- Can't add small increments
- Must add entire production line or facility
- Creates periods of over-capacity
Solutions:
- Phased expansion plans
- Start with higher utilization targets
- Alternative uses for excess capacity (contract production)
- Financial analysis with longer payback periods
- Consider leasing vs. buying
问题:
- 无法进行小规模增量添加
- 必须新增整条生产线或设施
- 造成产能过剩期
解决方案:
- 分阶段扩张计划
- 初始设定更高的利用率目标
- 过剩产能的替代用途(合同生产)
- 更长回收期的财务分析
- 考虑租赁vs购买
Challenge: Bottleneck Shifting
挑战:瓶颈转移
Problem:
- Expand one resource, bottleneck moves elsewhere
- Whack-a-mole problem
- Unbalanced capacity
Solutions:
- System-wide capacity analysis (not just one resource)
- Theory of Constraints approach
- Balanced capacity investments
- Buffer inventories at bottlenecks
- Process redesign to eliminate bottlenecks
问题:
- 扩张某一资源后,瓶颈转移至其他环节
- 类似打地鼠的问题
- 产能不平衡
解决方案:
- 全系统产能分析(而非仅单一资源)
- 约束理论方法
- 平衡产能投资
- 瓶颈环节的缓冲库存
- 流程重构以消除瓶颈
Challenge: Long Lead Times
挑战:交付周期长
Problem:
- Takes 12-24+ months to add capacity
- Demand may change by then
- Hard to react quickly
Solutions:
- Leading capacity strategy (anticipate growth)
- Modular/flexible facilities (faster deployment)
- Pre-engineered solutions
- Partnerships for quick capacity (contract manufacturing)
- Continuous planning and forecasting
问题:
- 新增产能需12-24个月及以上
- 期间需求可能变化
- 难以快速响应
解决方案:
- 领先产能策略(提前预判增长)
- 模块化/柔性设施(部署更快)
- 预制解决方案
- 快速产能合作伙伴(合同制造)
- 持续规划与预测
Challenge: Seasonal Demand
挑战:季节性需求
Problem:
- Need capacity for peak, idle rest of year
- High fixed costs
- Utilization swings
Solutions:
- Flexible workforce (temporary, seasonal hires)
- Build inventory in low season for high season
- Produce complementary products (counter-seasonal)
- Demand smoothing (promotions in off-season)
- Outsource peak production
问题:
- 需为峰值需求准备产能,其余时间闲置
- 固定成本高
- 利用率波动大
解决方案:
- 灵活人力(临时、季节性招聘)
- 淡季生产库存以备旺季
- 生产互补产品(反季节性)
- 需求平滑(淡季促销)
- 外包峰值生产
Output Format
输出格式
Capacity Plan Report
产能计划报告
Executive Summary:
- Current capacity status and utilization
- Demand forecast and capacity gaps
- Recommended capacity strategy
- Investment requirements and timeline
Current State Analysis:
| Resource | Available Capacity | Current Utilization | Effective Capacity | OEE |
|---|---|---|---|---|
| Line 1 | 10,000 units/mo | 85% | 8,500 units/mo | 72% |
| Line 2 | 8,000 units/mo | 92% | 7,360 units/mo | 78% |
| Warehouse | 50,000 sq ft | 78% | 39,000 sq ft | N/A |
| Labor | 120 FTE | 88% | 105.6 FTE | N/A |
Capacity Requirements Forecast:
| Period | Demand Forecast | Required Capacity | Current Capacity | Gap | Utilization |
|---|---|---|---|---|---|
| Q1 2025 | 15,000 | 15,750 | 18,000 | -2,250 | 88% |
| Q2 2025 | 17,500 | 18,375 | 18,000 | +375 | 102% |
| Q3 2025 | 19,000 | 19,950 | 18,000 | +1,950 | 111% |
| Q4 2025 | 20,000 | 21,000 | 18,000 | +3,000 | 117% |
Bottleneck Analysis:
- Current Bottleneck: Assembly line (8,000 units/month capacity)
- Impact: Limits system throughput to 8,000 units/month
- Constraint Duration: Expected through Q3 2025
- Recommended Action: Add second assembly line
Capacity Strategy Recommendation:
Option 1: Expand Now (Recommended)
- Add assembly line and warehouse space
- Investment: $3.5M
- Timeline: Ready by Q2 2025
- NPV: $2.1M (10-year horizon)
- Avoids shortage costs and lost revenue
Option 2: Flexible Capacity
- Use contract manufacturing for 20% of volume
- Variable cost: +$15/unit
- Lower fixed investment
- Maintains service during growth
Option 3: Delay Expansion
- Wait until Q3 2025
- Risk of lost sales: $1.2M
- Lower upfront investment
- Higher long-term costs
Implementation Plan:
- Month 1-2: Finalize design and vendors
- Month 3-4: Equipment procurement
- Month 5-6: Installation and testing
- Month 7: Production ramp-up
- Month 8: Full capacity achieved
执行摘要:
- 当前产能状态与利用率
- 需求预测与产能缺口
- 推荐的产能策略
- 投资要求与时间线
当前状态分析:
| 资源 | 可用产能 | 当前利用率 | 有效产能 | OEE |
|---|---|---|---|---|
| 生产线1 | 10,000 单位/月 | 85% | 8,500 单位/月 | 72% |
| 生产线2 | 8,000 单位/月 | 92% | 7,360 单位/月 | 78% |
| 仓库 | 50,000 平方英尺 | 78% | 39,000 平方英尺 | N/A |
| 人力 | 120 全职员工 | 88% | 105.6 全职员工 | N/A |
产能需求预测:
| 周期 | 需求预测 | 所需产能 | 当前产能 | 缺口 | 利用率 |
|---|---|---|---|---|---|
| 2025年Q1 | 15,000 | 15,750 | 18,000 | -2,250 | 88% |
| 2025年Q2 | 17,500 | 18,375 | 18,000 | +375 | 102% |
| 2025年Q3 | 19,000 | 19,950 | 18,000 | +1,950 | 111% |
| 2025年Q4 | 20,000 | 21,000 | 18,000 | +3,000 | 117% |
瓶颈分析:
- 当前瓶颈:组装线(8,000 单位/月产能)
- 影响:将系统吞吐量限制在8,000 单位/月
- 约束持续时间:预计至2025年Q3
- 推荐行动:新增第二条组装线
产能策略推荐:
选项1:立即扩张(推荐)
- 新增组装线与仓库空间
- 投资:350万美元
- 时间线:2025年Q2前就绪
- NPV:210万美元(10年周期)
- 避免缺货成本与收入损失
选项2:灵活产能
- 将20%的产量外包
- 可变成本:每单位额外15美元
- 固定投资更低
- 增长期间维持服务水平
选项3:延迟扩张
- 至2025年Q3再扩张
- 销售额损失风险:120万美元
- 前期投资更低
- 长期成本更高
实施计划:
- 第1-2个月:确定设计与供应商
- 第3-4个月:设备采购
- 第5-6个月:安装与测试
- 第7个月:产能爬坡
- 第8个月:达到满产能
Questions to Ask
需询问的问题
If you need more context:
- What type of capacity? (production, warehouse, transportation, labor)
- What's the planning horizon? (short-term, tactical, strategic)
- Current capacity utilization rates?
- Demand forecast and growth expectations?
- Known bottlenecks or constraints?
- Budget available for capacity investments?
- Service level requirements?
- Current operating schedule (shifts, days per week)?
如需更多背景信息:
- 涉及哪类产能?(生产、仓储、运输、人力)
- 规划周期是多久?(短期、战术、战略)
- 当前产能利用率是多少?
- 需求预测与增长预期如何?
- 已知的瓶颈或约束有哪些?
- 产能投资的预算是多少?
- 服务水平要求是什么?
- 当前运营排班是怎样的?(班次、每周工作天数)
Related Skills
相关技能
- master-production-scheduling: For detailed production scheduling
- demand-forecasting: For capacity requirements forecasting
- sales-operations-planning: For integrated capacity planning in S&OP
- network-design: For facility capacity in network optimization
- production-scheduling: For shop floor capacity utilization
- scenario-planning: For capacity planning under uncertainty
- workforce-scheduling: For labor capacity planning
- facility-location-problem: For location-capacity decisions
- master-production-scheduling: 用于详细生产排程
- demand-forecasting: 用于产能需求预测
- sales-operations-planning: 用于S&OP中的集成产能规划
- network-design: 用于网络优化中的设施产能规划
- production-scheduling: 用于车间产能利用率规划
- scenario-planning: 用于不确定环境下的产能规划
- workforce-scheduling: 用于人力产能规划
- facility-location-problem: 用于选址-产能决策