protocol
tabu_search_problem_protocol
Protocol for tabu search problems, with optional tabu keys, tenure, aspiration, restart diversification, delta-energy generation, neighborhood enumeration, stopping, and progress reporting.
logtalk_load(tabu_search(loader))staticPublic predicates
initial_state/1
Returns an initial state for the optimization problem.
staticinitial_state(State)initial_state(-nonvar) - 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. Used both for candidate sampling and (when neighbors/2 is not defined) as the sole neighborhood operator.
staticneighbor_state(State,Neighbor)neighbor_state(+nonvar,-nonvar) - 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(+nonvar,-nonvar,-number) - oneneighbors/2
Optionally returns the complete neighborhood. With exhaustive(true), an implementation must succeed for every visited state, including empty neighborhoods, and all candidates are evaluated in source order. Otherwise the candidate limit controls sampling and failure falls back to neighbor generation.
staticneighbors(State,Neighbors)neighbors(+nonvar,-list(nonvar)) - zero_or_oneexistence_error(procedure,Problem::neighbors/2)domain_error(tabu_hook_result,neighbors/2)tabu_key/2
Optionally returns a stable tabu-equivalence key without instantiating the state. Absent implementations use the state itself. Keys are compared using strict term identity; shared variables retain identity, while fresh variables do not provide stable equivalence.
statictabu_key(State,Key)tabu_key(+nonvar,-nonvar) - onedomain_error(tabu_hook_result,tabu_key/2)domain_error(tabu_hook_result,tabu_key/2-Key)aspiration/3
Optionally permits an otherwise tabu contender. Success permits the move; failure rejects it even when it improves the global best. Absent implementations use strict best-so-far aspiration. Called only for tabu candidates that could win selection; implementations should be pure and must not instantiate the candidate.
staticaspiration(CandidateState,CandidateEnergy,BestEnergy)aspiration(+nonvar,+number,+number) - zero_or_onetabu_tenure/4
Optionally returns tenure once per accepted move, using the zero-based global selection step and pre-move best and current energies. Overrides fixed and ranged options. Zero skips insertion without erasing earlier active entries; existing expiration steps never change.
statictabu_tenure(Step,BestEnergy,CurrentEnergy,Tenure)tabu_tenure(+non_negative_integer,+number,+number,-non_negative_integer) - onedomain_error(tabu_hook_result,tabu_tenure/4)domain_error(tabu_hook_result,tabu_tenure/4-Tenure)restart_state/2
Optionally returns a restart state without instantiating the global best state. Called only between cycles. Its energy is recomputed and may update the best, without incrementing move statistics. Absent implementations restart from the best with its cached energy.
staticrestart_state(BestState,RestartState)restart_state(+nonvar,-nonvar) - onedomain_error(tabu_hook_result,restart_state/2)domain_error(tabu_hook_result,restart_state/2-RestartState)state_energy/2
Computes the energy (cost) of the given state. The algorithm minimizes this value.
staticstate_energy(State,Energy)state_energy(+nonvar,-number) - onestop_condition/3
True when the search should stop given the current step, best energy found so far, and current energy. Optional. When not defined by the problem, the search runs until the maximum number of steps is reached.
staticstop_condition(Step,BestEnergy,CurrentEnergy)stop_condition(+non_negative_integer,+number,+number) - zero_or_oneprogress/5
Called with completed global steps and the actual current energy. Optional. The acceptance and improvement rates are computed since the preceding report, or since the cycle began for its first report. A zero-step interval has zero rates. When reporting is enabled, each cycle has a final report that replaces any coincident periodic report.
staticprogress(Step,BestEnergy,CurrentEnergy,AcceptanceRate,ImprovementRate)progress(+non_negative_integer,+number,+number,+number,+number) - zero_or_oneProtected predicates
(none)
Private predicates
(none)
Operators
(none)
See also