Skill 寫法圖鑑

algo-sc-bullwhip

asgard-ai-platform | 商業與營運 | 原文 | MIT

分析供應鏈的長鞭效應並找出放大的成因

中文翻譯

---
name: "algo-sc-bullwhip"
description: "分析並緩解長鞭效應(bullwhip effect),也就是需求波動在供應鏈中往上游逐級放大的現象。當使用者需要診斷訂單波動放大、量化長鞭比率、或實施抑制策略時使用,即使他們說的是「為什麼我們的訂單波動這麼大」、「供應鏈波動」或「需求放大的問題」也一樣。"
metadata:
  category: "WP-41 供應鏈演算法"
  tags: ["supply-chain", "bullwhip-effect", "demand-variability", "coordination"]
---

# 長鞭效應分析(Bullwhip Effect Analysis)

## 概述

長鞭效應描述的是,消費者需求的小幅波動,在供應鏈每個上游階段逐步放大。零售端需求增加 5%,到了製造商那邊,可能變成訂單暴增 40%。成因包括需求訊號處理、訂單批量化、價格波動,以及配給/短缺時的搶貨行為。

## 何時使用

**觸發條件:**
- 要診斷為什麼供應商的訂單,比終端消費者的需求波動大得多
- 要量化需求在供應鏈各層級的放大程度
- 要設計降低訂單波動的策略

**何時不要用:**
- 需求本身就真的很波動(不是被放大)時,問題在需求預測
- 單一層級的庫存最佳化(用 EOQ 或安全庫存)

## 演算法

```
鐵律:需求波動在「每一個」上游階段都會放大
長鞭比率 = Var(訂單) / Var(需求)。任何階段的比率 > 1,
就確認有長鞭效應。四個根本原因(Lee et al., 1997):
1. 需求訊號處理(用移動平均做預測)
2. 訂單批量化(定期盤點、最低訂購量 MOQ)
3. 價格波動(促銷期間提前囤貨)
4. 配給與短缺時的搶貨(缺貨時灌水訂單)
```

### 階段 1:輸入驗證
蒐集:終端消費者的需求時間序列,以及供應鏈每個階段(零售商 → 經銷商 → 製造商 → 供應商)的訂單時間序列。
**關卡:** 至少有 2 個層級的訂單資料、最少 26 個期間。

### 階段 2:核心演算法
1. 計算每個層級的需求變異數
2. 計算每個層級的長鞭比率:BWR_i = Var(orders_i) / Var(orders_{i-1})
3. 找出每個成因的貢獻:批量大小分析、促銷日曆重疊、預測方法評估
4. 量化成本:多餘庫存的持有成本、趕貨成本、產能錯置

### 階段 3:驗證
檢查:上游階段的 BWR > 1(確認有長鞭效應)。把訂單的暴增和可辨識的成因(促銷、預測更新、批次週期)做關聯。
**關卡:** 長鞭效應已量化、根本原因已辨識。

### 階段 4:輸出
回傳長鞭比率,附上根本原因歸因和緩解建議。

## 輸出格式

```json
{
  "bullwhip_ratios": [{"tier": "retailer→distributor", "ratio": 1.8}, {"tier": "distributor→manufacturer", "ratio": 2.3}],
  "root_causes": [{"cause": "order_batching", "contribution_pct": 40}, {"cause": "demand_signal_processing", "contribution_pct": 35}],
  "metadata": {"periods": 52, "tiers_analyzed": 3}
}
```

## 範例

### 輸入輸出範例
**輸入:** 消費者需求 CV=0.10、零售商訂單 CV=0.18、經銷商訂單 CV=0.32
**預期:** BWR 零售商=3.24(0.18²/0.10²)、BWR 經銷商=3.16(0.32²/0.18²)。確認有強烈的長鞭效應。

### 邊界情況
| 輸入 | 預期 | 原因 |
|-------|----------|-----|
| BWR < 1 | 平滑效應 | 資訊共享或 VMI 可能抑制了波動 |
| 促銷期間 | BWR 飆高 | 提前囤貨放大了訂單 |
| 只有單一層級 | 無法衡量放大程度 | 至少要 2 個層級才能比較 |

## 常見陷阱

- **資料粒度**:週資料和月資料可能呈現不同的長鞭幅度。各層級要使用一致的時間區間。
- **VMI 與 CPFR**:供應商管理庫存和協同規劃,透過共享需求資料來降低長鞭效應。但它們需要信任和 IT 整合。
- **資訊共享 ≠ 消除長鞭效應**:就算共享 POS 資料,前置時間和批量限制仍然會造成一些放大。
- **缺貨時的搶貨最難解決**:缺貨時,客戶會灌水訂單。供應恢復後,取消訂單會湧進來。只有承諾數量的配給方式才能防止這種情況。
- **衡量上的挑戰**:真正的消費者需求常常觀察不到(只有 POS 資料)。缺貨造成的流失銷售看不見,會低估真實的需求波動。

