mod python

module python

pyo3 entry point for anneal._core. Exposes the three preset variants (Boltzmann / Fast / Gsa), a History wrapper, and a run function that dispatches on the preset type. The Python objective is a callable from an ndarray to a scalar plus Bounds for sampling and dimensionality.

Internally, run wraps the Python callable in a thin Objective<f64> adapter that re-acquires the GIL per eval. This is acceptable when evaluation cost dominates the per-call GIL overhead (~hundreds of ns), which is true for any non-toy objective.

Structs and Unions

struct PyBasinBias

Well-tempered bias keyed on basin identity rather than a collective variable.

A grid bias must be told which projection to watch, and fails silently when the competing structures do not separate along it. Keying on identity removes the choice: two states are the same basin when their fingerprints lie within merge_radius.

States are flattened (n_points, 3) point sets, fingerprinted by sorted pairwise distances, which is invariant to permutation, translation and rotation.

Implementations

impl PyBasinBias
struct PyBoltzmann

Boltzmann preset parameters: initial temperature and Gaussian step size.

t_init: f64

Initial temperature T_0.

sigma: f64

Gaussian per-component standard deviation.

Implementations

impl PyBoltzmann
struct PyClusterConfig

Driver settings for the cluster-search layer.

Construct with Config.recommended, Config.derived, or Config.for_cluster. The recommended stack is the measured default: composed surface relocations, depth-rewarded move allocation, and tabu on stall.

Implementations

impl PyClusterConfig
struct PyEpochLine

Per-epoch summary line exposed to Python.

epoch: usize

Zero-based epoch index.

temp: f64

Temperature at this epoch.

accepted: usize

Proposals accepted in this epoch.

rejected: usize

Proposals rejected in this epoch.

best_val: f64

Best objective value seen up to and including this epoch.

struct PyFast

Fast SA preset parameters: initial temperature and Cauchy scale.

t_init: f64

Initial temperature T_0.

gamma: f64

Cauchy per-component scale.

Implementations

impl PyFast
struct PyGsa

GSA preset parameters: initial temperature and Tsallis indices.

t_init: f64

Initial temperature T_0.

q_v: f64

Visiting index q_v in (1, 3).

q_a: f64

Acceptance index q_a (1.0 collapses to Metropolis).

Implementations

impl PyGsa
struct PyHistory

Run history exposed to Python.

epochs: Vec<PyEpochLine>

Per-epoch summary lines, in epoch order.

best_pos: Vec<f64>

Best position seen across the entire run.

best_val: f64

Best objective value seen across the entire run.

Implementations

impl PyHistory

Traits implemented

impl From<History> for PyHistory
struct PyLedger

Work ledger: every objective or gradient evaluation is one charged unit.

Implementations

impl PyLedger