|
| void | clear () |
| symbol * | insert (std::unique_ptr< symbol >, weight_t=default_weight) |
template<Symbol S, weight_t = default_weight, class ... Args>
requires std::constructible_from<S, Args...> |
| std::add_pointer_t< S > | insert (Args &&...) |
|
template<std::derived_from< function > F, weight_t W = default_weight, std::convertible_to< symbol::category_t > C = symbol::category_t> |
| std::add_pointer_t< F > | insert (symbol::category_t, std::initializer_list< C >) |
| | Dedicated overload for function categories passed as a braced list.
|
|
template<std::derived_from< function > F, weight_t W = default_weight, std::convertible_to< symbol::category_t > C = symbol::category_t> |
| std::add_pointer_t< F > | insert (std::initializer_list< C >) |
| | Convenience overload defaulting return type to symbol::default_category.
|
| bool | enough_terminals () const noexcept |
| symbol::category_t | categories () const noexcept |
| std::size_t | functions (symbol::category_t=symbol::default_category) const noexcept |
| std::size_t | terminals (symbol::category_t=symbol::default_category) const noexcept |
|
std::size_t | variables (symbol::category_t=symbol::default_category) const noexcept |
| template<Symbol S> |
| std::size_t | count_if (symbol::category_t=symbol::default_category) const noexcept |
| value_t | random_argument (std::size_t, symbol::category_t, double) const |
| const symbol * | roulette (symbol::category_t=symbol::default_category) const |
| const function * | roulette_function (symbol::category_t=symbol::default_category) const |
| value_t | roulette_terminal (symbol::category_t=symbol::default_category) const |
| const symbol * | roulette_free (symbol::category_t=symbol::default_category) const |
| const symbol * | decode (symbol::opcode_t) const |
| const symbol * | decode (const std::string &) const |
| const terminal * | front_terminal (symbol::category_t=symbol::default_category) const |
| weight_t | weight (const symbol &) const |
| std::set< symbol::category_t > | categories_missing_terminal () const |
| bool | is_valid () const |
template<Symbol S, symbol_set::weight_t W, class ... Args>
requires std::constructible_from<S, Args...> |
| std::add_pointer_t< S > | insert (Args &&... args) |
A container for the symbols used by the engine.
Symbols are stored so as to be quickly recalled by category.
- Note
- The functions and terminals used should be powerful enough to be able to represent a solution to the problem. On the other hand, it's better not to use a symbol set too large (this enlarges the search space and makes harder the search for a solution).
template<Symbol S, symbol_set::weight_t W, class ... Args>
requires std::constructible_from<S, Args...>
| std::add_pointer_t< S > ultra::symbol_set::insert |
( |
Args &&... | args | ) |
|
General factory for any Symbol directly constructible from Args....
- Template Parameters
-
| S | symbol to be added |
| W | weight associated to S |
- Parameters
-
| [in] | args | arguments used to build S |
- Returns
- a raw pointer to the symbol just added (or nullptr in case of error)
Insert a symbol in the symbol set without the user having to allocate memory.
- Note
- Only partially replaces the insert(std::unique_ptr) method (e.g. building from factory).