easylocal::search_run
One execution of a search algorithm.
Synopsis
Declared in <easylocal/runners/search_run.hpp>
template<
class Context,
class Tracer = trace::null_tracer,
class Evaluation = runners::detail::context_evaluation_type<Context>>
class search_run;
Description
search_run exposes the search context (neighborhood, evaluation, cost semantics) and owns everything that is common to every search: evaluation/iteration counters, the evaluation budget, cancellation, progress reporting and the core trace events.
Algorithms describe only their search logic in terms of these primitives. With a cost::pareto cost it also keeps the archive of the non-dominated solutions reached (start, evaluate_solution and commit offer them), and the result carries that front. Evaluation is the facility that evaluates the solutions and the moves: the context's, or the one with_evaluation() wraps around it.
Type Aliases
| Name | Description |
|---|---|
candidate_type | The evaluation of a move, which commit() applies. |
context_type | The search context the bound runner provides. |
cost_type | The type of the costs. |
evaluation_type | The evaluation of a solution: its cost, and what a delta evaluation keeps. |
move_type | The type of the moves. |
neighborhood_explorer_type | The type of the neighborhood explorer. |
result_type | What finish() returns: pareto_search_result with a front, search_result otherwise. |
solution_type | The type of the solutions. |
tracer_type | The type of the tracer. |
Member Functions
| Name | Description |
|---|---|
search_run [constructor] [deleted] | Not copyable: the run of one search. |
search_run [constructor] | A run of context, controlled by control and traced by tracer, with an evaluation limit (unlimited: none), a target cost (nullptr: none), a deadline (none: no time limit) and the parameters of its archive (with a cost::pareto cost). |
search_run [constructor] [deleted] | Deleted: the run would refer to a temporary context. |
operator= [deleted] | Not copyable: the run of one search. |
better | Whether candidate is strictly better than reference, by the semantics of the cost. |
better_or_equivalent | Whether candidate is better than or equivalent to reference, by the semantics of the cost. |
commit | Applies move, evaluated as candidate, to solution and current. |
commit_improvement | Applies move, evaluated as candidate, as commit() does, for an algorithm whose current solution is its best one and that knows the move improves it: the new best cost is reported as incumbent_updated() does. |
context | The search context. |
control | The run_control of the caller. |
emit | Sends event to the tracer, if it observes events of that type. |
equivalent | Whether lhs and rhs are equivalent, by the semantics of the cost. |
evaluate_move | Evaluates move on solution, whose evaluation is current; counts as an evaluation. |
evaluate_solution | Evaluates another solution than the one the run started from, for algorithms that keep several (a population, a history of solutions): it counts as an evaluation, is traced as visited and enters the archive. |
evaluation | Raw evaluation facility, the one the run evaluates with: bypasses counters, budget and trace events. |
evaluations | Solutions and moves evaluated so far, the initial evaluation included. |
finish | Ends the run. |
finish | Ends the run with an explicit reason, such as termination_reason::local_optimum. |
front | The non-dominated solutions reached so far. |
incumbent_updated | Reports a new best cost, for the trace and the target cost; best_so_far calls it. |
input | The Input, when the context has one. |
iterations | Iterations so far, counted by next_iteration(). |
limit_evaluations | The runner's own budget; the initial evaluation counts towards it. |
moves | The moves of the neighborhood of solution, for the algorithms that enumerate them. |
neighborhood_explorer | The neighborhood explorer. |
next_iteration | Counts an iteration. |
random_move | A random move of the neighborhood of solution, or nothing when there is none. |
should_stop | True when the run must end: external cancellation, a reached target cost, an exhausted evaluation budget or a passed time limit. |
solution_manager | The SolutionManager, when the context has one. |
start | Starts the run from solution: evaluates it, resets the counters, and returns its evaluation. |
target | The target cost given by the caller, or nullptr. |
tracer | The tracer of the run. |
with_evaluation | A run that evaluates through wrap(evaluation()), a facility that decorates this run's (a delay, a cache, a count), and shares everything else: the context and its cost relations, the control, the tracer, the deadline, the target and what is left of the evaluation budget. |
Static Data Members
| Name | Description |
|---|---|
archives_front | Whether the run keeps a front: with a cost::pareto cost. |
Friends
| Name | Description |
|---|---|
easylocal::search_run | One execution of a search algorithm. |