Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Optimization and operations research methods for business and logistics
.claude/skills/brycewang-stanford-operations-research-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 35% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 56% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 51% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 171% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 162% | 0% |
A skill for applying operations research (OR) methods to business, logistics, and resource allocation problems. Covers linear programming, integer programming, scheduling, network optimization, simulation, and decision analysis using Python optimization libraries.
pythonfrom scipy.optimize import linprog import numpy as np def solve_production_planning(): """ Example: A factory produces two products (A and B). Product A: profit $40, uses 2h labor + 1kg material Product B: profit $30, uses 1h labor + 2kg material Constraints: 100h labor available, 80kg material available Maximize total profit. """ # linprog minimizes, so negate for maximization c = [-40, -30] # objective coefficients (negated) # Inequality constraints: A_ub @ x <= b_ub A_ub = [ [2, 1], # labor constraint [1, 2], # material constraint ] b_ub = [100, 80] # Non-negativity bounds bounds = [(0, None), (0, None)] result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=bounds, method="highs") return { "product_A": result.x[0], "product_B": result.x[1], "max_profit": -result.fun, "status": "optimal" if result.success else "infeasible", }
pythonfrom pulp import LpProblem, LpMaximize, LpVariable, lpSum, value def workforce_scheduling(): """ Workforce scheduling: minimize staffing cost while meeting demand for each day of the week. Workers work 5 consecutive days. """ days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] demand = [17, 13, 15, 19, 14, 16, 11] cost_per_worker = 1 # uniform cost prob = LpProblem("workforce_scheduling", LpMaximize) # x[i] = number of workers starting on day i x = {i: LpVariable(f"start_{days[i]}", lowBound=0, cat="Integer") for i in range(7)} # Minimize total workers prob += -lpSum(x[i] for i in range(7)) # Each day, workers starting on days [d-4, d-3, ..., d] are available for d in range(7): workers_available = lpSum(x[(d - j) % 7] for j in range(5)) prob += workers_available >= demand[d], f"demand_{days[d]}" prob.solve() return { "status": prob.status, "schedule": {days[i]: int(value(x[i])) for i in range(7)}, "total_workers": int(sum(value(x[i]) for i in range(7))), }
pythonfrom itertools import combinations def solve_tsp_mtz(distances: np.ndarray) -> dict: """ Solve the Traveling Salesman Problem using Miller-Tucker-Zemlin formulation. distances: n x n distance matrix Returns optimal tour and total distance. """ from pulp import LpProblem, LpMinimize, LpVariable, LpBinary, lpSum, value n = len(distances) prob = LpProblem("TSP", LpMinimize) # Binary variables: x[i][j] = 1 if edge (i,j) in tour x = {(i, j): LpVariable(f"x_{i}_{j}", cat=LpBinary) for i in range(n) for j in range(n) if i != j} # Subtour elimination variables u = {i: LpVariable(f"u_{i}", lowBound=1, upBound=n - 1) for i in range(1, n)} # Objective: minimize total distance prob += lpSum(distances[i][j] * x[i, j] for i, j in x) # Each city visited exactly once for i in range(n): prob += lpSum(x[i, j] for j in range(n) if j != i) == 1 prob += lpSum(x[j, i] for j in range(n) if j != i) == 1 # MTZ subtour elimination for i in range(1, n): for j in range(1, n): if i != j: prob += u[i] - u[j] + (n - 1) * x[i, j] <= n - 2 prob.solve() # Extract tour tour = [0] current = 0 for _ in range(n - 1): for j in range(n): if j != current and (current, j) in x and value(x[current, j]) > 0.5: tour.append(j) current = j break return { "tour": tour, "total_distance": value(prob.objective), }
pythonfrom math import factorial, exp def mmc_queue(arrival_rate: float, service_rate: float, n_servers: int) -> dict: """ Analyze an M/M/c queue (Poisson arrivals, exponential service, c servers). arrival_rate: lambda (customers per unit time) service_rate: mu (customers served per unit time per server) n_servers: c (number of parallel servers) """ rho = arrival_rate / (n_servers * service_rate) if rho >= 1: return {"stable": False, "utilization": rho} # Erlang C formula: probability of waiting a = arrival_rate / service_rate sum_terms = sum(a ** k / factorial(k) for k in range(n_servers)) erlang_c = (a ** n_servers / factorial(n_servers)) / ( (a ** n_servers / factorial(n_servers)) + (1 - rho) * sum_terms ) # Performance metrics Lq = erlang_c * rho / (1 - rho) # avg queue length Wq = Lq / arrival_rate # avg wait time W = Wq + 1 / service_rate # avg time in system L = arrival_rate * W # avg number in system return { "stable": True, "utilization": round(rho, 4), "prob_wait": round(erlang_c, 4), "avg_queue_length": round(Lq, 4), "avg_wait_time": round(Wq, 4), "avg_system_time": round(W, 4), "avg_in_system": round(L, 4), }
pythonimport simpy import random def simulate_service_center(n_servers: int, arrival_rate: float, service_rate: float, sim_time: float = 480): """ Discrete-event simulation of a service center using SimPy. sim_time: simulation duration in minutes (default 8-hour day). """ wait_times = [] def customer(env, server): arrival_time = env.now with server.request() as req: yield req wait = env.now - arrival_time wait_times.append(wait) yield env.timeout(random.expovariate(service_rate)) def customer_generator(env, server): customer_id = 0 while True: yield env.timeout(random.expovariate(arrival_rate)) customer_id += 1 env.process(customer(env, server)) env = simpy.Environment() server = simpy.Resource(env, capacity=n_servers) env.process(customer_generator(env, server)) env.run(until=sim_time) return { "customers_served": len(wait_times), "avg_wait": np.mean(wait_times) if wait_times else 0, "max_wait": max(wait_times) if wait_times else 0, "pct_waited": sum(1 for w in wait_times if w > 0) / len(wait_times) * 100, }
| Method | Description | Best For | |--------|-------------|----------| | AHP (Analytic Hierarchy Process) | Pairwise comparison matrix | Structured group decisions | | TOPSIS | Distance to ideal/anti-ideal solution | Ranking alternatives | | Weighted scoring | Simple weighted sum | Quick comparisons | | Decision trees | Sequential decision under uncertainty | Multi-stage problems |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 16,349 | 27,158 | +66% | 1 | 1 | 0% | 3,272 | 5,156 | +58% | 0 | 0 | — |
case-02 | fail→fail | 16,177 | 18,591 | +15% | 1 | 1 | 0% | 3,370 | 6,387 | +90% | 0 | 0 | — |
case-03 | pass→pass | 13,747 | 10,003 | -27% | 1 | 1 | 0% | 2,830 | 4,282 | +51% | 0 | 0 | — |
case-04 | pass→pass | 6,460 | 4,709 | -27% | 1 | 1 | 0% | 1,145 | 3,098 | +171% | 0 | 0 | — |
case-05 | pass→pass | 7,723 | 6,935 | -10% | 1 | 1 | 0% | 1,337 | 3,500 | +162% | 0 | 0 | — |
case-19 | pass→pass | 4,658 | 3,944 | -15% | 1 | 1 | 0% | 793 | 3,013 | +280% | 0 | 0 | — |
case-06 | pass→pass | 13,835 | 9,697 | -30% | 1 | 1 | 0% | 2,593 | 4,199 | +62% | 0 | 0 | — |
case-07 | pass→pass | 19,321 | 19,624 | +2% | 1 | 1 | 0% | 3,654 | 6,262 | +71% | 0 | 0 | — |
case-08 | pass→pass | 10,549 | 15,213 | +44% | 1 | 1 | 0% | 2,005 | 4,814 | +140% | 0 | 0 | — |
case-09 | pass→pass | 10,148 | 6,966 | -31% | 1 | 1 | 0% | 1,819 | 3,600 | +98% | 0 | 0 | — |
case-10 | fail→pass | 11,703 | 2,976 | -75% | 1 | 1 | 0% | 2,098 | 2,841 | +35% | 0 | 0 | — |
case-11 | pass→pass | 11,265 | 12,108 | +7% | 1 | 1 | 0% | 2,093 | 4,593 | +119% | 0 | 0 | — |
case-12 | pass→pass | 4,755 | 3,372 | -29% | 1 | 1 | 0% | 849 | 2,900 | +242% | 0 | 0 | — |
case-13 | pass→pass | 8,137 | 6,959 | -14% | 1 | 1 | 0% | 1,286 | 3,688 | +187% | 0 | 0 | — |
case-14 | pass→pass | 7,423 | 9,802 | +32% | 1 | 1 | 0% | 1,273 | 4,242 | +233% | 0 | 0 | — |
case-15 | pass→pass | 9,801 | 10,399 | +6% | 1 | 1 | 0% | 1,746 | 4,234 | +142% | 0 | 0 | — |
case-16 | pass→pass | 13,674 | 7,328 | -46% | 1 | 1 | 0% | 2,431 | 3,603 | +48% | 0 | 0 | — |
case-17 | pass→pass | 13,608 | 12,471 | -8% | 1 | 1 | 0% | 2,305 | 4,432 | +92% | 0 | 0 | — |
case-18 | pass→pass | 8,152 | 6,645 | -18% | 1 | 1 | 0% | 1,523 | 3,575 | +135% | 0 | 0 | — |
case-20 | fail→pass | 11,970 | 2,550 | -79% | 1 | 1 | 0% | 1,816 | 2,837 | +56% | 0 | 0 | — |
case-21 | pass→pass | 13,381 | 10,938 | -18% | 1 | 1 | 0% | 2,052 | 4,429 | +116% | 0 | 0 | — |
case-22 | fail→fail | 33,770 | 22,751 | -33% | 1 | 1 | 0% | 6,350 | 6,517 | +3% | 0 | 0 | — |
case-23 | fail→fail | 21,639 | 22,460 | +4% | 1 | 1 | 0% | 4,467 | 6,868 | +54% | 0 | 0 | — |
case-24 | fail→fail | 19,577 | 25,721 | +31% | 1 | 1 | 0% | 4,029 | 7,584 | +88% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +8 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.