Marketing Science

MIP for Marketing Budget Allocation: A Complete Guide

Learn how Mixed Integer Programming (MIP) with discretized response curves solves marketing budget allocation problems using branch-and-bound methods.

Cyril Noirot
By Cyril NoirotSeptember 9, 20255 min read
Share on

When optimizing marketing budgets in MMM, you're solving a constrained non-linear optimization problem. Mixed Integer Programming (MIP) with discretized response curves guarantees finding the global optimum through branch-and-bound algorithms.

The Optimization problem

Given fitted response curves, maximize total response subject to constraints:

max⁡X1,X2,…,Xn∑i=1nRi(Xi)\max_{X_1, X_2, \ldots, X_n} \sum_{i=1}^{n} R_i(X_i)

Subject to:

  • Budget constraint: ∑iXi=B\sum_i X_i = B
  • Business constraints: Li≤Xi≤UiL_i \leq X_i \leq U_i

Where Ri(Xi)R_i(X_i) is a non-linear response function (Hill or Michaelis-Menten).

Problem Modeling for MMM Optimization

Before discretization, we must formulate the marketing allocation problem mathematically. This modeling phase translates business objectives and constraints into mathematical expressions.

Key model components

Decision Variables: These represent budget allocation choices:

  • Continuous: Spend amount per channel (e.g., XTVX_{\text{TV}} = TV budget)
  • Binary: Channel activation decisions (e.g., zi∈{0,1}z_i \in \{0,1\} for on/off)
  • Discrete: Campaign count or creative versions (e.g., number of TV spots)
  • Semi-continuous: Zero or within range (e.g., Xi=0X_i = 0 or Xi∈[Li,Ui]X_i \in [L_i, U_i])

Objective Function: The marketing goal to optimize:

  • Single-Objective:
    • Maximization: Total conversions, revenue, or reach
    • Minimization: Total budget
  • Multi-Objective:
    • Constrained: Maximize revenue subject to defined spend

Constraints: Business rules and limitations:

  • Budget Constraints: Total spend cannot exceed available budget
  • Channel-Specific:
    • Minimum viable spend (e.g., TV needs $500K minimum)
    • Maximum capacity (e.g., Product limited by inventory)
    • Pacing requirements (e.g., even monthly distribution)
  • Business Policy:
    • Brand safety ratios (e.g., digital ≤ 60% of total)
    • Competitive parity (e.g., TV spend ≥ competitor benchmark)
    • Portfolio balance (e.g., upper/lower funnel mix)
  • Operational:
    • Creative production capacity
    • Agency resource limitations
    • Approval thresholds

MMM-Specific Formulation

For marketing mix optimization, the standard formulation becomes:

Variables: X=[X1,X2,...,Xn]X = [X_1, X_2, ..., X_n] where XiX_i is spend on channel ii

Objective: max⁡∑i=1nRi(Xi)\max \sum_{i=1}^n R_i(X_i) where RiR_i is the response function

Constraints:

  • Budget: ∑iXi=B\sum_i X_i = B
  • Bounds: Li≤Xi≤UiL_i \leq X_i \leq U_i
  • Ratios: ∑i∈GXi≥p⋅B\sum_{i \in G} X_i \geq p \cdot B for channel group GG
  • Change: (1−δ)Xiprev≤Xi≤(1+δ)Xiprev(1-\delta) X_i^{prev} \leq X_i \leq (1+\delta) X_i^{prev}

This formulation captures the essence of marketing allocation while maintaining mathematical rigor for optimization.

MIP Discretization Method

Step 1: Discretize Response Curves

Create discrete spend-response pairs by evaluating the response function:

{(si,0,ri,0),(si,1,ri,1),…,(si,m,ri,m)}\{(s_{i,0}, r_{i,0}), (s_{i,1}, r_{i,1}), \ldots, (s_{i,m}, r_{i,m})\}

Example discretization:

SpendResponseMarginal ROI
$00-
$500K3,2006.4x
$1M5,8005.2x
$1.5M7,9004.2x
$2M9,6003.4x

Step 2: Piecewise Linear Approximation

Connect discretization points with linear segments. Any spend between points becomes a convex combination:

