Files
2nd/10_Wiki/Topic_Programming/AI_and_ML/Replenishment.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

6.2 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-replenishment Replenishment 10_Wiki/Topics verified self
Inventory Replenishment
Stock Replenishment
재고보충
none A 0.9 applied
supply-chain
inventory
operations
forecasting
optimization
2026-05-10 pending
language framework
Python pandas/scipy/forecasting

Replenishment

매 한 줄

"매 right item, right quantity, right time.". Replenishment 매 inventory 가 demand 의 동안 stockout 의 X 의 process 의 maintaining. 1934 Wilson EOQ 부터 modern AI-driven probabilistic forecasting (Amazon, Walmart 의 LSTM/Transformer demand models) 까지 evolved.

매 핵심

매 핵심 levers

  • Reorder Point (ROP): trigger threshold = lead_time_demand + safety_stock.
  • Order Quantity: how much (EOQ, min-max, fixed).
  • Review period: continuous (Q-system) 의 X periodic (P-system).
  • Safety Stock: buffer 의 demand/lead-time variability 의.

매 modern signals

  • Probabilistic demand forecast (quantiles, 의 X point estimate).
  • Lead time variance (supplier reliability score).
  • Cross-location pooling (omnichannel inventory).
  • Substitution + promotion lift modeling.

매 응용

  1. Retail (Walmart, Costco 의 daily auto-replenishment).
  2. E-commerce FBA (Amazon 의 fulfillment center distribution).
  3. Manufacturing MRP (BOM-driven component replenishment).
  4. Healthcare (vaccine, drug 의 cold-chain replenishment).

💻 패턴

EOQ (Economic Order Quantity)

import math

def eoq(annual_demand: float, order_cost: float, holding_cost_per_unit: float) -> float:
    """Wilson formula. Min total cost = order + holding."""
    return math.sqrt(2 * annual_demand * order_cost / holding_cost_per_unit)

# Example: 10K units/yr, $50/order, $2/unit/yr holding
print(eoq(10_000, 50, 2))  # 707 units per order

Reorder Point with Safety Stock

from scipy.stats import norm

def reorder_point(daily_demand_mean, daily_demand_std,
                  lead_time_days, service_level=0.95):
    z = norm.ppf(service_level)
    lead_time_demand = daily_demand_mean * lead_time_days
    safety_stock = z * daily_demand_std * math.sqrt(lead_time_days)
    return lead_time_demand + safety_stock, safety_stock

Min-Max (s, S) Policy

def min_max_order(on_hand: int, on_order: int, s: int, S: int) -> int:
    """매 inventory_position <= s 일 때 S 까지 order."""
    inv_pos = on_hand + on_order
    return max(0, S - inv_pos) if inv_pos <= s else 0

Probabilistic Forecast → Newsvendor

import numpy as np

def newsvendor_quantile(unit_cost, sale_price, salvage=0):
    """Critical ratio = (p - c) / (p - s)."""
    return (sale_price - unit_cost) / (sale_price - salvage)

def order_qty_from_forecast(demand_samples: np.ndarray, critical_ratio: float):
    return float(np.quantile(demand_samples, critical_ratio))

# 1000 Monte Carlo demand samples → optimal order
samples = np.random.gamma(shape=4, scale=25, size=1000)
cr = newsvendor_quantile(unit_cost=10, sale_price=25, salvage=3)
print(order_qty_from_forecast(samples, cr))

LSTM Demand Forecast (modern)

import torch.nn as nn

class DemandLSTM(nn.Module):
    def __init__(self, n_features=8, hidden=64):
        super().__init__()
        self.lstm = nn.LSTM(n_features, hidden, num_layers=2,
                            dropout=0.2, batch_first=True)
        self.head = nn.Linear(hidden, 3)  # P10, P50, P90 quantiles

    def forward(self, x):
        out, _ = self.lstm(x)
        return self.head(out[:, -1])

Multi-Echelon Allocation

def fair_share_allocation(forecasts: dict, total_supply: float) -> dict:
    """Allocate constrained supply across stores proportional to forecast."""
    total_demand = sum(forecasts.values())
    if total_supply >= total_demand:
        return forecasts.copy()
    ratio = total_supply / total_demand
    return {loc: f * ratio for loc, f in forecasts.items()}

KPI Dashboard

def replenishment_kpis(history: list[dict]) -> dict:
    stockouts = sum(1 for d in history if d["on_hand"] == 0)
    fill_rate = sum(d["fulfilled"] for d in history) / sum(d["demanded"] for d in history)
    avg_inv = sum(d["on_hand"] for d in history) / len(history)
    return {
        "service_level": 1 - stockouts / len(history),
        "fill_rate": fill_rate,
        "avg_inventory": avg_inv,
        "inventory_turns": sum(d["demanded"] for d in history) / avg_inv,
    }

매 결정 기준

상황 Approach
Stable demand, known lead time EOQ + ROP
Highly variable demand Probabilistic forecast + newsvendor
Many SKUs, low value Min-Max (s, S)
Perishable / fashion Newsvendor (single-period)
Multi-location, constrained supply Fair-share / DRP
Modern e-commerce scale ML demand model + RL ordering policy

기본값: Probabilistic LSTM forecast → newsvendor quantile order. 매 P50 forecast + ROP 의 단순 baseline 의 X.

🔗 Graph

🤖 LLM 활용

언제: SKU master data 의 cleansing, supplier email parsing, anomaly explanation, what-if scenario 의 narrative. 언제 X: 매 actual demand forecasting 의 LLM 의 X — purpose-built time-series models (Prophet, NeuralForecast, Chronos) 의 use.

안티패턴

  • Point forecast only: P50 만 사용 의 X — quantiles 의 사용 의 service level tuning 의 가능.
  • Static safety stock: lead time 의 variance 의 ignore 의 X.
  • Local optimization: 각 store 의 independent ordering — pooling 의 lost.
  • Bullwhip ignored: downstream order 의 upstream 의 amplification 의 monitor 의 필요.
  • Excel-only: 1000+ SKU 의 manual review 의 scale 의 X.

🧪 검증 / 중복

  • Verified (Silver/Pyke "Inventory Management" textbook, AWS Forecast docs).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — replenishment policy + ML forecasting patterns