mod portfolio¶
- module portfolio¶
Thompson-allocated portfolio over the typed algebra’s building blocks.
One generic global optimizer with a single knob: the budget. Each building block is an arm of a Bernoulli bandit; a discounted Beta-Bernoulli posterior tracks the probability that one budget slice of an arm improves the incumbent, and Thompson sampling allocates the next slice. A decaying uniform-selection probability
min(1, 1/m)on roundmgives each ofKarms probability at least1/(Km). The divergent harmonic mass keeps every arm scheduled infinitely often and preserves the randomized restart guarantee.Scheduler quantities derive from the problem and the budget rather than from tuning knobs: the slice size affords a few gradient- equivalents and at least several expected rounds per arm; the posterior discount sets the effective memory to the slice horizon; the active arm count is capped by what the horizon can rank; the budget tail funds a final polish from the incumbent. Arm-internal constants reuse the defaults of the standalone drivers they wrap.
Work accounting is uniform: every true-objective evaluation and every native-gradient evaluation costs one unit of the shared budget. The additive surrogate is fit from the archive of already- charged evaluations, so its proposals cost only their acceptance tests.
Functions
- fn discovery_value(n1: usize, n: usize, w: usize) -> f64¶
D9.3: Good-Turing x record discovery value theta_disc = n1 / (n (w+1)).
-
fn portfolio_optimize<O, G>(obj: &O, grad: Option<&G>, budget: usize, seed: u64, noise_sigma: Option<f64>) -> PortfolioResult¶
where
O: Objective<f64>,
G: Gradient<f64>
¶ Runs the portfolio under the default auto policy.
-
fn portfolio_optimize_with_policy<O, G>(obj: &O, grad: Option<&G>, budget: usize, seed: u64, noise_sigma: Option<f64>, policy: PortfolioPolicy) -> PortfolioResult¶
where
O: Objective<f64>,
G: Gradient<f64>
¶ Runs the portfolio driver under a shared work-unit budget.
budgetbounds combined true-objective and native-gradient evaluations and is the driver’s only required parameter.gradenables the gradient arms and the final polish.policyselects regime auto-routing (Auto) or flat legacy order.
- fn win_objective_discovery(remaining: usize, polish: usize, slice_size: usize, theta_disc: f64, p_conv: f64) -> f64¶
D10.1 win objective under D9 discovery: W(p) = (q0+(1-q0)(1-pi_e))*P_conv.
theta_discisdiscovery_value;p_convis polish conversion probability for the proposed polish workpolish;slice_sizeis exploration slice length.
Enums
- enum PortfolioPolicy¶
Portfolio scheduling policy (GJQ-style: auto vs flat legacy for A/B).
- Auto¶
Feature-based regime selection + prior boosts (default shipped path).
- Legacy¶
Pre-regime behaviour: fixed Default arm order, uninformative Beta(1,1). Used only for same-protocol regression / A-B measurement.
Structs and Unions