import Xoshiro128p from '../core/xoshiro';
/**
* Class implementing [Parallel Tempering]{@link https://doi.org/10.1090/conm/026} (Replica Exchange MCMC,
* Geyer 1991) to sample multimodal targets. Runs N independent [MCMC]{@link ran.mc.MCMC} replicas at inverse
* temperatures beta_1 = 1 > beta_2 > ... > beta_n, replica i targeting `beta_i * logDensity(x)`. Hot
* replicas (small beta) have a flattened target and cross low-probability barriers between modes easily;
* the cold replica (beta = 1) samples the true target. After each thinned step, a swap between one
* alternating-parity set of adjacent replica pairs is proposed and accepted with probability
* `min(1, exp((beta_i - beta_j) * (logDensity(x_j) - logDensity(x_i))))` (the direction that follows from
* detailed balance on the joint replica distribution; see the `_proposeSwap` implementation comment),
* letting the cold chain inherit the hot chains' mode-crossing moves.
*
* Unlike every other class in `ran.mc`, this is not an [MCMC]{@link ran.mc.MCMC} subclass: it has no single
* position or target density of its own, only an array of independent replicas and the swap logic that
* couples them (see decisions/0028-parallel-tempering-standalone-coordinator.md). Each replica keeps
* its own proposal tuning pinned to its temperature slot; an accepted swap exchanges only the replicas'
* positions (and, where present, their cached scaled log-density), not their adaptation state.
*
* @class ParallelTempering
* @memberof ran.mc
* @param {Object} options Coordinator options, as a single object. Supported properties:
*
* - {logDensity}: The logarithm of the (unnormalized) target density (required).
* - {temperatures}: Explicit, strictly descending array of inverse temperatures starting at 1.
* At least two are required. Takes precedence over nReplicas/tempMax if provided.
* - {nReplicas}: Number of replicas for an auto-generated geometric ladder. At least 2, at most 10000.
* - {tempMax}: Ratio of the coldest to the hottest inverse temperature for the geometric ladder
* (beta_n = 1 / tempMax). Must be a finite number greater than 1.
* - {sampler}: Factory `(scaledLogDensity, config) => MCMC` building one replica. Defaults to RWM.
* - {config}: Configuration object forwarded unchanged to every replica's constructor.
*
* The deprecated positional form `new ParallelTempering(logDensity, options)` is still accepted, but
* emits a one-time deprecation warning on first use and will be removed in v1.32.0.
* @param {Object=} legacyOptions Deprecated positional-form options object, read only when the
* deprecated `new ParallelTempering(logDensity, options)` form is used. Do not use in new code.
* @constructor
* @throws {Error} If logDensity is not a function.
* @throws {Error} If neither temperatures nor nReplicas and tempMax are provided, or if they are invalid.
*/
export default class ParallelTempering {
temperatures: any;
_logDensity: any;
_sampler: any;
_config: any;
_replicas: any;
_swapAttempts: any[];
_swapAccepts: any[];
r: Xoshiro128p;
constructor(options: any, legacyOptions: any);
/**
* Sets the seed for the coordinator's own pseudo random number generator (used for swap-acceptance
* draws) and reseeds every replica with a distinct, deterministically derived seed.
*
* @method seed
* @memberof ran.mc.ParallelTempering
* @param {number|string} value The value of the seed, either a number or a string.
* @returns {this} Reference to the current sampler.
* @ignore
*/
seed(value: number | string): this;
/**
* Warms up every replica independently (no swaps are proposed during warm-up).
*
* @method warmUp
* @memberof ran.mc.ParallelTempering
* @param {Function=} progress Called with the percentage complete (0-100) after each replica finishes.
* @param {number=} maxBatches Number of warm-up batches per replica. Default is 100.
* @ignore
*/
warmUp(progress?: Function | undefined, maxBatches?: number | undefined): void;
/**
* Runs all replicas in lockstep and proposes swaps between adjacent replica pairs. Each round
* advances every replica by as many raw iterations as the slowest-thinning replica's own
* samplingRate requires, then proposes one alternating-parity set of adjacent swaps.
*
* @method sample
* @memberof ran.mc.ParallelTempering
* @param {Function=} progress Called with the integer percentage complete (0-99), once per percent.
* @param {number=} size Number of samples to collect from the cold (beta = 1) replica. Default is 1000.
* @returns {number[][]} Array of sampled states from the cold replica.
* @ignore
*/
sample(progress?: Function | undefined, size?: number | undefined): number[][];
/**
* Computes the fraction of proposed swaps accepted for each adjacent replica pair, since the last
* `sample()` call.
*
* @method swapRate
* @memberof ran.mc.ParallelTempering
* @returns {number[]} Array of length `temperatures.length - 1`, one accepted/attempted fraction per
* adjacent pair, in ladder order.
* @ignore
*/
swapRate(): number[];
_advanceReplicas(stride: any): void;
_proposeSwap(parity: any): void;
_swapPositions(i: any, j: any): void;
static _normalizeConstructorArgs(first: any, legacyOptions: any): {
logDensity: any;
options: any;
};
static _warnPositionalDeprecation(): void;
static _resolveLadder(options: any): any;
static _validateTemperatures(temperatures: any): void;
static _validateTemperaturesShape(temperatures: any): void;
static _validateTemperaturesStart(temperatures: any): void;
static _validateTemperaturesPositive(temperatures: any): void;
static _validateTemperaturesDescending(temperatures: any): void;
static _validateLadderParams(nReplicas: any, tempMax: any): void;
static _validateNReplicas(nReplicas: any): void;
static _validateTempMax(tempMax: any): void;
static _buildLadder(nReplicas: any, tempMax: any): number[];
}