extract_first_clause | first_lightest_clause | remove_from_sos_lightest | |
extract_lightest_clause | insert_into_sos_lightest | zap_sos_lightest |
Clause extract_first_clause(Clist lst);Given a nonempty Clist, remove and return the first clause. Also, this may update the index for finding lightest clauses.
Clause extract_lightest_clause(Clist sos);This routine uses a private index to extract the first shortest clause from the sos list.
Clause first_lightest_clause(Clist l);This function returns the (first) shortest clause in the Clist.
void insert_into_sos_lightest(Clause c, Clist sos);This routine appends a clasue to the sos list and updates the (private) index for extracting shortest clauses.
void remove_from_sos_lightest(Clause c, Clist sos);This routine removes a clause from the sos list and updates the index for extracting the lightest clause.
void zap_sos_lightest(void);
We use a private index to quickly find the first, shortest clause in Sos. Here are the routines to use under ordinary circumstances.
We use an auxiliary Clist "Lightest" so that we don't have to scan Sos each time we need a new given clause. At any given time, Lightest is either empty or contains all of the Sos clauses of minimum weight, in the same order as in Sos.
To insert a newly kept clause c into Sos: If c is the same weight as clauses in Lightest, append it to Lightest as well as to Sos. If c is heaaver than Lightest, append it to Sos only. If c is lighter than Lightest, remove all clauses from Lightest, (leaving Lightest empty), and append c to Sos.
To get the first, lightest clause: If Lightest is empty, build a new Lightest list. Now just take the first member of Lightest.
Good performance of this scheme depends on the assumption that the Lightest list is farily stable; that is, as we go from given clause to given clause, the weight of the lightest clauses doesn't change often.
These activities are projects of the Mathematics and Computer Science Division of Argonne National Laboratory.