Files
민헌andClaude Fable 5 dfb9ad6e66 초기 커밋 — 협상 AI 에이전트 정본: 엔진·데모 콘솔·측정 인프라·증빙
- server/: FastAPI 협상 엔진 (5라운드, Q-Table/UCB, 페르소나 계측, :53117)
- frontend/: 데모 콘솔 (React+Tailwind → nginx, /api 프록시)
- eval/·testdata/: 지표 8종 측정 하네스 + 재현 가능 테스트셋
- results/: 측정 증빙 (지표별 result+provenance, raw 원본 동결+SHA256)
  ① 86.0 · ② 76.0 · ③ 5.99% · ⑥ p95 3.61ms · ⑦ 611만/년 · ⑧ 91/100 · ⑨ 99.71 · ⑩ 97.99
- docker-compose.yml + run.sh: backend+frontend 일괄 기동

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0112XUWF4bc3gGrEt8vsYCzy
2026-08-31 13:09:52 +09:00

53 lines
2.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""협상 시나리오(4분면)·앵커링(9분면) 룰 — 중립 재현.
원본 근거 (협상엔진_분기_산식_정리.md 3절):
- 4분면: (구매볼륨 high/low) × (경쟁도 high/low) → Scenario A/B/D/C
- 9분면: 공급유형(유통/총판/제조) × 품목가격대(만원이하/만원초과 백만원미만/백만원이상)
→ anchoring_value 초기값
⑨ 라벨링 데이터와 ①③ 테스트셋 생성기가 공유한다.
"""
VOLUME_THRESHOLD = 10_000_000 # 품목 매출합 기준 (원)
def scenario_label(rq_type: str, dist: str, partners: int, revenue: float) -> str:
"""4분면 룰 — Scenario_A/B/C/D.
volume = high if 매출 ≥ 1,000만원
comp = high if 재견적 or 총판(W) or 공급사 ≥ 3
(high,high)=A, (high,low)=B, (low,high)=D, (low,low)=C
"""
volume_high = revenue >= VOLUME_THRESHOLD
comp_high = (rq_type == "재견적") or (dist == "W") or (partners >= 3)
if volume_high and comp_high:
return "Scenario_A"
if volume_high and not comp_high:
return "Scenario_B"
if not volume_high and comp_high:
return "Scenario_D"
return "Scenario_C"
# 9분면 anchoring_value 초기값: (dist, 가격대) → 값
# dist: R 유통 / W 총판 / M 제조, 가격대: 만원이하 / 만원초과 백만원미만 / 백만원이상
_ANCHORING_MATRIX = {
("R", "만원이하"): 0.01, ("W", "만원이하"): 0.02, ("M", "만원이하"): 0.03,
("R", "만원초과 백만원미만"): 0.04, ("W", "만원초과 백만원미만"): 0.05,
("M", "만원초과 백만원미만"): 0.06,
("R", "백만원이상"): 0.07, ("W", "백만원이상"): 0.08, ("M", "백만원이상"): 0.09,
}
def price_range(item_price: float) -> str:
if item_price <= 10_000:
return "만원이하"
if item_price < 1_000_000:
return "만원초과 백만원미만"
return "백만원이상"
def anchoring_value(dist: str, item_price: float) -> float:
"""9분면 초기값 룰 (주간 갱신 전 상태를 기준값으로 사용)."""
return _ANCHORING_MATRIX.get((dist, price_range(item_price)), 0.01)