kishorkukreja/awesome-supply-chain/optimization-modeling

Claude Code and agent skill by kishorkukreja/awesome-supply-chain

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

When the user wants to build optimization models, solve mathematical programming problems, or find optimal solutions. Also use when the user mentions "linear programming," "integer programming," "mixed-integer programming," "constraint optimization," "mathematical optimization," "operations research," "optimal solution," or "decision optimization." For network design specifically, see network-design. For routing, see route-optimization.

Install

npx vskill@latest install kishorkukreja/awesome-supply-chain/optimization-modeling

SKILL.md

Optimization Modeling

You are an expert in mathematical optimization and operations research for supply chain. Your goal is to help formulate and solve optimization problems that find the best decisions subject to constraints, minimizing costs or maximizing profits and service levels.

Initial Assessment

Before building optimization models, understand:

  1. Business Problem
  • What decision needs to be made? (production, inventory, routing, scheduling)
  • What's being optimized? (minimize cost, maximize profit, maximize service)
  • Time horizon? (operational, tactical, strategic)
  • Expected impact and value?
  1. Decision Variables
  • What can be controlled? (quantities, assignments, schedules)
  • Continuous or discrete decisions?
  • Scale? (10 variables vs. 100,000 variables)
  1. Constraints
  • What limits exist? (capacity, budget, time, demand requirements)
  • Hard constraints (must satisfy) vs. soft constraints (preferences)?
  • How many constraints? (dozens vs. millions)
  1. Data Availability
  • All parameters known with certainty?
  • Uncertainty or variability?
  • Data quality and completeness?
  1. Technical Environment
  • Optimization expertise in team?
  • Solver access? (commercial vs. open-source)
  • Computational resources?
  • Integration requirements?

Optimization Problem Types

Linear Programming (LP)

Characteristics:

  • Continuous decision variables
  • Linear objective function
  • Linear constraints
  • Fast to solve (polynomial time)

Supply Chain Applications:

  • Production planning
  • Transportation optimization
  • Blending problems
  • Network flow optimization

Example: Production Planning

python
from pulp import *
import pandas as pd
def production_planning_lp(products, resources, demand, capacity, costs):
"""
Determine optimal production quantities
Decision: How much to produce of each product?
Objective: Minimize total production cost
Constraints: Resource capacity, meet demand
products: list of product names
resources: list of resource names
demand: dict {product: demand_quantity}
capacity: dict {resource: available_capacity}
costs: dict {(product, resource): cost_per_unit}
"""
# Create problem
prob = LpProblem("Production_Planning", LpMinimize)
# Decision variables: production quantity for each product
production = LpVariable.dicts("Produce",
products,
lowBound=0,
cat='Continuous')
# Objective: Minimize total cost
prob += lpSum([costs[product] * production[product]
for product in products]), "Total_Cost"
# Constraints
# 1. Meet demand
for product in products:
prob += production[product] >= demand[product], \
f"Meet_Demand_{product}"
# 2. Resource capacity
# Assume resource_usage[product][resource] is known
for resource in resources:
prob += lpSum([resource_usage[product][resource] * production[product]
for product in products]) <= capacity[resource], \
f"Capacity_{resource}"
# Solve
prob.solve(PULP_CBC_CMD(msg=1))
# Extract results
results = {
'status': LpStatus[prob.status],
'total_cost': value(prob.objective),
'production_plan': {
product: production[product].varValue
for product in products
}
}
return results
# Example data
products = ['Product_A', 'Product_B', 'Product_C']
resources = ['Labor', 'Machine', 'Material']
demand = {
'Product_A': 100,
'Product_B': 150,
'Product_C': 80
}
capacity = {
'Labor': 1000, # hours
'Machine': 800, # hours
'Material': 5000 # units
}
costs = {
'Product_A': 50,
'Product_B': 75,
'Product_C': 60
}
resource_usage = {
'Product_A': {'Labor': 2, 'Machine': 3, 'Material': 10},
'Product_B': {'Labor': 3, 'Machine': 2, 'Material': 15},
'Product_C': {'Labor': 1.5, 'Machine': 4, 'Material': 12}
}
result = production_planning_lp(products, resources, demand, capacity, costs)
print(f"Optimal Cost: ${result['total_cost']:,.2f}")
print("Production Plan:")
for product, qty in result['production_plan'].items():
print(f" {product}: {qty:.2f} units")
Integer Programming (IP) / Mixed-Integer Programming (MIP)

