![]() |
Ultra 0.9.4
|
#include <vector_individual.h>
Public Types | |
| using | genome_t = std::vector<T> |
| using | const_iterator = genome_t::const_iterator |
| using | iterator = genome_t::iterator |
| using | value_type = genome_t::value_type |
| Public Types inherited from ultra::individual | |
| using | age_t = unsigned |
Public Member Functions | |
| const_iterator | begin () const noexcept |
| const_iterator | end () const noexcept |
| const value_type & | operator[] (std::size_t) const |
| vector_individual & | operator= (const std::vector< T > &) |
| bool | empty () const noexcept |
| std::size_t | size () const noexcept |
| std::size_t | parameters () const noexcept |
| operator const std::vector< T > & () const noexcept | |
| bool | is_valid () const |
| template<class F> requires std::invocable<F &, T &> && std::same_as<std::invoke_result_t<F &, T &>, void> | |
| void | apply_each (std::size_t first, std::size_t last, F &&f) |
| template<class F> requires std::invocable<F &, T &> && std::same_as<std::invoke_result_t<F &, T &>, void> | |
| void | apply_each (F &&f) |
| Public Member Functions inherited from ultra::individual | |
| age_t | age () const noexcept |
| void | inc_age (unsigned=1) noexcept |
| bool | load (std::istream &, const symbol_set &={}) |
| bool | save (std::ostream &) const |
| hash_t | signature () const noexcept |
| std::string | format (out::print_format_t) const |
Protected Member Functions | |
| vector_individual (std::size_t) | |
| vector_individual (const ultra::problem &) | |
| template<class F> requires std::invocable<F &, T &> && std::same_as<std::invoke_result_t<F &, T &>, void> | |
| void | apply_each (std::size_t, std::size_t, F &&) |
| template<class F> requires std::invocable<F &, T &> && std::same_as<std::invoke_result_t<F &, T &>, void> | |
| void | apply_each (F &&) |
| hash_t | hash () const override |
| Protected Member Functions inherited from ultra::individual | |
| void | set_if_older_age (age_t) noexcept |
Protected Attributes | |
| genome_t | genome_ |
| Protected Attributes inherited from ultra::individual | |
| hash_t | signature_ {} |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<class T> | |
| bool | operator== (const vector_individual< T > &lhs, const vector_individual< T > &rhs) noexcept |
| template<class T> | |
| std::size_t | active_slots (const vector_individual< T > &ind) noexcept |
Provides a shared base for individuals with genomes stored in a vector.
| T | gene value type |
Shares genome access, signature maintenance and serialisation. Derived classes define evolutionary operators.
|
explicitprotected |
Allocates a genome for initialisation by a derived constructor.
| [in] | n | number of genes |
|
explicitprotected |
Constructs a random scalar genome and computes its signature.
| [in] | p | current problem |
|
protected |
Applies an operation to every gene and updates the signature.
| f | mutating callable returning void |
| void ultra::vector_individual< T >::apply_each | ( | F && | f | ) |
Applies an operation to every gene and updates the signature.
| f | mutating callable returning void |
| void ultra::vector_individual< T >::apply_each | ( | std::size_t | first, |
| std::size_t | last, | ||
| F && | f ) |
Applies an operation to a range of genes and updates the signature.
| first | first index (inclusive) |
| last | one past the last index (exclusive) |
| f | mutating callable returning void |
|
protected |
Applies an operation to a range of genes and updates the signature.
| first | first index (inclusive) |
| last | one past the last index (exclusive) |
| f | mutating callable returning void |
|
nodiscardnoexcept |
Returns a const iterator to the first gene.
|
nodiscardnoexcept |
Checks whether the genome is empty.
|
nodiscardnoexcept |
Returns a const iterator past the last gene.
|
nodiscardoverrideprotectedvirtual |
Hashes the raw genome bytes with MurmurHash3.
Implements ultra::individual.
|
nodiscard |
|
nodiscardnoexcept |
Provides read-only access to the genome vector.
| vector_individual< T > & vector_individual::operator= | ( | const std::vector< T > & | v | ) |
Replaces the genome and updates its signature.
| [in] | v | replacement genes |
|
nodiscard |
Returns the gene at the specified index.
| [in] | i | index of the gene |
|
nodiscardnoexcept |
Returns the number of parameters, equivalent to size().
|
nodiscardnoexcept |
Returns the number of genes.
|
Returns the number of parameters in the individual.
| [in] | ind | individual to inspect |
|
Compares genomes, ignoring age.
| [in] | lhs | first individual |
| [in] | rhs | second individual |