stochastic-optimization
When the user wants to optimize under uncertainty, handle probabilistic constraints, or solve stochastic programming problems. Also use when the user mentions "stochastic optimization," "chance constraints," "two-stage stochastic programming," "scenario-based optimization," "robust optimization under uncertainty," "stochastic demand," "uncertainty modeling," or "probabilistic optimization." For deterministic optimization, see optimization-modeling. For robust optimization, see metaheuristic-optimization.
Profile →npx skills add majiayu000/claude-skill-registry --skill stochastic-optimization --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Provides a stochastic-optimization skill that helps solve optimization problems under uncertainty in supply chains. It addresses two-stage stochastic programming for production planning with recourse, chance-constrained inventory optimization, and a Sample Average Approximation (SAA) approach for general stochastic problems. It includes concrete code examples and formulations for each method, guiding users through modeling, objective construction, and solution extraction.
How it works
- Two-Stage Stochastic Programming: Defines Stage 1 production decisions before uncertainty and Stage 2 recourse decisions after uncertainty. Builds an extensive form deterministic equivalent with variables for Stage 1 production and for each scenario's inventory and backorder. Objective combines Stage 1 cost and expected Stage 2 cost, then enforces capacity and scenario-specific balance constraints. Solves using a MILP solver and extracts production plans, plus per-scenario inventories and backorders.
- Chance-Constrained Optimization: For each product, uses a service level to convert a probabilistic constraint into a deterministic stock level via a normal approximation: s = μ + zα σ. Computes holding costs based on this stock level and reports per-product results including safety stock and service level.
- Sample Average Approximation (SAA): Outlines a procedure to approximate E[f(x,ξ)] by averaging over samples. Repeats generation of scenarios, solving the deterministic problem, and evaluating on out-of-sample tests to select a best solution.
When to use it
Use when the user explicitly mentions stochastic optimization, scenario-based optimization, chance constraints, two-stage stochastic programming, or uncertainty modeling in supply chain contexts. Also applicable when modeling demand uncertainty, lead times, prices, or other parameters with probabilistic treatment and a recourse structure is desired.
What it can touch
- Tools: claude-code
- It provides code blocks in Python illustrating usage with common libraries (numpy, PuLP, scipy) and shows how to structure models, variables, constraints, and objective formulations.
Caveats
- License: MIT
- The skill provides sample code and placeholder problem structures; real deployment requires adapting to specific data formats, solver availability, and problem sizes.
- It assumes availability of scenario data and, in the Chance-Constrained section, normal distribution assumptions for a closed-form solution of safety stock.
# Stochastic Optimization You are an expert in stochastic optimization and decision-making under uncertainty for supply chain. Your goal is to help solve optimization problems where parameters (demand, lead times, prices) are uncertain, using scenario-based methods, chance constraints, and risk measures. ## Initial Assessment Before applying stochastic optimization, understand: 1. **Uncertainty Characteristics** - What parameters are uncertain? (demand, supply, prices, lead times) - Probability distributions known or unknown? - Historical data available? - Uncertainty independent or correlated? 2. **Decision Structure** - Single-stage or multi-stage decisions? - Which decisions made before/after uncertainty reveals? - Recourse actions available? - Decision frequency? 3. **Risk Attitude** - Risk-neutral (expected value) or risk-averse? - Preferred risk measure? (CVaR, variance, worst-case) - Service level requirements? - Budget/capacity constraints? 4. **Computational Requirements** - Problem size? - Number of scenarios needed? - Solution time constraints? - Need for exact vs approximate solution? --- ## Two-Stage Stochastic Programming ### Framework **Stage 1 (Here-and-Now):** Deci
- Initial Assessment
- Two-Stage Stochastic Programming
- Framework
- Implementation: Production Planning Under Demand Uncertainty
- Chance-Constrained Optimization
- Probabilistic Constraints
- Implementation: Inventory with Service Level
- Sample Average Approximation (SAA)
- Method
- Implementation
- Risk Measures
- Conditional Value-at-Risk (CVaR)
- Multi-Stage Stochastic Programming
- Scenario Tree
What does the stochastic-optimization skill do?
When the user wants to optimize under uncertainty, handle probabilistic constraints, or solve stochastic programming problems. Also use when the user mentions "stochastic optimization," "chance constraints," "two-stage stochastic programming," "scenario-based optimization," "robust optimization under uncertainty," "stochastic demand," "uncertainty modeling," or "probabilistic optimization." For deterministic optimization, see optimization-modeling. For robust optimization, see metaheuristic-optimization.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill stochastic-optimization --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.