Characteristics:

  • Some/all variables must be integers
  • Binary (0/1) decisions common
  • NP-hard (exponential complexity)
  • Requires branch-and-bound or cutting planes

Supply Chain Applications:

  • Facility location
  • Assignment problems
  • Lot sizing with setup costs
  • Vehicle routing
  • Capacity planning

Example: Facility Location Problem

python
def facility_location_mip(customers, facilities, demand, costs_dict):
"""
Facility location problem with fixed costs
Decision:
- Which facilities to open (binary)
- How much to ship from each facility to each customer (continuous)
Objective: Minimize total cost (fixed + transportation)
customers: list of customer IDs
facilities: list of potential facility IDs
demand: dict {customer: demand}
costs_dict: {
'fixed': {facility: fixed_cost},
'capacity': {facility: capacity},
'transport': {(customer, facility): cost_per_unit}
}
"""
prob = LpProblem("Facility_Location", LpMinimize)
# Decision variables
# y[j] = 1 if facility j is opened, 0 otherwise
y = LpVariable.dicts("Open_Facility",
facilities,
cat='Binary')
# x[i,j] = quantity shipped from facility j to customer i
x = LpVariable.dicts("Ship",
[(i, j) for i in customers for j in facilities],
lowBound=0,
cat='Continuous')
# Objective: Minimize total cost
prob += (
# Fixed costs
lpSum([costs_dict['fixed'][j] * y[j] for j in facilities]) +
# Transportation costs
lpSum([costs_dict['transport'][i,j] * x[i,j]
for i in customers for j in facilities])
), "Total_Cost"
# Constraints
# 1. Demand satisfaction
for i in customers:
prob += lpSum([x[i,j] for j in facilities]) >= demand[i], \
f"Demand_{i}"
# 2. Capacity constraints
for j in facilities:
prob += lpSum([x[i,j] for i in customers]) <= \
costs_dict['capacity'][j] * y[j], \
f"Capacity_{j}"
# 3. Can only ship from open facilities
for i in customers:
for j in facilities:
prob += x[i,j] <= demand[i] * y[j], \
f"Open_Required_{i}_{j}"
# Solve
prob.solve(PULP_CBC_CMD(msg=1))
# Extract results
open_facilities = [j for j in facilities if y[j].varValue > 0.5]
flows = {}
for i in customers:
for j in facilities:
if x[i,j].varValue > 0.01:
flows[(i,j)] = x[i,j].varValue
results = {
'status': LpStatus[prob.status],
'total_cost': value(prob.objective),
'open_facilities': open_facilities,
'num_facilities': len(open_facilities),
'flows': flows
}
return results
# Example usage
customers = ['Customer_A', 'Customer_B', 'Customer_C', 'Customer_D']
facilities = ['DC_1', 'DC_2', 'DC_3']
demand = {
'Customer_A': 1000,
'Customer_B': 1500,
'Customer_C': 800,
'Customer_D': 1200
}
costs_dict = {
'fixed': {
'DC_1': 500000,
'DC_2': 600000,
'DC_3': 450000
},
'capacity': {
'DC_1': 3000,
'DC_2': 2500,
'DC_3': 2000
},
'transport': {
('Customer_A', 'DC_1'): 5.0,
('Customer_A', 'DC_2'): 8.0,
('Customer_A', 'DC_3'): 12.0,
('Customer_B', 'DC_1'): 7.0,
('Customer_B', 'DC_2'): 4.0,
('Customer_B', 'DC_3'): 9.0,
('Customer_C', 'DC_1'): 10.0,
('Customer_C', 'DC_2'): 6.0,
('Customer_C', 'DC_3'): 5.0,
('Customer_D', 'DC_1'): 8.0,
('Customer_D', 'DC_2'): 9.0,
('Customer_D', 'DC_3'): 7.0
}
}
result = facility_location_mip(customers, facilities, demand, costs_dict)
print(f"\nOptimal Solution:")
print(f"Total Cost: ${result['total_cost']:,.2f}")
print(f"Open Facilities: {result['open_facilities']}")
Nonlinear Programming (NLP)

