9148c358d0
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 폴더 제거.
4.1 KiB
4.1 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-linear-programming | Linear Programming | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Linear Programming
매 한 줄
"매 LP는 선형 목적함수 + 선형 제약 → 최적해는 vertex에 있다". Simplex가 vertex 사이를 움직이고, interior point는 내부를 가로지른다.
매 핵심
매 표준형
- minimize cᵀx s.t. Ax ≤ b, x ≥ 0
- Feasible region = polytope (convex). 최적해는 항상 corner(꼭짓점) 또는 edge.
- LP relaxation → IP/MIP의 lower bound.
매 알고리즘 비교
- Simplex: vertex hopping. exponential worst case지만 실제는 빠름.
- Interior point (Karmarkar): polynomial time. 큰 LP에 유리.
- Dual simplex: 제약 추가 후 warm start에 강함 (branch-and-bound 내부).
매 응용
- Resource allocation, transportation, assignment
- Diet/blending, production scheduling
- Network flow (max-flow, min-cost-flow)
- ML: SVM (QP지만 LP-like), L1 regression, portfolio optimization
💻 패턴
scipy.optimize.linprog
from scipy.optimize import linprog
# minimize -x0 - 2x1 s.t. x0+x1<=4, x0+3x1<=6, x>=0
res = linprog(c=[-1, -2], A_ub=[[1,1],[1,3]], b_ub=[4,6],
bounds=[(0, None), (0, None)], method="highs")
print(res.x, res.fun) # [3, 1] -> -5
PuLP (선언적)
from pulp import LpProblem, LpVariable, LpMaximize, lpSum
prob = LpProblem("prod", LpMaximize)
x = LpVariable.dicts("x", ["A", "B"], lowBound=0)
prob += 40*x["A"] + 30*x["B"] # objective
prob += 2*x["A"] + x["B"] <= 100 # labor
prob += x["A"] + x["B"] <= 80 # material
prob.solve()
OR-Tools (production)
from ortools.linear_solver import pywraplp
solver = pywraplp.Solver.CreateSolver("GLOP") # LP. "CBC" for MIP
x = solver.NumVar(0, solver.infinity(), "x")
y = solver.NumVar(0, solver.infinity(), "y")
solver.Add(x + 2*y <= 14); solver.Add(3*x - y >= 0)
solver.Maximize(3*x + 4*y)
solver.Solve()
Integer/Mixed-Integer LP
# PuLP with integer variables
x = LpVariable("x", lowBound=0, cat="Integer")
y = LpVariable("y", lowBound=0, upBound=1, cat="Binary")
# branch-and-bound: LP relaxation → branch on fractional vars
Transportation problem
# min sum c_ij x_ij s.t. sum_j x_ij = supply_i, sum_i x_ij = demand_j
costs = [[8, 6, 10], [9, 12, 13], [14, 9, 16]]
supply = [20, 30, 25]; demand = [10, 35, 30]
# flatten to linprog
Sensitivity / dual
# scipy returns marginals via res.ineqlin.marginals (HiGHS)
# Dual variable = shadow price of constraint
매 결정 기준
| 상황 | Tool |
|---|---|
| 빠른 prototype | scipy.linprog (HiGHS) |
| 선언적/큰 모델 | PuLP |
| Production / MIP | OR-Tools, Gurobi, CPLEX |
| 정수 변수 多 | CBC, Gurobi (commercial) |
| Network flow | NetworkX, OR-Tools min_cost_flow |
기본값: scipy HiGHS → 부족하면 PuLP+CBC → 상용 Gurobi.
🔗 Graph
- 부모: Optimization
- 변형: Integer-Programming
- Adjacent: SVM
🤖 LLM 활용
언제: LP 모델링 (변수/제약 도출), code 생성, 결과 해석. 언제 X: 대규모 commercial solver tuning, numerical stability 진단은 전문가.
❌ 안티패턴
- 비선형 제약을 LP로 모델링 (→ NLP/QP 필요)
- 정수 변수에 LP 그대로 적용 (반올림 ≠ 최적)
- 큰 dense A matrix를 sparse 변환 없이 사용
- Unbounded/infeasible 모델 진단 없이 결과 신뢰
🧪 검증 / 중복
- Verified (Bertsimas Tsitsiklis "Intro to LO", scipy/PuLP/OR-Tools docs). 신뢰도 A.
- 중복: 없음 (LP는 독립 토픽).
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 매 prefix, scipy/PuLP/OR-Tools 패턴 |