altbacken.external.annealing

Classes

SimpleSimulatedAnnealing(fitness, ...)

This class implements a simple simulated annealing optimization algorithm.

altbacken.external.annealing.builtin_random()

random() -> x in the interval [0, 1).

class altbacken.external.annealing.SimpleSimulatedAnnealing(fitness: FitnessFunction, neighbourhood: ~altbacken.core.neighbourhood.Neighbourhood, temperature: ~collections.abc.Iterable[float] | float | tuple[float, float] | TemperatureFunction = 1000.0, stop: int | float | ~altbacken.core.annealing.StopCondition = 1000, acceptance: AcceptanceFunction = <altbacken.external.acceptance.BoltzmannAcceptance object>, random: RandomNumberGenerator = <built-in method random of Random object>)[source]

Bases: SimulatedAnnealing, Generic

This class implements a simple simulated annealing optimization algorithm.

SimpleSimulatedAnnealing extends the functionality of the SimulatedAnnealing class, providing a simplified interface and additional features for configuring the temperature and stopping conditions. It supports various temperature and stopping condition configurations for enhanced adaptability and performance.

fitness

The fitness function used for evaluating the quality of solutions.

Type:

FitnessFunction[T]

neighbourhood

The neighbourhood function that defines possible moves in the solution space.

Type:

Neighbourhood[T]

temperature (Iterable[float] | float | tuple[float, float] |

TemperatureFunction): Initial temperature configuration for simulated annealing. Can be a float, tuple, iterable, or a temperature function.

stop

Stopping condition for the algorithm. Can be an integer for iteration threshold, a float for temperature threshold, or a custom stop condition.

Type:

int | float | StopCondition[T]

acceptance

Acceptance function used to calculate the energy difference between states. Defaults to BoltzmannAcceptance.

Type:

AcceptanceFunction

random

Random number generator used in the algorithm. Defaults to builtin_random.

Type:

RandomNumberGenerator

__init__(fitness: FitnessFunction, neighbourhood: ~altbacken.core.neighbourhood.Neighbourhood, temperature: ~collections.abc.Iterable[float] | float | tuple[float, float] | TemperatureFunction = 1000.0, stop: int | float | ~altbacken.core.annealing.StopCondition = 1000, acceptance: AcceptanceFunction = <altbacken.external.acceptance.BoltzmannAcceptance object>, random: RandomNumberGenerator = <built-in method random of Random object>)[source]