Fixed-temperature law of simulated annealing 2026-10-18
On a finite state space with finite objective function values, the fixed- target is a Boltzmann distribution:The partition function normalizes the weights but cancels from the Metropolis–Hastings acceptance probability. A short detailed balance proof explains the target. With symmetric and ,Summing over gives , so this is a stationary distribution. On a finite state space, a connected graph of positive symmetric proposals makes the accepted Markov chain an irreducible Markov chain. Convergence from any starting state additionally requires an aperiodic Markov chain; one positive self-transition suffices under irreducibility. Replacing by ensures this. For asymmetric , require connectivity through bidirectional proposals: one-way proposals are rejected.[ref]
In the five-state barrier example for simulated annealing, gives exact Boltzmann weights . Multiplying by givesFor the uphill edge, detailed balance is visible numerically:Thus the global minimum has the largest individual stationary probability, , but is far from certain at this positive . At the exact stationary distribution is .
Lower temperature concentrates equilibrium weights while suppressing uphill acceptance
. Exact Boltzmann distributions for the chosen five-state objective function, and the uphill acceptance probability conditional on the proposal . The one-step transition probability is half that acceptance probability. The bars describe equilibrium at each fixed temperature, not the evolving probability distribution during cooling. Details.For any finite , let be the set of global minima and the smallest objective function value. Cancelling from numerator and denominator shows that each nonminimal state's weight tends to zero as , while every state in has equal weight. Therefore tends to the uniform distribution on . This is a statement about a family of equilibrium probability distributions; it does not prove that a cooling Markov chain follows that family.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 43 3 a iii Solution Created 2026-10-03 Updated 2026-10-14
A valid symmetric proposal distribution is with on the entire real line. Reject immediately if . Otherwise use the positive-parameter random walk with boundary rejection. Withthe Metropolis–Hastings acceptance probability isNo Jacobian determinant is needed for this additive proposal in . Do not repeatedly redraw until : that would create a state-dependent truncated proposal and require an additional Hastings correction. Alternatively a symmetric walk in respects positivity, but then the transformed target has a factor ; equivalently the acceptance ratio in variance coordinates has the extra factor .
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 43 3 a ii Solution Created 2026-10-03 Updated 2026-10-14
Hold all parameters except fixed and propose with . This Random-walk Metropolis algorithm has a symmetric proposal distribution. DefineCancellation of unchanged likelihood and prior factors gives the Metropolis–Hastings acceptance probabilityDraw an independent uniform and accept if it is at most ; otherwise retain the old value. Update each component in turn, recomputing the needed mixture contributions. On a logarithmic scale, compare with to avoid numerical underflow.
Past exam of the mathematics course of the University of Cambridge 2004 iii Paper 33 5 b Solution Created 2026-10-03 Updated 2026-10-14
Represent a schedule by a permutation , with . Choose and reverse the block . This is a 2-opt move on the dummy tour. Its exact setup-cost change is the asymmetric 2-opt reversal costThe internal sum matters because the specified changeovers need not be symmetric. When the block begins at the first job, the boundary terms correctly update the initial setup; the dummy return costs are zero. Processing times cancel.
At temperature , simulated annealing accepts a move with probabilityWith uniformly sampled reversal pairs the proposal is symmetric, so this is the appropriate Metropolis–Hastings acceptance probability. Improvements and ties are always accepted; occasional uphill moves escape local minima. Repeatedly sample moves, gradually lower , and retain the best schedule seen even if the current schedule worsens. Reversing a block of length two swaps adjacent jobs, so these moves connect the whole permutation space. A cooling schedule, iteration budget and restarts control practical performance. This is a heuristic at a finite budget; it does not certify global optimality unless paired with an exact bound or an appropriate limiting convergence argument.
Past exam of the mathematics course of the University of Cambridge 2006 iii Paper 47 5 a i Solution Created 2026-10-03 Updated 2026-10-14
A random-walk update proposes , with an increment distribution independent of the current state. If its density is symmetric, , reducing the Metropolis–Hastings acceptance probability to . For nonsymmetric increments the proposal-density ratio must remain.
Such updates need little global knowledge of the target and adapt naturally to its local scale. Their limitation is a tuning tradeoff: very small increments accept often but move slowly, while very large increments are often rejected. They can also have difficulty moving between distant modes. Covariance-scaled increments help with anisotropic targets, but the chain still explores through local steps.
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 3 26J c Solution Created 2026-09-24 Updated 2026-10-14
The proposal must connect the whole positive posterior support by moves with nonzero reverse probability. Use the full Metropolis–Hastings acceptance probability for asymmetric proposals; dropping the reverse proposal factor generally targets the wrong distribution. Compute likelihoods and acceptance ratios on a logarithmic scale to avoid overflow and underflow, and handle zero weights explicitly. A lazy step prevents periodicity when distributional convergence is needed.
Finite-chain convergence does not guarantee a useful run length: separated modes and narrow bottlenecks can make mixing extremely slow. Tune proposals to explore efficiently, inspect several starting points and chains, and assess autocorrelation and Monte Carlo uncertainty rather than treating correlated draws as independent observations. Discarding an initial segment can reduce initialization effects, but diagnostics do not prove that every posterior mode has been visited. Thinning is not required for correctness and often throws away useful information. The model and prior must themselves be specified correctly; an exact sampler from an incorrect posterior cannot repair the model.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 48 5 a Solution Created 2026-10-03 Updated 2026-10-14
Both the Metropolis–Hastings algorithm and the Gibbs sampler construct a Markov chain with a specified target distribution, usually a posterior distribution known only up to normalization. For a proposal density and target density , the Metropolis–Hastings acceptance probability isAfter drawing , move there with this probability; otherwise stay at . The unknown normalizing constant of cancels. The original Metropolis algorithm uses a symmetric proposal, , so the proposal-density ratio disappears. The general Metropolis–Hastings algorithm permits nonsymmetric proposals and needs that correction.
A Gibbs sampler instead chooses a coordinate or block and draws directly from its full conditional distribution, leaving the other coordinates fixed. It is exactly a conditional Metropolis–Hastings update whose proposal is that full conditional. For a change from to with fixed, the acceptance ratio isThus a Gibbs update is an always-accepted Metropolis–Hastings update with the full conditional as proposal. This statement concerns each update: a systematic sweep of several Gibbs kernels preserves the target but need not itself be reversible.
When the full conditional distributions are easy to sample, a Gibbs sampler avoids proposal tuning and rejection, and is particularly convenient for conjugate priors and data augmentation. When a conditional cannot be sampled directly, a Metropolis–Hastings algorithm can use only its evaluable density; such an update can also be inserted into a Gibbs sweep. Block or joint Metropolis–Hastings proposals can move efficiently along strongly correlated directions for which coordinate-wise Gibbs updates mix slowly. Conversely, a badly chosen Metropolis–Hastings proposal can reject most moves or make only tiny moves. Acceptance probability one by itself does not guarantee rapid exploration. Both methods require appropriate irreducibility and convergence checks before their long-run averages are useful posterior estimates.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 37 5 c Solution Created 2026-10-03 Updated 2026-10-06
First require a proper target: and . The Metropolis–Hastings algorithm uses the Metropolis–Hastings acceptance probabilitySufficient general conditions are phi-irreducibility, aperiodicity, and a drift-minorisation condition establishing geometric ergodicity of the resulting chain, together with a stationary th moment for the observable being averaged. These imply the central limit theorem for a geometrically ergodic Markov chain. The observable's moment condition must be included: conditions on the sampler alone cannot give the theorem for every arbitrary function.
A concrete stronger condition, directly in terms of the proposal, isTogether with a bounded observable, this is an especially simple sufficient answer. The accepted proposal density is , so it is at least . The kernel satisfies a global minorization condition with the target, hence uniform geometric ergodicity, positive Harris recurrence, and aperiodicity. An independent proposal whose importance weight is uniformly bounded is one example. No claim of these properties follows merely from writing down a positive proposal.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 208 6 b Solution Created 2026-10-03 Updated 2026-10-06
For the off-diagonal moves, the Metropolis–Hastings acceptance probability givesThis expression is unchanged by interchanging and . The rejected-move measure is supported on the diagonal and is also symmetric. Therefore the whole transition measure satisfieswhich proves detailed balance, including the atom that an off-diagonal density alone would omit. Consequently the Metropolis–Hastings algorithm kernel preserves the normalized target measure.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 216 5 b Solution Created 2026-10-03 Updated 2026-10-06
Let and . With conditional independence of the binary observations given the latent function, defineThe prior distribution is specified on the precision , not on . Its Jacobian determinant givesand the marginal posterior density is proportional to . Working instead with precision or logarithmic coordinates is possible, provided all corresponding Jacobian determinants are included.
Choose an importance sampling density covering the support of , draw independently from it, and use the nonnegative unbiased likelihood estimatorEach summand integrates to , proving unbiasedness. A simple always-valid choice is the latent Gaussian prior distribution, , when the covariance matrix is nonsingular. Then the estimator is just the average of the bounded values . For duplicate inputs, sample only the distinct latent values and multiply all likelihood contributions at each common input. A Gaussian approximation to the latent posterior distribution, or its mixture with the Gaussian prior distribution, can reduce relative variance while keeping complete support. Its approximation does not replace the exact weights.
The pseudo-marginal Metropolis–Hastings algorithm stores both the current and its estimator randomness ; write their sampling law as . Propose , independently generate , compute , and accept the pair withHere denotes the proposal probability density function from to . On rejection retain both the old parameter and the old likelihood estimate. Initialize with a positive estimate. One must not independently refresh the denominator after rejection.
Correctness follows from the extended posterior densityThe pair proposal is . Its Metropolis–Hastings acceptance probability simplifies to the displayed ratio, since the auxiliary densities cancel. Hence detailed balance holds for . Integrating over gives by unbiasedness, so the parameter marginal distribution is exactly the intended posterior distribution for any fixed positive . This is exactness of the stationary target, not independent exact samples or a guarantee of rapid convergence. Large relative variance of the likelihood estimates can produce long holding times, so marginalizing does not by itself guarantee an improvement in mixing time.
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 216 6 a Solution 2026-10-03
Letbe the Hamiltonian. The Hamiltonian Monte Carlo proposal is accepted with the Metropolis–Hastings acceptance probabilityThe leapfrog map is volume preserving and reversible after momentum reversal, so no proposal-density Jacobian appears.
Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 3 28J ii Solution Created 2026-09-24 Updated 2026-09-29
Let be the likelihood function. Since the prior distribution is , the posterior density has the formwhere is the normalizing constant.
Choose and use the Gaussian autoregressive proposal reversible with respect to a standard normal distributionThuswhose covariance matrix is the required . Reversibility with respect to the standard normal distribution sayssoThe Metropolis–Hastings acceptance probability therefore reduces toThis is the Preconditioned Crank–Nicolson algorithm with proposal scale .
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 216 4 a Solution 2026-09-28
Hamiltonian Monte Carlo augments the position by an independent momentum and uses the Hamiltonian functionFrom the current , draw a fresh , apply a fixed number of leapfrog steps to approximate Hamiltonian flow, and obtain . The Metropolis–Hastings acceptance probability isotherwise retain . Momentum negation may be included to make the proposal explicitly reversible. The leapfrog map is volume preserving and reversible, while the acceptance step corrects its discretization error, leaving invariant after the momentum is discarded.
Preconditioned Crank–Nicolson algorithm Created 2026-09-29 Updated 2026-10-03
The preconditioned Crank–Nicolson algorithm, or pCN algorithm, uses a Gaussian autoregressive proposal reversible with respect to a standard normal distribution in a Metropolis–Hastings algorithm. When the target density is a likelihood times the proposal's invariant Gaussian prior density, the Gaussian factors cancel from the Metropolis–Hastings acceptance probability, leaving the likelihood ratio.
Proposal distribution 2026-09-29
At the current state , a Metropolis–Hastings algorithm draws a candidate state from its proposal distribution . The Metropolis–Hastings acceptance probability corrects the proposal's bias so that the target distribution remains invariant.
Pseudo-marginal Metropolis–Hastings algorithm Created 2026-10-06 Updated 2026-10-14
A pseudo-marginal Metropolis–Hastings algorithm replaces an intractable likelihood function by a nonnegative unbiased likelihood estimator and includes its auxiliary randomness in the state. If for , the extended target is proportional to . An independence proposal for new auxiliary randomness cancels the factors in the Metropolis–Hastings acceptance probability. On rejection the old estimate must be retained. Integrating the extended target gives the desired marginal posterior distribution exactly.
Simulated annealing Created 2026-10-14 Updated 2026-10-18
Simulated annealing accepts worse feasible solutions to escape a local minimum. Minimize an objective function , analogous to energy. Effective temperature has the same units as , absorbing the Boltzmann constant; it controls exploration, rather than a material's thermodynamic temperature.[ref]
Optimization by Simulated Annealing by Scott Kirkpatrick and others. Printed pp. 672–673: effective temperature and cost as energy
Given current feasible point , draw from a proposal distribution . For a symmetric proposal distribution, , use the Metropolis–Hastings acceptance probabilityAccept with this conditional probability; on rejection retain . Every downhill or equal-cost proposal is accepted. Draw a fresh uniform random variable on and accept if . The off-diagonal transition probability includes proposing .[ref]
Optimization by Simulated Annealing by Scott Kirkpatrick and others. Printed p. 672: acceptance rule and rejected proposals
For a maximization problem with objective function , set : every improving proposed neighbor is accepted, and a worsening move of loss has conditional probability of acceptance, under the same symmetry assumption. Likelihood-power annealing uses precisely this sign convention for a log-likelihood. Retain the best feasible solution seen, since the current state can worsen even after a global minimum has been visited.
If the proposal distribution is asymmetric, use the full Metropolis–Hastings acceptance probability, for ,A missing reverse proposal gives zero acceptance. Even a downhill proposal need not be accepted with probability one in this case. Choosing uniformly among a variable number of neighbors is generally asymmetric: and give the correction , where is vertex degree.[ref]
The useful idea is to separate exploring from insisting on improvement: an uphill move can open a route to a better feasible solution. Its usefulness depends on the proposal distribution, the scale of the objective function, and the cooling schedule for simulated annealing. Finite practical schedules carry no general guarantee of finding a global minimum.
Surrogate Hamiltonian Monte Carlo 2026-10-06
Surrogate Hamiltonian Monte Carlo uses an auxiliary smooth probability density function to generate trajectories but applies a Metropolis–Hastings acceptance probability using the intended target . For Gaussian momenta and an involutive Metropolis proposal generated by flipped leapfrog integration, the acceptance probability is . Only the surrogate gradient is required during the trajectory; target density evaluations are still required at the endpoints.
To minimize over models with different parameter dimensions, sample from a target proportional to and cool . A dimension-matching proposal augments the smaller model by auxiliary variables, transforms them bijectively into the larger parameter vector, and includes the proposal probability density function and absolute Jacobian determinant in the Metropolis–Hastings acceptance probability. For a positive Poisson mean and normal parameters , one convenient transformation isIts absolute Jacobian determinant is one. If the forward and reverse model-jump selection probabilities are and , the Poisson-to-normal ratio isThe reverse ratio is its reciprocal at the inverse map. This enforces detailed balance. When the target is proper and the annealing chain explores it adequately, the low-temperature laws concentrate on the minimum Akaike information criterion, rather than the maximum marginal model evidence. Likelihoods compared across models must describe the same observed data with a compatible reference measure.
