Expand description
Continuous-prior loss integration for spatial / area-based optimization
(expected value, worst-case, CVaR over a continuous_area::Prior).
Continuous-prior loss integration for spatial / area-based optimization.
Generic over dimension via const generics: D=1 for a line of seats, D=2
for a listening rectangle, D=3 for a head-volume sweep, and so on.
§Three building blocks
Prior— the probability distribution π(p) over positions p ∈ R^D. CurrentlyUniformover an axis-aligned box and axis-alignedGaussianare first-class;Customaccepts an arbitrary density.Quadrature— how to discretise the integral into Q evaluation points. Supports Sobol (low-discrepancy QMC), Latin-Hypercube, and Gauss–Legendre tensor-product. Sobol/LH are seeded for determinism.AreaScalarisation— what to do with the Q losses: expected value, worst-case (max), or CVaR (mean of the worst α-tail).
§The high-level call
evaluate_area_loss takes a base loss L(params, p), a Prior, a
Quadrature, and a AreaScalarisation and returns one scalar that an
outer optimizer can minimise. The outer optimizer never sees the
quadrature; it just sees a robust scalar objective.
§Cost model
Each outer fitness call costs Q base-loss evaluations for ExpectedValue
and CVaR. WorstCase runs a small inner DE search per outer call —
callers should be aware this is more expensive (typically 10×–50× a single
base-loss eval).
use math_audio_optimisation::continuous_area::{
AreaScalarisation, Prior, Quadrature, evaluate_area_loss,
};
// Minimise expected value of (params[0] - p)^2 with p ~ Uniform([-1,1])
let prior: Prior<1> = Prior::Uniform { bounds: [(-1.0, 1.0)] };
let quadrature: Quadrature<1> = Quadrature::Sobol {
num_points: 128,
seed: 0,
};
let loss = |params: &[f64], p: [f64; 1]| (params[0] - p[0]).powi(2);
let value = evaluate_area_loss(&loss, &[0.0], &prior, &quadrature, AreaScalarisation::ExpectedValue);
assert!((value - 1.0 / 3.0).abs() < 0.05);Enums§
- Area
Error - Errors raised by continuous-area evaluation.
- Area
Scalarisation - How to scalarise the Q per-point losses into one outer-loop loss.
- Prior
- Probability density / sampling region over R^D.
- Quadrature
- Quadrature scheme for discretising the prior integral into Q sample points.
Functions§
- build_
quadrature_ points - Generate the quadrature points and corresponding integration weights.
- evaluate_
area_ loss - Evaluate a continuous-area loss.
- try_
evaluate_ area_ loss - Fallible version of
evaluate_area_loss: returns errors instead of panicking.