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:
Subject to:
- Budget constraint:
- Business constraints:
Where 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., = TV budget)
- Binary: Channel activation decisions (e.g., for on/off)
- Discrete: Campaign count or creative versions (e.g., number of TV spots)
- Semi-continuous: Zero or within range (e.g., or )
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: where is spend on channel
Objective: where is the response function
Constraints:
- Budget:
- Bounds:
- Ratios: for channel group
- Change:
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:
Example discretization:
| Spend | Response | Marginal ROI |
|---|---|---|
| $0 | 0 | - |
| $500K | 3,200 | 6.4x |
| $1M | 5,800 | 5.2x |
| $1.5M | 7,900 | 4.2x |
| $2M | 9,600 | 3.4x |
Step 2: Piecewise Linear Approximation
Connect discretization points with linear segments. Any spend between points becomes a convex combination:
Where .
Step 3: MIP Formulation
Objective: Maximize total response
Constraints:
- Budget:
- Convexity: for each channel
- SOS2: At most 2 adjacent 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
- Relaxation: Solve the linear programming relaxation (ignore integer/SOS2 constraints) to get an upper bound
- Branching: If solution violates SOS2, create two sub-problems by fixing variables
- Bounding: Each sub-problem provides bounds on the optimal value
- Pruning: Eliminate branches that cannot improve the current best solution
- 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:
Channel ratios:
Binary decisions: Channel on/off with minimum viable spend
Change limits:
Solver Comparison Matrix
| Solver | Type | Speed (10ch×100seg) | Accuracy | Cost | Best For |
|---|---|---|---|---|---|
| Gurobi | Commercial | 0.05-0.2s | Optimal | $3K/year | Production systems |
| CPLEX | Commercial | 0.05-0.2s | Optimal | $4K/year | Enterprise deployment |
| Xpress | Commercial | 0.08-0.3s | Optimal | $3.5K/year | Large-scale problems |
| CBC | Open-source | 1-5s | Optimal | Free | Prototyping |
| GLPK | Open-source | 2-8s | Optimal | Free | Academic research |
| SCIP | Academic | 0.5-3s | Optimal | Free (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
- Mixed Integer Programming (MIP) - A Primer on the Basics - Excellent introduction from Gurobi
- Mixed Integer Programming Glossary - NVIDIA's technical overview
- Branch and Bound Algorithm - Wikipedia overview
- The Role of the Optimizer in MMM
- Practical Optimizer Scenarios in MMM
Solutions
Try the mechanics
About the author

Cyril Noirot
Lead Data Scientist
Freelance data scientist. I design and ship decision systems — forecasting, pricing, marketing measurement, optimization.