Optimization Interactive
Linear Programming
Optimize resource allocation under constraints. Find the best budget split, pricing mix, or exposure limits to maximize profit.
๐ LP Framework
Decision Variables
What you control (allocations, prices, quantities)
xโ = social budget, xโ = search budget...Objective Function
What to maximize/minimize
max: 1.5xโ + 2.0xโ + 1.8xโConstraints
Limits and requirements
xโ + xโ + xโ โค 100, xโ โฅ 10Non-negativity
Variables must be โฅ 0
xโ, xโ, xโ โฅ 0Budget & Returns
50 500
Social
ROI: 0.30
Search
ROI: 0.20
Display
ROI: 0.23
Constraints
10 80
10 80
5 40
๐ฏ Optimal Allocation
Social
$40K
40%
Search
$0K
0%
Display
$60K
60%
๐ Performance Comparison
Optimal Allocation
25.5
Total Return Units
Equal Allocation
24.2
Total Return Units
Optimization gain: +5.5%
๐ Sports Betting Applications
Liability Management
Maximize expected profit while limiting exposure per game, sport, or outcome.
max profit s.t. exposure_i โค limit_iPromo Budget Allocation
Allocate bonus budget across user segments to maximize LTV.
max ฮฃ ROI_i ร spend_i s.t. ฮฃ spend โค BMarket Mix
Optimize bet offering across markets (spreads, totals, props) for margin.
max margin s.t. diversity constraints๐ Standard Form
LP Standard Form
Maximize: c'x
Subject to: Ax โค b
x โฅ 0 - โข c: objective coefficients (returns)
- โข x: decision variables (allocations)
- โข A: constraint matrix
- โข b: constraint bounds
Solving Methods
- โ Simplex: Classic algorithm, walks vertices
- โ Interior Point: Faster for large problems
- โ Tools: R (lpSolve), Python (scipy, cvxpy)
R Code Equivalent
# Linear Programming with lpSolve
library(lpSolve)
# Objective: maximize returns
# Decision vars: [social, search, display]
obj_coef <- c(0.30,
0.20,
0.23)
# Constraints matrix
# 1. social + search + display โค budget
# 2. social โค max_social%
# 3. search โค max_search%
# 4. display โฅ min_display%
const_mat <- matrix(c(
1, 1, 1, # budget constraint
1, 0, 0, # social max
0, 1, 0, # search max
0, 0, -1 # display min (negated for โค form)
), nrow = 4, byrow = TRUE)
const_rhs <- c(100,
40,
50,
-10)
const_dir <- c("<=", "<=", "<=", "<=")
# Solve
solution <- lp("max", obj_coef, const_mat, const_dir, const_rhs)
print(solution$solution) # Optimal allocation
print(solution$objval) # Maximum returnโ Key Takeaways
- โข LP: optimize linear objective with linear constraints
- โข Simplex/Interior Point algorithms solve efficiently
- โข Use for budget allocation, liability limits
- โข Always check constraint feasibility
- โข Shadow prices show constraint value
- โข Extend to integer/quadratic for more complex cases