![]() |
Ultra 0.9.4
|
#include <team.h>
Public Types | |
| using | members_t = std::vector<I> |
| using | const_iterator = typename members_t::const_iterator |
| using | value_type = typename members_t::value_type |
Public Member Functions | |
| team (std::size_t) | |
| team (const problem &) | |
| team (std::vector< I >) | |
| unsigned | mutation (const problem &, double=1.0) |
| void | apply_decision_vector (const team_decision_vector &v) |
| const I & | operator[] (std::size_t) const |
| bool | empty () const noexcept |
| std::size_t | size () const noexcept |
| hash_t | signature () const noexcept |
| ultra::individual::age_t | age () const |
| void | inc_age (unsigned=1) |
| bool | is_valid () const |
| const_iterator | begin () const noexcept |
| const_iterator | end () const noexcept |
| bool | load (std::istream &, const symbol_set &) |
| bool | save (std::ostream &) const |
Static Public Attributes | |
| static constexpr std::size_t | max_team_size {1024} |
| Maximum allowed number of individuals in a team. | |
Friends | |
| template<Individual U> | |
| team< U > | crossover (const problem &, const team< U > &, const team< U > &) |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<Individual I> | |
| team< I > | crossover (const problem &prb, const team< I > &lhs, const team< I > &rhs) |
| template<Individual I> | |
| team_decision_vector | extract_decision_vector (const team< I > &t) |
| template<Individual I> | |
| unsigned | active_slots (const team< I > &t) |
| template<Individual I> | |
| bool | operator== (const team< I > &lhs, const team< I > &rhs) noexcept |
| template<Individual I> | |
| unsigned | distance (const team< I > &lhs, const team< I > &rhs) |
| template<Individual I> | |
| std::ostream & | operator<< (std::ostream &s, const team< I > &t) |
A collection of cooperating individuals used as a member of ultra::population.
In general, teams of individuals can be implemented in different ways.
|
explicit |
Allocates space for a given number of individuals.
|
explicit |
Creates a team of individuals that will cooperate to solve a task.
|
explicit |
Builds a team containing the individuals of a given vector.
| [in] | v | a vector of individuals |
|
nodiscard |
| void team::apply_decision_vector | ( | const team_decision_vector & | v | ) |
Applies a flat team decision vector to the corresponding team members.
| [in] | v | decision vector to be written back |
The entries of v are first regrouped by team member, then each member receives its own individual-level decision vector via I::apply_decision_vector().
This function updates only numeric arguments; it does not alter the team structure nor the structure of the contained individuals.
|
nodiscardnoexcept |
|
nodiscardnoexcept |
|
nodiscardnoexcept |
| void team::inc_age | ( | unsigned | delta = 1 | ) |
Increments the age of every element of the team.
| [in] | delta | variation of age |
|
nodiscard |
| bool team::load | ( | std::istream & | in, |
| const symbol_set & | ss ) |
| [in] | in | input stream |
| [in] | ss | active symbol set |
| unsigned team::mutation | ( | const problem & | prb, |
| double | temperature = 1.0 ) |
Mutates the individuals in this team and returns the number of mutations performed.
| [in] | prb | current problem |
| [in] | temperature | mutation intensity (1.0 preserves the configured probability) |
|
nodiscard |
| [in] | i | index of a member of the team |
| bool team::save | ( | std::ostream & | out | ) | const |
| [out] | out | output stream |
|
nodiscardnoexcept |
Signature maps syntactically distinct (but logically equivalent) teams to the same value.
In other words identical teams, at genotypic level, have the same signature; different teams at the genotypic level may be mapped to the same signature since the value of terminals is considered and not the index.
This is a very interesting property, useful for comparison, information retrieval, entropy calculation...
|
nodiscardnoexcept |
|
Total number of active functions.
\paramp[in] t team to be analyzed
|
| [in] | prb | current problem |
| [in] | lhs | first parent |
| [in] | rhs | second parent |
|
| [in] | lhs | first term of comparison |
| [in] | rhs | second term of comparison |
|
Extracts a flat decision vector from a team.
| [in] | t | team to analyse |
The resulting vector is obtained by concatenating the decision vectors of all member individuals. Each extracted coordinate is extended with the index of the corresponding team member so that the parameter can later be written back to the correct individual.
|
| [out] | s | output stream |
| [in] | t | team to print |
|
| [in] | lhs | first term of comparison |
| [in] | rhs | second term of comparison |