Optimisation Under Uncertainty: Stochastic Programming for Budget Allocation and Pricing Strategy

Most business decisions are made under uncertainty. You do not know future demand, competitor behaviour, customer response or exact costs in advance. But you still need to allocate budgets, set prices and plan resources. In this article, I explain how I use stochastic optimisation to model and optimise decisions in the presence of randomness, with practical applications to ad spend allocation, dynamic pricing and performance bidding systems.

Introduction: Decisions Under Uncertainty

Most business decisions are made under uncertainty. You do not know future demand, competitor behaviour, customer response or exact costs in advance. But you still need to allocate budgets, set prices and plan resources. That is where stochastic optimisation becomes powerful. It lets you model and optimise decisions in the presence of randomness.

I use these techniques in real client work when planning ad spend across channels, dynamic pricing structures and performance based bidding systems.

The Basic Problem: Optimisation with Uncertainty

Suppose you have a fixed marketing budget BB, and you want to allocate it across nn channels. Each channel ii has a random return Ri(xi,ω)R_i(x_i, \omega), where xix_i is the spend on channel ii and ω\omega represents the scenario (e.g. customer behaviour, conversion rate, CPC).

Your goal is to maximise expected return:

maxxEω[i=1nRi(xi,ω)]\max_{x} \mathbb{E}_{\omega} \left[ \sum_{i=1}^{n} R_i(x_i, \omega) \right]

Subject to:

i=1nxiB,xi0\sum_{i=1}^{n} x_i \leq B, \quad x_i \geq 0

This is a stochastic programming problem. The outcome depends on both your decision and an uncertain variable ω\omega.

Modelling Randomness: Scenario Based vs Distributional

There are two main ways I model uncertainty:

ApproachDescriptionWhen I Use It
Scenario basedGenerate finite set of scenarios ω1,ω2,,ωK\omega_1, \omega_2, \dots, \omega_K with probabilities pkp_kWhen historical data suggests discrete outcomes
Distribution basedModel ω\omega as continuous random variable (e.g. normal, log normal)When behaviour is smooth and well understood

The scenario version becomes:

maxxk=1Kpki=1nRi(xi,ωk)\max_x \sum_{k=1}^{K} p_k \sum_{i=1}^{n} R_i(x_i, \omega_k)

This is easier to solve numerically.

Constraint Relaxation: Softening the Boundaries

Real systems often break under hard constraints. So I use constraint relaxation to model reality more flexibly.

For example, if xiB\sum x_i \leq B is too strict (due to billing cycles, carry over budgets), I introduce a slack variable s0s \geq 0 and penalise it:

minxE[R(x)]+λs,xiB+s\min_x -\mathbb{E}[R(x)] + \lambda s, \quad \sum x_i \leq B + s

Here, λ\lambda is the penalty for overspending. It reflects how painful it is to exceed the budget. This allows for soft constraints, helpful when managing risk without being brittle.

Nonlinear Returns and Gradient Optimisation

Returns are rarely linear. For example, spending more on a channel often has diminishing returns:

Ri(xi)=ai(1ebixi)R_i(x_i) = a_i (1 - e^{-b_i x_i})

This is concave and models saturation, a common real world pattern.

To optimise such functions, I use stochastic gradient descent (SGD). This iteratively updates the spend vector xx by following the gradient of expected return:

x(t+1)=x(t)+ηE[R(x(t))]x^{(t+1)} = x^{(t)} + \eta \nabla \mathbb{E}[R(x^{(t)})]

Where η\eta is the learning rate and E[R(x)]\nabla \mathbb{E}[R(x)] is the gradient of expected return. I often estimate the gradient from sampled scenarios using Monte Carlo methods.

Duality Theory: Understanding Tradeoffs

Many optimisation problems have dual forms, which give insights into shadow prices, the value of relaxing a constraint.

If λ\lambda^* is the optimal dual variable for the budget constraint xiB\sum x_i \leq B, it tells you: "How much more value would I get from one more unit of budget?"

Formally, from the Lagrangian:

L(x,λ)=E[R(x)]+λ(xiB)\mathcal{L}(x, \lambda) = -\mathbb{E}[R(x)] + \lambda \left(\sum x_i - B\right)

We find the λ\lambda that satisfies the KKT (Karush Kuhn Tucker) conditions. This is especially useful for pricing and resource allocation.

Pricing Optimisation with Uncertain Demand

In pricing strategy, demand D(p,ω)D(p, \omega) depends on price pp and uncertain factors ω\omega (like seasonality, competitor price).

Revenue is R(p,ω)=pD(p,ω)R(p, \omega) = p \cdot D(p, \omega). The goal is:

maxpEω[pD(p,ω)]\max_p \mathbb{E}_{\omega}[p \cdot D(p, \omega)]

Assuming log linear demand:

D(p,ω)=α(ω)pβD(p, \omega) = \alpha(\omega) \cdot p^{-\beta}

I calibrate α\alpha and β\beta from historical data, run simulations under different pricing structures and optimise pp using either closed form derivation (if tractable) or numerical solvers.

Real Example: Performance Budget Across Channels

A client had to allocate £50,000 per month across paid search, social and affiliate. Each channel had different cost uncertainty and lead to revenue conversion volatility.

I built a stochastic model:

  1. Used historical variability as scenario inputs
  2. Applied nonlinear revenue functions per channel
  3. Estimated gradients with Monte Carlo sampling
  4. Ran constrained optimisation
ChannelOld AllocationNew AllocationExpected Return Change
Paid Search£25,000£22,000+8%
Social£15,000£18,000+12%
Affiliate£10,000£10,000Stable

The result: a new allocation plan that increased expected revenue by 18 percent while reducing downside risk exposure, all without increasing total spend.

Final Thought: Plan for Uncertainty, Not Around It

In growth work, you are always making decisions before the data is in. Pricing, bids, budgets, offers, all are exposed to uncertainty.

Stochastic optimisation allows me to model that risk explicitly, not ignore it. It helps businesses:

  • Maximise expected outcome
  • Account for variance, not just mean
  • Understand the cost of constraints
  • Allocate based on return potential, not surface performance

If you are still making deterministic plans in a probabilistic world, you are missing out on upside and underestimating your risk.

I can help you build models that reflect reality, not assumptions. And from those models, we extract strategies that scale.

Making budget or pricing decisions under uncertainty? I can help you build stochastic models that account for risk, optimise expected returns and give you confidence in volatile markets. Let's plan smarter.

Optimisation Under Uncertainty: Stochastic Programming for Budget Allocation and Pricing Strategy - Georg Keferböck