#include <search.h>
template<Individual P>
class ultra::src::search< P >
Thin facade over the concrete classification or regression search engine.
The engine kind is selected at construction time from the problem type. Configuration calls are forwarded directly to the selected engine.
- Examples
- sonar.cc, symbolic_regression.cc, symbolic_regression01.cc, and symbolic_regression02.cc.
◆ after_generation_callback_t
Initial value:
ultra::after_generation_callback_t<P, fitness_t>
◆ on_training_new_best_callback_t
Initial value:
ultra::on_new_best_callback_t<P, fitness_t>
◆ after_generation()
template<Individual P>
| search< P > & search::after_generation |
( |
after_generation_callback_t | f | ) |
|
Sets a callback function executed at the end of every generation.
- Parameters
-
- Returns
- a reference to this object (method chaining / fluent interface)
- Examples
- symbolic_regression02.cc.
◆ logger()
Sets the search/evolution logger.
- Parameters
-
- Returns
- a reference to this object (method chaining / fluent interface)
◆ on_training_new_best()
template<Individual P>
| search< P > & search::on_training_new_best |
( |
on_training_new_best_callback_t | f | ) |
|
Hook invoked whenever the evolution discovers a new training-set best.
- Parameters
-
- Returns
- a reference to this object (method chaining / fluent interface)
◆ predictor()
template<Individual P>
| std::unique_ptr< basic_oracle > search::predictor |
( |
const P & | prg | ) |
const |
|
nodiscard |
Creates a runtime-polymorphic predictor associated with a given individual.
- Parameters
-
| [in] | prg | individual used as building block for the predictor |
- Returns
- a dynamically allocated predictor or nullptr if the active evaluator does not provide one
This function provides a uniform interface over different evaluator types. If the selected evaluator exposes a predictor() method, its result is wrapped into a std::unique_ptr<basic_oracle>. Otherwise nullptr is returned.
- Note
- Predictor availability is detected at compile time and mapped to a runtime polymorphic interface.
◆ refinement() [1/2]
template<Individual P>
template<class F>
Sets a refinement callback used to locally improve individuals.
- Parameters
-
| [in] | f | callable object implementing the refinement logic |
- Returns
- a reference to *this object (method chaining / fluent interface)
The refinement callback is invoked during the evolutionary process to perform local optimisation (e.g. numerical tuning of parameters) on candidate solutions.
The callable must have a signature compatible with at least one of the following forms:
std::optional<fitness_t>(
std::optional<fitness_t>(
Definition evaluator_proxy.h:45
Parameters controlling numerical optimisation of GP individuals.
Definition parameters.h:203
A generic callable can be used to support both cases:
[](P &ind, const auto &eva,
{
return std::optional<fitness_t>();
}
The evaluator passed to the callback is the same object used internally by the evolutionary engine (i.e. an evaluator_proxy), ensuring that refinement benefits from cached evaluations and consistent semantics.
- Note
- The concrete evaluator type depends on the problem (classification or regression) and is selected automatically at runtime. An evaluator-specific callable that does not match the selected evaluator disables refinement.
◆ refinement() [2/2]
template<Individual P>
template<class F>
Sets a refinement callback used to locally improve individuals.
- Parameters
-
| [in] | f | callable object implementing the refinement logic |
- Returns
- a reference to *this object (method chaining / fluent interface)
The refinement callback is invoked during the evolutionary process to perform local optimisation (e.g. numerical tuning of parameters) on candidate solutions.
The callable must have a signature compatible with at least one of the following forms:
std::optional<fitness_t>(
std::optional<fitness_t>(
A generic callable can be used to support both cases:
[](P &ind, const auto &eva,
{
return std::optional<fitness_t>();
}
The evaluator passed to the callback is the same object used internally by the evolutionary engine (i.e. an evaluator_proxy), ensuring that refinement benefits from cached evaluations and consistent semantics.
- Note
- The concrete evaluator type depends on the problem (classification or regression) and is selected automatically at runtime. An evaluator-specific callable that does not match the selected evaluator disables refinement.
◆ stop_source()
template<Individual P>
| search< P > & search::stop_source |
( |
std::stop_source | ss | ) |
|
Set a stop source for performing cooperative task shutdown.
- Parameters
-
| [in] | ss | stop source to issue a stop request |
- Returns
- a reference to this object (method chaining / fluent interface)
◆ tag()
template<Individual P>
| search< P > & search::tag |
( |
const std::string & | t | ) |
|
Sets the identification tag for this object.
- Parameters
-
- Returns
- a reference to this object (method chaining / fluent interface)
The tag is used to identify this object when multiple searches are performed in parallel.
◆ validation_strategy() [1/2]
template<Individual P>
template<ValidationStrategy V, class... Args>
Builds and sets the active validation strategy.
- Parameters
-
| [in] | args | parameters for the validation strategy |
- Returns
- reference to the search class (used for method chaining)
◆ validation_strategy() [2/2]
template<Individual P>
template<ValidationStrategy V, class... Args>
Builds and sets the active validation strategy.
- Parameters
-
| [in] | args | parameters for the validation strategy |
- Returns
- reference to the search class (used for method chaining)
The documentation for this class was generated from the following files: