protocol
simulated_annealing_protocol
Protocol for simulated annealing problem definitions. A problem object must define the four required predicates and may optionally define predicates to override cooling, stopping, neighbor generation with delta energy, and progress reporting defaults.
logtalk_load(simulated_annealing(loader))staticPublic predicates
initial_state/1
Returns an initial state for the optimization problem.
staticinitial_state(State)initial_state(-term) - oneneighbor_state/2
Generates a neighboring state from the given state. This is the most problem-specific predicate and its definition determines the quality of the search.
staticneighbor_state(State,Neighbor)neighbor_state(+term,-term) - oneneighbor_state/3
Generates a neighboring state and returns the energy change (delta) directly, avoiding a full energy recomputation. Optional. When not defined by the problem, the algorithm calls neighbor_state/2 and state_energy/2 instead.
staticneighbor_state(State,Neighbor,DeltaEnergy)neighbor_state(+term,-term,-number) - onestate_energy/2
Computes the energy (cost) of the given state. The algorithm minimizes this value.
staticstate_energy(State,Energy)state_energy(+term,-number) - oneinitial_temperature/1
Returns the initial temperature for the annealing schedule. Higher temperatures increase the probability of accepting worse solutions early on.
staticinitial_temperature(Temperature)initial_temperature(-number) - onecooling_schedule/3
Computes the next temperature from the current temperature and step number. Optional. When not defined by the problem, a default geometric cooling schedule is used (NewTemp is Temp * 0.995).
staticcooling_schedule(Temperature,Step,NewTemperature)cooling_schedule(+number,+non_negative_integer,-number) - onestop_condition/3
True when the search should stop given the current step, temperature, and best energy found so far. Optional. When not defined by the problem, the search runs until the maximum number of steps is reached or the minimum temperature is reached.
staticstop_condition(Step,Temperature,BestEnergy)stop_condition(+non_negative_integer,+number,+number) - zero_or_oneprogress/5
Called periodically to report optimization progress. Optional. When not defined by the problem, progress reporting is skipped. The acceptance and improvement rates are values between 0.0 and 1.0 computed over the interval since the last progress report.
staticprogress(Step,Temperature,BestEnergy,AcceptanceRate,ImprovementRate)progress(+non_negative_integer,+number,+number,+number,+number) - zero_or_oneProtected predicates
(none)
Private predicates
(none)
Operators
(none)
See also