src/reduce.cpp
// This function implements the important reduction policy. It determines
// which redundant clauses are considered not useful and thus will be
// collected in a subsequent garbage collection phase.
This function implements the important reduction policy. It determines
which redundant clauses are considered not useful and thus will be
collected in a subsequent garbage collection phase.
This function implements the important reduction policy . It determines which redundant clauses are considered not useful and thus will be collected in a subsequent garbage collection phase .
void Internal::mark_useless_redundant_clauses_as_garbage () {
  vector<Clause*> stack;
  stack.reserve (stats.redundant);
  const_clause_iterator end = clauses.end (), i;
  for (i = clauses.begin (); i != end; i++) {
    Clause * c = *i;
    if (!c->redundant) continue;    
    if (c->garbage) continue;       
    if (c->reason) continue;        
    const bool used = c->used;
    c->used = false;
    if (c->hbr) {                   
      assert (c->size == 2);        
      if (!used) mark_garbage (c);  
      continue;                     
    }
    if (used) continue;		    
    if (c->keep) continue;          
    if (stabilization && c->stable) 
      continue;
    stack.push_back (c);
  }
  stable_sort (stack.begin (), stack.end (), less_useful (this));
  const_clause_iterator target = stack.begin () + stack.size ()/2;
  for (const_clause_iterator i = stack.begin (); i != target; i++) {
    LOG (*i, "marking useless to be collected");
    mark_garbage (*i);
    stats.reduced++;
  }
  lim.keptsize = lim.keptglue = 0;
  end = stack.end ();
  for (i = target; i != end; i++) {
    const Clause * c = *i;
    if (c->size > lim.keptsize) lim.keptsize = c->size;
    if (c->glue > lim.keptglue) lim.keptglue = c->glue;
  }
  VRB ("reduce", stats.reductions,
    "maximum kept size %d glue %d", lim.keptsize, lim.keptglue);
}
void Internal :: mark_useless_redundant_clauses_as_garbage ( ) { vector < Clause * > stack ; stack . reserve ( stats . redundant ) ; const_clause_iterator end = clauses . end ( ) , i ; for ( i = clauses . begin ( ) ; i != end ; i ++ ) { Clause * c = * i ; if ( ! c -> redundant ) continue ; if ( c -> garbage ) continue ; if ( c -> reason ) continue ; const bool used = c -> used ; c -> used = false ; if ( c -> hbr ) { assert ( c -> size == 2 ) ; if ( ! used ) mark_garbage ( c ) ; continue ; } if ( used ) continue ; if ( c -> keep ) continue ; if ( stabilization && c -> stable ) continue ; stack . push_back ( c ) ; } stable_sort ( stack . begin ( ) , stack . end ( ) , less_useful ( this ) ) ; const_clause_iterator target = stack . begin ( ) + stack . size ( ) / 2 ; for ( const_clause_iterator i = stack . begin ( ) ; i != target ; i ++ ) { LOG ( * i , " " ) ; mark_garbage ( * i ) ; stats . reduced ++ ; } lim . keptsize = lim . keptglue = 0 ; end = stack . end ( ) ; for ( i = target ; i != end ; i ++ ) { const Clause * c = * i ; if ( c -> size > lim . keptsize ) lim . keptsize = c -> size ; if ( c -> glue > lim . keptglue ) lim . keptglue = c -> glue ; } VRB ( " " , stats . reductions , " " , lim . keptsize , lim . keptglue ) ; }
This function implements the important reduction policy.
This function implements the important reduction policy .
// keep irredundant // skip already marked // need to keep reasons // Hyper binary resolvents are only // kept for one round (even though // 'c->keep' is true) unless they // were recently used. // keep recently used // forced to keep (see above) // keep during stabilization