Documentation
¶
Overview ¶
Package optfixture is the single source of the Compose `optimize` acceptance fixture: a deterministic weekly price / units cohort, a saved demand model, and the canonical request bodies over them — a price optimisation on a fitted linear demand curve (coef() over a `fits` entry), its twin over the saved model file (no refit), and a four-channel budget allocation over hill() response curves with Σx = budget and per-channel caps.
The root, CLI and MCP acceptance tests all build the cohort and read the requests from here, so every surface runs the same bytes. Test-support code only — nothing in the library imports it.
Index ¶
Constants ¶
const ( ModelIntercept = 120.0 ModelSlope = -4.0 ModelOptimum = 17.5 )
The saved demand model: units = ModelIntercept + ModelSlope · price, so its profit optimum (price − Cost)·units is (ModelSlope·Cost − ModelIntercept) / (2·ModelSlope) = ModelOptimum.
const CohortFile = "opt_price.pulse"
CohortFile is the cohort filename the request bodies name.
const Cost = 5.0
Cost is the unit cost the price requests set as params.cost.
const ModelPath = "models/demand" + model.FileSuffix
ModelPath is the saved demand model PriceModel loads.
const Weeks = 80
Weeks is the cohort's row count.
Variables ¶
var Budget []byte
Budget is the budget allocation: four channels, each a beta·hill(x, half, shape) response, maximising the total response under x_tv + x_search + x_social + x_display = params.budget, each channel in [0, its cap].
var Price []byte
Price is the price optimisation over the fitted demand curve: a REG_OLS `demand` fit (units on price) and a block maximising (price − params.cost)·(a + b·price) over price ∈ [1, 30].
var PriceModel []byte
PriceModel is Price over the saved model file at ModelPath (block `models`), no fit.
Functions ¶
func ModelFile ¶
ModelFile is the saved demand model's bytes (ModelIntercept, ModelSlope on price), for the instance filesystem at ModelPath.
Types ¶
This section is empty.