--- id: wiki-2026-0508-operations-research title: Operations Research category: 10_Wiki/Topics status: verified canonical_id: self aliases: [OR, Management Science, Decision Science] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [optimization, decision-science, mathematical-programming] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: Python framework: PuLP/Gurobi/OR-Tools --- # Operations Research ## 매 한 줄 > **"매 decision-making을 mathematical model로"**. 매 WWII 군사 logistics에서 시작된 OR은 매 LP/MIP/network/queueing/simulation으로 확장, 매 2026 현재 supply chain·routing·scheduling·revenue management의 backbone이며 Gurobi 12 / OR-Tools 9.10 / Mosek가 매 industrial workhorse. ## 매 핵심 ### 매 4 sub-disciplines - **Mathematical Programming**: LP, MIP, NLP, SOCP, SDP. - **Network Models**: shortest path, max flow, min-cost flow, assignment. - **Stochastic Models**: queueing (M/M/c), Markov chains, MDP. - **Simulation**: discrete event, Monte Carlo, agent-based. ### 매 LP duality - Primal min cᵀx s.t. Ax ≥ b, x ≥ 0. - Dual max bᵀy s.t. Aᵀy ≤ c, y ≥ 0. - Strong duality: optimal values equal (Slater's condition). - Dual = shadow prices of constraints. ### 매 응용 1. **Supply chain**: facility location, inventory, transportation. 2. **Airline**: crew scheduling, fleet assignment, revenue management. 3. **Energy**: unit commitment, economic dispatch. 4. **Healthcare**: OR scheduling, ambulance routing. 5. **ML 교차**: structured prediction, MIP-based interpretability. ## 💻 패턴 ### Linear Programming with PuLP ```python import pulp prob = pulp.LpProblem("Diet", pulp.LpMinimize) x1 = pulp.LpVariable("bread", lowBound=0) x2 = pulp.LpVariable("milk", lowBound=0) prob += 2*x1 + 3*x2 # cost prob += 4*x1 + 3*x2 >= 100 # protein prob += 2*x1 + 5*x2 >= 80 # vitamin prob.solve(pulp.GUROBI_CMD(msg=0)) print(x1.varValue, x2.varValue, pulp.value(prob.objective)) ``` ### MIP — Facility Location ```python from gurobipy import Model, GRB, quicksum m = Model() y = m.addVars(facilities, vtype=GRB.BINARY, name="open") x = m.addVars(facilities, customers, lb=0, name="ship") m.setObjective( quicksum(f[i]*y[i] for i in facilities) + quicksum(c[i,j]*x[i,j] for i in facilities for j in customers), GRB.MINIMIZE) m.addConstrs(quicksum(x[i,j] for i in facilities) == d[j] for j in customers) m.addConstrs(x[i,j] <= d[j]*y[i] for i in facilities for j in customers) m.optimize() ``` ### VRP with OR-Tools ```python from ortools.constraint_solver import pywrapcp, routing_enums_pb2 manager = pywrapcp.RoutingIndexManager(len(dist), num_vehicles, depot) routing = pywrapcp.RoutingModel(manager) def cb(i, j): return dist[manager.IndexToNode(i)][manager.IndexToNode(j)] idx = routing.RegisterTransitCallback(cb) routing.SetArcCostEvaluatorOfAllVehicles(idx) params = pywrapcp.DefaultRoutingSearchParameters() params.first_solution_strategy = routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC solution = routing.SolveWithParameters(params) ``` ### Min-Cost Flow (NetworkX) ```python import networkx as nx G = nx.DiGraph() G.add_edge('s', 'a', capacity=4, weight=2) G.add_edge('s', 'b', capacity=2, weight=4) G.add_edge('a', 't', capacity=3, weight=1) G.add_edge('b', 't', capacity=5, weight=3) flow_cost, flow_dict = nx.network_simplex(G) ``` ### M/M/c queue analysis ```python import math def mmc(lam, mu, c): rho = lam/(c*mu) p0_inv = sum((c*rho)**n / math.factorial(n) for n in range(c)) p0_inv += (c*rho)**c / (math.factorial(c)*(1-rho)) p0 = 1/p0_inv Lq = p0 * (c*rho)**c * rho / (math.factorial(c)*(1-rho)**2) Wq = Lq/lam return {'utilization': rho, 'Lq': Lq, 'Wq': Wq} ``` ### Stochastic 2-stage LP ```python # x: first-stage, y_s: scenario s recourse # min cᵀx + Σ pₛ qᵀyₛ s.t. Tx + Wyₛ = hₛ # Benders decomposition으로 solve 매 large-scale. ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | Continuous, linear | LP (simplex/interior point) | | Discrete decisions | MIP (branch & cut) | | Nonconvex | Global solver (BARON, Gurobi 12) or heuristic | | Stochastic | 2-stage SP / robust optimization | | Sequential decision | MDP / RL | | Combinatorial/routing | OR-Tools CP-SAT | **기본값**: Gurobi 12 (commercial) or HiGHS (open-source) for LP/MIP; OR-Tools CP-SAT for combinatorial. ## 🔗 Graph - 부모: [[Optimization]] · [[Mathematical-Programming]] - 변형: [[Linear-Programming]] · [[Integer-Programming]] - 응용: [[Supply-Chain]] - Adjacent: [[Reinforcement-Learning]] · [[Combinatorial-Optimization]] ## 🤖 LLM 활용 **언제**: 매 problem formulation translation (NL→model), constraint extraction, MIP warm-start heuristics, post-hoc 해석. **언제 X**: 매 numerical solving 자체 (LLM은 solver 호출 매 wrapping role). ## ❌ 안티패턴 - **Pure LLM solving**: 매 LLM은 OR solver 아님. 매 Gurobi/OR-Tools 매 사용. - **Ignoring duality**: 매 shadow price 매 sensitivity analysis 의 핵심. - **Over-tight constraints**: 매 infeasibility → IIS (irreducible inconsistent subsystem) 매 분석. - **Symmetry-blind MIP**: 매 symmetry breaking constraint 매 추가, branch tree 매 collapse. ## 🧪 검증 / 중복 - Verified (Hillier & Lieberman 11e, Bertsimas & Tsitsiklis, Gurobi docs). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — full OR overview with LP/MIP/VRP/queueing patterns |