Characteristics:

  • Nonlinear objective or constraints
  • Continuous variables
  • Local vs. global optima
  • Requires specialized solvers

Supply Chain Applications:

  • Inventory optimization with nonlinear holding costs
  • Pricing optimization
  • Production with economies of scale
  • Supply chain network with nonlinear costs
python
from scipy.optimize import minimize
import numpy as np
def inventory_optimization_nlp(products_data, budget):
"""
Multi-product inventory optimization with nonlinear costs
Decision: Safety stock levels for each product
Objective: Minimize total cost (holding + stockout)
Constraint: Budget limit
products_data: list of dicts with {
'sku': product ID,
'demand_mean': average demand,
'demand_std': demand std dev,
'lead_time': lead time in days,
'unit_cost': cost per unit,
'stockout_cost': cost per stockout event
}
"""
n_products = len(products_data)
def objective(safety_stocks):
"""
Total cost: holding cost + expected stockout cost
holding cost = safety_stock * unit_cost * holding_rate
stockout cost = stockout_probability * stockout_cost
"""
total_cost = 0
holding_rate = 0.25 # 25% annual holding cost
for i, ss in enumerate(safety_stocks):
product = products_data[i]
# Holding cost (linear)
holding_cost = ss * product['unit_cost'] * holding_rate
# Stockout cost (nonlinear)
# Calculate service level from safety stock
from scipy import stats
std_during_lt = product['demand_std'] * np.sqrt(product['lead_time'])
if std_during_lt > 0:
z = ss / std_during_lt
service_level = stats.norm.cdf(z)
stockout_prob = 1 - service_level
else:
stockout_prob = 0
expected_stockout_cost = stockout_prob * product['stockout_cost']
total_cost += holding_cost + expected_stockout_cost
return total_cost
def budget_constraint(safety_stocks):
"""Budget constraint: total inventory value <= budget"""
total_value = sum(
ss * products_data[i]['unit_cost']
for i, ss in enumerate(safety_stocks)
)
return budget - total_value
# Initial guess: allocate budget equally
avg_unit_cost = np.mean([p['unit_cost'] for p in products_data])
x0 = np.full(n_products, budget / (n_products * avg_unit_cost))
# Constraints
constraints = [
{'type': 'ineq', 'fun': budget_constraint}
]
# Bounds: non-negative safety stock
bounds = [(0, None) for _ in range(n_products)]
# Solve
result = minimize(
objective,
x0,
method='SLSQP',
bounds=bounds,
constraints=constraints,
options={'disp': True}
)
# Extract results
optimal_ss = result.x
results_df = pd.DataFrame(products_data)
results_df['optimal_safety_stock'] = optimal_ss
results_df['inventory_value'] = optimal_ss * results_df['unit_cost']
return {
'status': 'Optimal' if result.success else 'Failed',
'total_cost': result.fun,
'products': results_df,
'total_inventory_value': results_df['inventory_value'].sum()
}

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
57
Repository forks
16
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Aug 2026, 2 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kishorkukreja/awesome-supply-chain/optimization-modeling/badge)](https://verified-skill.com/skills/kishorkukreja/awesome-supply-chain/optimization-modeling)

Something wrong with this skill or its page? Tell us.