mod leave_learn

module leave_learn

Leave cover and action credit: FunnelModel EI plus Thompson on what paid.

Occupancy already fits crate::funnel_bo::FunnelModel on packing histograms and uses it to retire. That model never chose the next Leave: cover indices were replica + leave * wave, and a one-community book walked rather than proposed. Expected improvement is how a search reaches a funnel it has no evidence about (Jones, Schonlau & Welch, J. Global Optim. 1998). Thompson on the covers and actions that later dropped the energy is how the same replica stops repeating a hole that quenched back to ico.

Arms of the cover bandit are the SoftSaddle covering points plus one fivefold residual. Arms of the action bandit are local walk, explore, and Leave.

Variables

const ACTION_EXPLORE: usize

Action bandit: descriptor-space explore.

const ACTION_LEAVE: usize

Action bandit: Leave the occupied packing.

const ACTION_LOCAL: usize

Action bandit: keep walking the live minimum.

const LEAVE_EI_PROBES: usize

Proposals scored by EI before one of them is quenched.

Functions

fn cover_arm_count() -> usize

Covering points plus the fivefold residual as the last arm.

fn credit_action(action: usize, improved: bool)

Credit the policy action this slice took.

fn fivefold_arm() -> usize

Arm index of the fivefold residual, after the covering points.

fn leave_best() -> f64

Snapshot of the best energy the learner has been shown.

fn leave_ei_open() -> bool

Whether this replica’s funnel still expects improvement.

fn observe_leave(histogram: &[f64], energy: f64, cover: Option<usize>, new_packing: bool)

Observe a quenched Leave on this replica’s learner.

fn pick_leave_action<R: Rng + ?Sized>(allowed: &[usize], rng: &mut R) -> usize

Thompson action among allowed.

fn pick_leave_cover<R: Rng + ?Sized>(n: usize, rng: &mut R) -> usize

Thompson cover for a Leave that has no EI candidates yet.

fn pick_leave_cover_ei<R: Rng + ?Sized>(candidates: &[(usize, Vec<f64>)], n: usize, rng: &mut R) -> usize

EI cover if the funnel can score, otherwise Thompson.

Structs and Unions

struct LeaveLearner

Shared learner for one replica (thread-local: one hop chain).

funnel: FunnelModel

Lowest energy per packing histogram.

best: f64

Best energy this replica has quenched to.

Implementations

impl LeaveLearner

Functions

fn credit_action(&mut self, action: usize, paid: bool)

Credit an action after the slice that used it.

paid is energy drop or a new packing (IDS). A Leave that only rematches ico is still a miss.

fn new() -> Self

Uniform priors, empty funnel.

fn observe(&mut self, histogram: &[f64], energy: f64, cover: Option<usize>, new_packing: bool)

Record a quenched landing.

The funnel sees the packing histogram and the energy. A cover that beats this replica’s best is improvement. A cover that opens a new packing is information about (A^star) (IDS): leaving ico for a (-380) defect must increment the posterior, not crowd it out. A same-packing miss still penalises.

fn pick_action<R: Rng + ?Sized>(&mut self, allowed: &[usize], rng: &mut R) -> usize

Thompson draw over the allowed policy actions.

fn pick_cover<R: Rng + ?Sized>(&mut self, n: usize, rng: &mut R) -> usize

Thompson draw over n cover arms (fivefold is n-1 when n == cover_arm_count()).

fn pick_cover_ei(&mut self, candidates: &[(usize, Vec<f64>)]) -> Option<usize>

Cover whose packing histogram the funnel rates highest under MES.

None when the funnel has fewer than two observations, so the first Leaves are Thompson rather than a prior that has never seen a packing. Jones EI stays on retire; this ranks holes by (I(E^star; y)).

Traits implemented

impl Default for LeaveLearner