Quant Memo
Core

Stochastic Programming and Scenario Trees

An optimization framework for decisions made under uncertainty that unfolds over time — representing the range of possible futures as a branching tree of scenarios, and finding a decision (or sequence of decisions) that performs well on average across all of them, respecting what you'll actually know at each future date.

Prerequisites: Minimax and Worst-Case Optimization, Convex Sets and Convex Functions

Ordinary optimization assumes you know all the relevant numbers up front. But a pension fund deciding how to invest today needs to also plan how it will rebalance in five years — and by then it will know how markets actually moved, information it doesn't have today. A single static optimization can't represent "decide now, but also plan to react later once more is known." Stochastic programming solves this by explicitly modeling the sequence of decisions and information over time, using a tree of possible futures.

An analogy: planning a road trip with weather that reveals itself gradually

Imagine planning a multi-day drive where you must book tonight's hotel now, but you'll learn tomorrow's actual weather only when tomorrow arrives — and your day-2 route depends on which weather showed up. You wouldn't plan a single fixed route assuming one weather outcome; you'd sketch a branching plan: "if it's sunny by day 2, take the scenic coastal road; if it's stormy, take the inland highway" — and today's decision (which hotel, which car) should be sensible under both branches, since you don't get to peek at tomorrow's weather before booking tonight's hotel. That branching plan, respecting exactly what's known at each stage, is a scenario tree.

The framework, one symbol at a time

A scenario tree has nodes representing points in time where new information arrives; each node branches into several children, each child a possible realization of the uncertain quantity (a return, a rate move) with an associated probability. A two-stage stochastic program looks like

minx  cTx+Eω[Q(x,ω)],\min_{x} \; c^T x + \mathbb{E}_{\omega}\big[ Q(x, \omega) \big] ,

where xx is the here-and-now decision (made before uncertainty ω\omega is revealed, so it cannot depend on which scenario occurs), and Q(x,ω)Q(x,\omega) is the optimal cost of the best possible recourse (second-stage) decision, made after observing scenario ω\omega, given that the first-stage choice was xx. In plain English: choose your initial action to minimize its direct cost plus the expected cost of the best follow-up reaction you'll be able to make once you see how the world actually turned out — every scenario branch gets its own tailored reaction, but they all share the same trunk decision. A key structural rule, non-anticipativity, is that decisions at any node can only depend on information available up to that node — no branch of the tree is allowed to "know" what happens further down a different branch.

Worked example 1: a two-scenario hedging decision

A firm must decide today how many futures contracts xx to buy to hedge an exposure, at cost $2 per contract, before learning whether next month's move will be "up" (probability 0.4, requiring 10 contracts worth of coverage to fully hedge, cost per unhedged unit $5) or "down" (probability 0.6, requiring only 4 contracts, cost per unhedged unit $5). The two-stage cost is 2x+E[5×max(needx,0)]2x + \mathbb{E}[5\times\max(\text{need}-x, 0)]. Testing x=4x=4: cost =2(4)+0.4(5×max(104,0))+0.6(5×max(44,0))=8+0.4(30)+0=8+12=20= 2(4) + 0.4(5\times\max(10-4,0)) + 0.6(5\times\max(4-4,0)) = 8 + 0.4(30) + 0 = 8+12=20. Testing x=10x=10: cost =2(10)+0.4(0)+0.6(5×max(410,0))=20+0+0=20=2(10)+0.4(0)+0.6(5\times\max(4-10,0))=20+0+0=20 — but this wastes hedge capacity in the "down" scenario. Testing x=6x=6 (a compromise): cost =2(6)+0.4(5×4)+0.6(0)=12+8+0=20=2(6)+0.4(5\times4)+0.6(0)=12+8+0=20. Several choices tie here; the optimizer would search further to find the true minimizer, but the mechanics show how the single trunk decision xx is chosen to perform reasonably across both weighted branches, not optimally tuned to just one.

Worked example 2: a three-branch scenario tree probability check

A one-period tree branches into three scenarios at the next rebalancing date: "rally" (probability 0.25, portfolio value multiplier 1.15), "flat" (probability 0.50, multiplier 1.00), "selloff" (probability 0.25, multiplier 0.80). The expected value of a $1,000 position is 1000×(0.25×1.15+0.50×1.00+0.25×0.80)=1000×0.98751000\times(0.25\times1.15 + 0.50\times1.00 + 0.25\times0.80) = 1000\times0.9875, i.e. $987.50. A stochastic program comparing two different today-decisions (say, two different hedge ratios) would compute this expected value under each candidate decision, across all three branches, and pick whichever decision gives the best combination of expected outcome and acceptable downside in the selloff branch — the tree makes the selloff branch's outcome an explicit, separately visible number rather than something buried inside a single blended average.

today: choose x rally p=0.25 flat p=0.50 selloff p=0.25
A scenario tree: today's decision is a single trunk that must perform acceptably across every weighted future branch, since it is made before any branch's outcome is known.

What this means in practice

Stochastic programming underlies multi-period portfolio rebalancing, pension fund asset-liability management, and hedging strategies that must react to future information rather than committing to a single fixed plan. Its main practical challenge is that the scenario tree grows exponentially with the number of periods and branches per period, so real applications aggressively limit tree size (often via scenario reduction techniques) to keep the resulting optimization solvable.

Stochastic programming optimizes a today decision jointly with the best possible future reactions across every weighted branch of a scenario tree, respecting that today's decision cannot see which branch will occur — it's the standard way to formalize "decide now, but plan to adapt later" as a single solvable optimization problem.

A subtle and easy-to-violate rule is non-anticipativity: the here-and-now decision, and any decision at an earlier node, must not implicitly depend on information that only becomes available in a later branch. It's a common modeling bug to accidentally let an "average" or "expected" future value leak into today's decision in a way that effectively assumes partial foreknowledge of which branch will occur — silently turning a stochastic program into an overly optimistic, non-implementable plan that performs far worse once real future uncertainty is respected.

Related concepts

Practice in interviews

Further reading

  • Birge & Louveaux, Introduction to Stochastic Programming
  • Shapiro, Dentcheva & Ruszczyński, Lectures on Stochastic Programming
ShareTwitterLinkedIn