BudgetOptimizer.allocate_budget#
- BudgetOptimizer.allocate_budget(total_budget, budget_bounds=None, custom_constraints=None, minimize_kwargs=None)[source]#
Allocate the budget based on the total budget, budget bounds, and custom constraints.
The default budget bounds are (0, total_budget) for each channel.
The default constraint is the sum of all budgets should be equal to the total budget.
The optimization is done using the Sequential Least Squares Quadratic Programming (SLSQP) method and it’s constrained such that: 1. The sum of budgets across all channels equals the total available budget. 2. The budget allocated to each individual channel lies within its specified range.
The purpose is to maximize the total expected objective based on the inequality and equality constraints.
- Parameters:
- total_budget
float
The total budget.
- budget_bounds
dict
[str
,tuple
[float
,float
]], optional The budget bounds for each channel. Default is None.
- custom_constraints
dict
, optional Custom constraints for the optimization. Default is None.
- minimize_kwargs
dict
, optional Additional keyword arguments for the
scipy.optimize.minimize
function. If None, default values are used. Method is set to “SLSQP”, ftol is set to 1e-9, and maxiter is set to 1_000.
- total_budget
- Returns:
- Raises:
Exception
If the optimization fails, an exception is raised with the reason for the failure.