Exemplo n.º 1
0
void enumerate_pairs( PWW p )
{
  set< PII > checked_pairs;
  set< PII > unchecked_pairs;

  smallestEquivalentWord( p.first  );
  smallestEquivalentWord( p.second );
  int n1 = word_2_number( p.first  );
  int n2 = word_2_number( p.second );
  if( n1<n2 ) swap( n1 , n2 );
  unchecked_pairs.insert( PII(n1,n2) );
  
  for( int i=0 ; !unchecked_pairs.empty( ) && i<100000 ; ++i ) {
    PII p = *unchecked_pairs.begin( );
    unchecked_pairs.erase( unchecked_pairs.begin( ) );
    checked_pairs.insert( p );
    process_pair( p , checked_pairs , unchecked_pairs );
  }
}
Exemplo n.º 2
0
void binomialGB_comp::start_computation()
{
  binomial_s_pair s;
  int *deg = 0;
  if (stop_.always_stop) return; // don't change status
  if (stop_.stop_after_degree) deg = &stop_.degree_limit->array[0];
  while (Pairs->next(deg, s, top_degree))
    {
      ComputationStatusCode ret = gb_done();
      if (ret != COMP_COMPUTING) return;
      process_pair(s);          // consumes 's'.
      if (system_interrupted())
        {
          set_status(COMP_INTERRUPTED);
          return;
        }
    }
  if (Pairs->n_elems() == 0)
    set_status(COMP_DONE);
  else
    set_status(COMP_DONE_DEGREE_LIMIT);
}