## 參考資料

- Lee-Padmanabhan-Whang 的正式模型,見 `references/bullwhip-model.md`
- 資訊共享的策略,見 `references/information-sharing.md`

英文原文

---
name: "algo-sc-bullwhip"
description: "Analyze and mitigate the bullwhip effect where demand variability amplifies upstream in supply chains. Use this skill when the user needs to diagnose order variability amplification, quantify the bullwhip ratio, or implement dampening strategies — even if they say 'why are our orders so volatile', 'supply chain variability', or 'demand amplification problem'."
metadata:
  category: "WP-41 供應鏈演算法"
  tags: ["supply-chain", "bullwhip-effect", "demand-variability", "coordination"]
---

# Bullwhip Effect Analysis

## Overview

The bullwhip effect describes how small fluctuations in consumer demand amplify progressively at each upstream stage of the supply chain. A 5% retail demand increase can become a 40% order spike at the manufacturer. Caused by demand signal processing, order batching, price fluctuations, and rationing/shortage gaming.

## When to Use

**Trigger conditions:**
- Diagnosing why supplier orders are far more volatile than end-consumer demand
- Quantifying demand amplification across supply chain tiers
- Designing strategies to reduce order variability

**When NOT to use:**
- When demand is genuinely volatile (not amplified) — the issue is demand forecasting
- For single-echelon inventory optimization (use EOQ or safety stock)

## Algorithm

```
IRON LAW: Demand Variability Amplifies at EACH Upstream Stage
Bullwhip ratio = Var(orders) / Var(demand). A ratio > 1 at any stage
confirms the bullwhip effect. The four root causes (Lee et al., 1997):
1. Demand signal processing (forecasting with moving averages)
2. Order batching (periodic review, MOQs)
3. Price fluctuations (forward buying during promotions)
4. Rationing and shortage gaming (inflating orders during scarcity)
```

### Phase 1: Input Validation
Collect: end-consumer demand time series AND order time series at each supply chain stage (retailer → distributor → manufacturer → supplier).
**Gate:** At least 2 tiers of order data, minimum 26 periods.

### Phase 2: Core Algorithm
1. Compute variance of demand at each tier
2. Compute bullwhip ratio per tier: BWR_i = Var(orders_i) / Var(orders_{i-1})
3. Identify contribution of each cause: batch size analysis, promotion calendar overlap, forecast method evaluation
4. Quantify cost: excess inventory carrying cost, expediting cost, capacity misallocation

### Phase 3: Verification
Check: BWR > 1 at upstream stages (confirms bullwhip). Correlate order spikes with identifiable causes (promotions, forecast updates, batch cycles).
**Gate:** Bullwhip quantified and root causes identified.

### Phase 4: Output
Return bullwhip ratios with root cause attribution and mitigation recommendations.

## Output Format

```json
{
  "bullwhip_ratios": [{"tier": "retailer→distributor", "ratio": 1.8}, {"tier": "distributor→manufacturer", "ratio": 2.3}],
  "root_causes": [{"cause": "order_batching", "contribution_pct": 40}, {"cause": "demand_signal_processing", "contribution_pct": 35}],
  "metadata": {"periods": 52, "tiers_analyzed": 3}
}
```

## Examples

### Sample I/O
**Input:** Consumer demand CV=0.10, Retailer orders CV=0.18, Distributor orders CV=0.32
**Expected:** BWR retailer=3.24 (0.18²/0.10²), BWR distributor=3.16 (0.32²/0.18²). Strong bullwhip confirmed.

### Edge Cases
| Input | Expected | Why |
|-------|----------|-----|
| BWR < 1 | Smoothing effect | Information sharing or VMI may dampen variability |
| Promotional periods | Spike in BWR | Forward buying amplifies orders |
| Single tier only | Cannot measure amplification | Need at least 2 tiers for comparison |

## Gotchas

- **Data granularity**: Weekly vs monthly data can show different bullwhip magnitudes. Use consistent time buckets across tiers.
- **VMI and CPFR**: Vendor-managed inventory and collaborative planning reduce bullwhip by sharing demand data. But they require trust and IT integration.
- **Information sharing ≠ bullwhip elimination**: Even with POS data sharing, lead times and batch constraints still cause some amplification.
- **Shortage gaming is hardest to fix**: During shortages, customers inflate orders. When supply recovers, cancellations flood in. Only committed-quantity allocations prevent this.
- **Measurement challenges**: True consumer demand is often unobserved (only POS data). Lost sales from stockouts are invisible, understating true demand variability.

## References

- For Lee-Padmanabhan-Whang formal model, see `references/bullwhip-model.md`
- For information sharing strategies, see `references/information-sharing.md`