Xi=λi,j⋅si,j+λi,j+1⋅si,j+1X_i = \lambda_{i,j} \cdot s_{i,j} + \lambda_{i,j+1} \cdot s_{i,j+1}

Where λi,j+λi,j+1=1\lambda_{i,j} + \lambda_{i,j+1} = 1.

Step 3: MIP Formulation

Objective: Maximize total response

max⁡∑i=1n∑j=0mri,j⋅λi,j\max \sum_{i=1}^{n} \sum_{j=0}^{m} r_{i,j} \cdot \lambda_{i,j}

Constraints:

  1. Budget: ∑i,jsi,j⋅λi,j=B\sum_{i,j} s_{i,j} \cdot \lambda_{i,j} = B
  2. Convexity: ∑jλi,j=1\sum_j \lambda_{i,j} = 1 for each channel
  3. SOS2: At most 2 adjacent λ\lambda can be non-zero

SOS2 (Special Ordered Set type 2) ensures we select either a single point or interpolate between two adjacent points, maintaining the piecewise linear structure.

Branch-and-Bound Solution Method

MIP solvers use branch-and-bound to guarantee global optimality:

How Branch-and-Bound Works

  1. Relaxation: Solve the linear programming relaxation (ignore integer/SOS2 constraints) to get an upper bound
  2. Branching: If solution violates SOS2, create two sub-problems by fixing variables
  3. Bounding: Each sub-problem provides bounds on the optimal value
  4. Pruning: Eliminate branches that cannot improve the current best solution
  5. Iteration: Continue until gap between upper and lower bounds is negligible

Why It Guarantees Global Optimality

  • The relaxation provides a guaranteed upper bound on the true optimum
  • Systematic exploration ensures no region is missed
  • Pruning eliminates only provably suboptimal regions
  • Convergence is guaranteed in finite time

For MMM with concave response curves, the piecewise linear approximation maintains concavity, making the branch-and-bound particularly efficient with tight bounds.

Business Constraints

MIP handles complex requirements naturally:

Minimum spend: Xi≥LiX_i \geq L_i

Channel ratios: ∑i∈DigitalXi≥0.5⋅B\sum_{i \in \text{Digital}} X_i \geq 0.5 \cdot B

Binary decisions: Channel on/off with minimum viable spend

Change limits: 0.7⋅Xicurrent≤Xi≤1.3⋅Xicurrent0.7 \cdot X_i^{\text{current}} \leq X_i \leq 1.3 \cdot X_i^{\text{current}}

Solver Comparison Matrix

SolverTypeSpeed (10ch×100seg)AccuracyCostBest For
GurobiCommercial0.05-0.2sOptimal$3K/yearProduction systems
CPLEXCommercial0.05-0.2sOptimal$4K/yearEnterprise deployment
XpressCommercial0.08-0.3sOptimal$3.5K/yearLarge-scale problems
CBCOpen-source1-5sOptimalFreePrototyping
GLPKOpen-source2-8sOptimalFreeAcademic research
SCIPAcademic0.5-3sOptimalFree (academic)Research

When to Use MIP

Use MIP for:

  • Production systems requiring optimal allocations
  • Complex business constraints
  • Binary activation decisions
  • Quarterly/annual planning

Consider alternatives for:

  • Real-time bidding (use heuristics)
  • Simple 2-3 channel problems (use gradient methods)
  • Quick prototyping during development

Key Takeaways

  • Branch-and-bound guarantees global optimality by systematic search with pruning
  • Discretization with 50-100 segments provides less than 1% error
  • SOS2 constraints maintain piecewise linear structure
  • Commercial solvers (Gurobi/CPLEX) are 10-100x faster than open-source
  • Shadow prices quantify the cost of each business constraint

For production MMM systems optimizing millions in marketing spend, MIP with branch-and-bound is the industry standard.

Further Reading

Solutions

Try the mechanics

About the author

Cyril Noirot

Cyril Noirot

Lead Data Scientist

Freelance data scientist. I design and ship decision systems — forecasting, pricing, marketing measurement, optimization.

Newsletter

Technical writing on forecasting, pricing, and decision systems. No fixed schedule, no spam.

Enter your email
Subscribe