mod bayesian_pilot

module bayesian_pilot

Bayesian-pilot adaptation for SA / GSA hyperparameters.

The SA literature picks (T_0, sigma, q_v) by hand or grid search. This module replaces the grid with a principled Bayesian pilot: run n_pilot chains at prior draws, observe acceptance and improvement, fit a Laplace approximation to (log T_0, log sigma, q_v), then use the MAP estimate for the production SA run.

The q_v coordinate is the relevant model-selection axis: q_v=1 is BSA (Boltzmann/Gaussian), q_v=2 is FSA (Cauchy), and the heavy-tailed regime q_v in (1, 3) interpolates continuously. The pilot finds the q_v that best matches the objective’s geometry rather than committing to one of the fixed literature points by hand.

Why Laplace and not full INLA: the latent field here is three scalars (log T_0, log sigma, q_v), so the Laplace approximation is a 3x3 Hessian invert – analytic, deterministic, O(1). INLA’s sparse-precision-matrix machinery is overkill at this scale; sparse latent-field methods become the right scale when the cooling schedule has one parameter per epoch.

Convergence: when the pilot ends at epoch n_pilot and the production phase uses the fixed MAP hyperparameters thereafter, Hajek 1988 doi:10.1287/moor.13.2.311 applies to the production phase unchanged – the Bayesian-frozen SA inherits a.s. convergence to the global optimum. Online (unfrozen) adaptation is governed by the diminishing-adaptation condition of Roberts/Rosenthal 2007 doi:10.1239/jap/1183667414.

Variables

const Q_V_MAX: f64

Upper bound on q_v (just below 5/3 to keep q-Gaussian variance finite).

const Q_V_MIN: f64

Lower bound on q_v (just above 1 to avoid the BSA branch-switch).

const TARGET_ACCEPT_RATE: f64

Roberts/Rosenthal 2001 doi:10.1214/ss/1015346320: the asymptotically optimal acceptance rate for random-walk Metropolis on a generic product target. SA at high T behaves random-walk-like, so this is the target the pilot tries to match.

Functions

fn fit_laplace(obs: &[PilotObservation], prior: &PilotPrior) -> LaplacePosterior

Fit the Laplace approximation by a coarse 3D grid search followed by a finite-difference diagonal Hessian Newton step. Returns the MAP and posterior SDs in (log T_0, log sigma, q_v) space.

fn pilot_draws(prior: &PilotPrior, n_pilot: usize, seed: u64) -> Vec<(f64, f64, f64)>

Draw n_pilot (T_0, sigma, q_v) triples from the prior. The pilot phase itself (running chains, recording acceptance rates + best vals) happens in user code so this module stays Sampler-agnostic.

fn pilot_draws_qmc(prior: &PilotPrior, n_pilot: usize, seed: u64) -> Vec<(f64, f64, f64)>

Low-discrepancy design over the bounded high-mass prior region.

Structs and Unions

struct LaplacePosterior

Posterior summary returned by the Laplace fit.

t_init_map: f64

MAP estimate of T_0.

sigma_map: f64

MAP estimate of sigma.

q_v_map: f64

MAP estimate of q_v.

log_t_init_sd: f64

Posterior standard deviation of log T_0.

log_sigma_sd: f64

Posterior standard deviation of log sigma.

q_v_sd: f64

Posterior standard deviation of q_v (linear-scale, since q_v is bounded).

neg_log_post_map: f64

Negative log-posterior at the MAP (lower is better).

struct PilotObservation

One pilot observation: parameters tried + acceptance rate observed.

t_init: f64

Initial temperature drawn from the prior.

sigma: f64

Step size drawn from the prior.

q_v: f64

GSA visiting index drawn from the prior. q_v=1 is BSA, q_v=2 is FSA.

accept_rate: f64

Empirical acceptance rate from the chain.

best_val: f64

Best objective value reached during the pilot chain.

final_pos: Vec<f64>

Final position (used as warm start for the production phase).

struct PilotPrior

Prior specification: log-Normal on T_0 and sigma; truncated scaled-Beta on q_v over (Q_V_MIN, Q_V_MAX) with mode at 2 (FSA). Defaults match the IISE manuscript’s convention.

log_t_init_mean: f64

Mean of log T_0 under the prior.

log_t_init_sd: f64

Std of log T_0 under the prior.

log_sigma_mean: f64

Mean of log sigma under the prior.

log_sigma_sd: f64

Std of log sigma under the prior.

q_v_mean: f64

Prior mean of q_v (linear scale).

q_v_sd: f64

Prior std of q_v (linear scale).

Traits implemented

impl Default for PilotPrior