Skip to main content

Crate separatrix

Crate separatrix 

Source
Expand description

§separatrix

Quantum-inspired Ising/QUBO solvers in pure Rust: simulated bifurcation (the Toshiba-lineage bSB/dSB algorithms, Goto et al. 2019/2021) next to the classical baselines any honest benchmark needs — simulated annealing, parallel tempering, and exact enumeration as ground truth.

The name: as the pump ramps, each SB oscillator crosses the separatrix — the boundary between basins of attraction — and commits to spin +1 or −1.

§Honesty contract

Simulated bifurcation is a classical algorithm derived from the adiabatic dynamics of Kerr-parametric-oscillator networks. This crate claims no quantum advantage and no guaranteed speedup over classical baselines; that is what the baselines are for. On small instances, exact methods are fast and provably optimal — measure heuristics against exact, and report optimality gaps, not adjectives.

§Example

use separatrix::{IsingModel, QuboModel, Solver, SbConfig};

// A 3-bit QUBO: minimize  -x0 - x1 + 2·x0·x1 - x2
let mut qubo = QuboModel::<f64>::new(3);
qubo.set_term(0, 0, -1.0);
qubo.set_term(1, 1, -1.0);
qubo.set_term(0, 1, 2.0);
qubo.set_term(2, 2, -1.0);

let (ising, offset) = IsingModel::from_qubo(&qubo);
let result = Solver::Sb(SbConfig::default()).solve(&ising).unwrap();

let objective = qubo.objective(&result.bits());
assert_eq!(objective, result.energy + offset);
assert_eq!(objective, -2.0); // optimum: exactly one of x0/x1, plus x2

§Determinism and portability

Every solver is seeded explicitly and fully deterministic for a given (config, seed) — results are reproducible bit-for-bit on the same target. The crate has no OS-entropy dependency and the core builds for wasm32-unknown-unknown with default-features = false.

For settlement-grade objectives (e.g. scoring solutions on-chain), quantize once with QuantizedQubo and treat its i128 integer objective as canonical; floats are for dynamics, integers are for keeping score.

Re-exports§

pub use model::IsingModel;
pub use model::QuboModel;
pub use pt::PtConfig;
pub use quantized::QuantizedQubo;
pub use quantized::DEFAULT_MAX_COEFF;
pub use result::spins_from_bits;
pub use result::SolveResult;
pub use sa::SaConfig;
pub use sb::SbConfig;
pub use sb::SbVariant;

Modules§

exact
Exact ground states by exhaustive enumeration — the crate’s ground truth.
model
Problem representations: Ising models and QUBOs.
pt
Parallel tempering (replica exchange): the strongest simple classical baseline for Ising heuristics — and therefore mandatory in this crate. Replicas anneal at a geometric ladder of fixed temperatures; every few sweeps, neighboring temperatures attempt to exchange configurations with the Metropolis criterion min(1, exp((β_a − β_b)(E_a − E_b))), letting low-energy states migrate to cold replicas and stuck cold replicas escape through hot ones.
quantized
The canonical integer objective.
result
Solver output.
sa
Simulated annealing: the baseline any Ising heuristic must be measured against. Single-spin-flip Metropolis over a geometric temperature schedule, with cached local fields so each proposed flip is O(1) to evaluate and each accepted flip O(n) to book-keep.
sb
Simulated Bifurcation (SB): ballistic (bSB) and discrete (dSB) variants.

Enums§

Error
Solver
Uniform entry point over every solver in the crate, convenient for benchmark harnesses that iterate [Solver; N].