Pattern library

Optimization patterns

Each pattern is a recurring decision structure with a known way to model and solve it. Full guides follow a ten-part template, from the problem and the formulation through Python and common mistakes. Notes are short, correct references that will grow into guides.

4 full guides · 16 notes · 23 planned

Mathematical programming

Linear and integer models: formulations, linearizations, and the structures solvers exploit.

Linear programming

Optimize a linear objective over linear constraints; the foundation everything else builds on.

Planned

Mixed-integer linear programming

Add integrality to model yes/no decisions, setups, and discrete quantities.

Planned

Linearization techniques

Rewrite products, logic, absolute values, maxima, and piecewise costs as linear constraints with auxiliary variables, so a mixed-integer linear solver can handle them exactly.

Full guideIntermediate

Network flows

Route flow through a network of nodes and capacity-limited arcs at minimum cost — the general pattern underlying transportation, assignment, and many logistics problems.

NoteIntermediate

Knapsack problems

Choose the most valuable subset that fits a capacity; the prototype of combinatorial selection.

Planned

Facility location

Decide which facilities to open, and which customers each open facility should serve, to minimize fixed and transportation cost together.

NoteIntermediate

Scheduling

Sequence a set of jobs across shared machines, respecting each job's required operation order, to minimize total completion time.

NoteAdvanced

Decomposition methods

Benders, column generation, and Lagrangian relaxation for models too large to solve whole.

Planned

Absolute Value Linearization

Rewrite |x| in an objective or constraint as a pair of linear terms — no binaries required.

NoteBeginner

Assignment Problem

Match a set of agents to a set of tasks one-to-one at minimum total cost — the simplest combinatorial optimization pattern, and a building block for much bigger ones.

NoteBeginner

Big-M Method

Turn an "if this binary is on, then this constraint applies" rule into a linear constraint MILP solvers can handle directly.

NoteIntermediate

Chance Constraints

Require a constraint to hold with at least a target probability, rather than always — a way to bake in a service-level target directly.

NoteAdvanced

Indicator Constraints

Express "if binary y = 1, then constraint C holds" natively, without hand-tuning a Big-M constant.

NoteIntermediate

Logical Constraints (AND / OR / XOR)

Encode boolean logic between binary decisions — "at least one of", "exactly one of", "not both" — as linear constraints.

NoteIntermediate

Min/Max Linearization

Represent max(a, b) or min(a, b) as auxiliary variables and linear constraints so they can appear in a MILP.

NoteIntermediate

Piecewise Linear Approximation

Approximate a nonlinear cost or production curve with connected line segments so a linear/MILP solver can still optimize over it.

NoteAdvanced

Transportation Problem

Ship goods from a set of supply points to a set of demand points at minimum cost, respecting supply and demand limits.

NoteBeginner

Traveling Salesman Problem (TSP)

Find the shortest route that visits every location exactly once and returns to the start — the base case every routing problem builds on.

NoteAdvanced

Two-Stage Stochastic Programming

Make a decision now, observe uncertainty, then make a follow-up decision — optimizing the first-stage choice against the expected cost of every possible second-stage outcome.

NoteAdvanced

Vehicle Routing Problem (VRP)

Route a fleet of capacity-constrained vehicles to serve a set of customers at minimum cost — the workhorse formulation behind most delivery networks.

NoteAdvanced

Sequential decision-making

Decisions that repeat under uncertainty: dynamic programming, MDPs, and policies.

Dynamic programming

Solve a problem by solving each of its overlapping subproblems once and building the answer from them. The same idea, written as the Bellman equation, is the foundation of sequential decision-making.

Full guideIntermediate

Markov decision processes

States, actions, transition probabilities, and rewards: the language of sequential decisions.

Planned

Approximate dynamic programming

When the state space is too large to enumerate, approximate the value function.

Planned

Reinforcement learning

Learn a policy from interaction rather than from a known model.

Planned

Policy search

Tune the parameters of a simple decision rule directly against simulated performance.

Planned

Simulation-based optimization

Optimize a decision whose consequences can only be evaluated by simulation.

Planned

Inventory and supply chain

How much to order, when, and where: the economics of stock under uncertain demand.

Newsvendor model

Choose one order quantity before uncertain demand is known, when every unit short and every unit left over has a cost. The answer is a quantile of demand, set by the ratio of the two costs.

Full guideBeginner

Critical ratio

The ratio of what a shortage costs to the total cost of both mistakes. It tells you which percentile of demand to stock to, and it is why the right service level differs from SKU to SKU.

Full guideBeginner

Economic order quantity

Find the order quantity that minimizes the trade-off between ordering cost and holding cost under steady, known demand.

NoteBeginner

Safety stock

Buffer stock against demand and lead-time uncertainty, sized by economics rather than habit.

Planned

Reorder-point policies

Order when inventory position falls to a threshold: the (s, Q) family.

Planned

Order-up-to policies

Review periodically and order back up to a target level: the (R, S) family.

Planned

Multi-echelon inventory

Where to hold stock in a network, and why the right answer is rarely everywhere.

Planned

Minimum order quantities

What a vendor minimum does to the optimal order, and when to accept it.

Planned

Quantity discounts

When a price break is worth the extra stock it forces you to carry.

Planned

Stochastic inventory optimization

Multi-period inventory decisions under uncertain demand and lead time.

Planned

Algorithms and computational methods

Search, heuristics, and simulation: how answers actually get computed.

Greedy algorithms

Take the locally best step; know exactly when that is globally optimal.

Planned

Local search

Improve a solution by small moves; the atomic move defines the algorithm.

Planned

Hill climbing

Accept only improving moves, and understand why it stalls.

Planned

Simulated annealing

Accept some worsening moves on a cooling schedule to escape local optima.

Planned

Bayesian optimization

Optimize an expensive black-box function with a surrogate model and an acquisition rule.

Planned

Branch and bound

How MILP solvers prove optimality: relax, branch, and prune with bounds.

Planned

Monte Carlo simulation

Estimate expectations and risks by sampling, and know how many samples you need.

Planned