Пример #1
0
node_statistics calc_node_statistics( Pop const& pop )
{
    GPCXX_ASSERT( pop.size() > 0 );

    size_t n = pop.size();

    node_statistics stat;
    for( size_t i=0 ; i<n ; ++i )
    {
        node_statistics tmp = calc_node_statistics_tree( pop[i] );
        stat.num_nodes += tmp.num_nodes;
        stat.num_terminals += tmp.num_terminals;
        stat.num_unaries += tmp.num_unaries;
        stat.num_binaries += tmp.num_binaries;
    }
    return stat;
}
Пример #2
0
 std::vector< typename Pop::const_iterator >
 selection( Pop const& pop , Fitness const& fitness )
 {
     GPCXX_ASSERT( pop.size() > 2 );
     std::vector< typename Pop::const_iterator > s(2);
     s[1] = s[0] = m_selector( pop , fitness );
     while( s[0] == s[1] )
         s[1] = m_selector( pop , fitness );
     return s;
 }