26 register unsigned int word_test, word_set, bit_test, bit_set;
39 for(i = 0; i < cube.size; i++) {
40 if (cdata.part_zeros[i] > 0) {
41 assert(ncol <= cdata.vars_unate);
50 for(T1 = T+2; (p = *T1++) != 0; ) {
51 if ((p[word_test] & bit_test) == 0) {
52 pA[word_set] |= bit_set;
67 register int i, ncol, lp;
69 int var, nunate, *unate;
73 B =
sf_new(A->count, cube.size);
77 unate =
ALLOC(
int, cube.num_vars);
79 for(var = 0; var < cube.num_vars; var++) {
80 if (cdata.is_unate[var]) {
81 unate[nunate++] =
var;
96 for(ncol = 0; ncol < nunate; ncol++) {
98 lp = cube.last_part[unate[ncol]];
99 for(i = cube.first_part[unate[ncol]]; i <= lp; i++) {
100 if (cdata.part_zeros[i] == 0) {
120 register pset p, last;
145 register pset p, p1, restrict;
147 int max_i, min_set_ord, j;
152 Abar =
sf_new(1, A->sf_size);
156 }
else if (A->count == 1) {
158 Abar =
sf_new(A->sf_size, A->sf_size);
159 for(i = 0; i < A->sf_size; i++) {
172 restrict =
set_new(A->sf_size);
173 min_set_ord = A->sf_size + 1;
175 if (
SIZE(p) < min_set_ord) {
177 min_set_ord =
SIZE(p);
178 }
else if (
SIZE(p) == min_set_ord) {
179 set_or(restrict, restrict, p);
184 if (min_set_ord == 0) {
189 }
else if (min_set_ord == 1) {
229 register pset p, last, p1;
234 long start =
ptime();
241 return sf_new(1, T->sf_size);
242 for(n = T->count, lev = 0; n != 0; n >>= 1, lev++) ;
249 stack[0].sf =
sf_new(1, T->sf_size);
250 stack[0].level = lev;
253 nlast =
GETSET(T, T->count - 1);
258 for(i = 0; i < T->sf_size; i++)
264 stack[n++].level = lev;
267 while (n > 1 && (stack[n-1].level==stack[n-2].level || p == nlast)) {
269 lvl =
MIN(stack[n-1].level, stack[n-2].level) - 1;
271 printf(
"# EXACT_MINCOV[%d]: %4d = %4d x %4d, time = %s\n",
272 lvl, temp->
count, stack[n-1].sf->count,
274 (void) fflush(stdout);
278 stack[n-2].sf = temp;
279 stack[n-2].level = lvl;
290 printf(
"MINCOV: family of all minimal coverings is\n");
309 register pset pi, pj, lasti, lastj, pt;
328 if (save && largest_only) {
329 if ((ord =
set_ord(pt)) > maxord) {
340 }
else if (ord < maxord) {
348 Tsave = (Tsave == NULL) ? T :
sf_union(Tsave, T);
361 Tsave = (Tsave == NULL) ? T :
sf_union(Tsave, T);
375 register pset last,
p, pdest;
378 Aprime =
sf_new(A->count, A->sf_size);
379 pdest = Aprime->
data;
384 pdest += Aprime->
wsize;
397 register
pset pick_set;
399 register pset last,
p, pdest;
402 Aprime =
sf_new(A->count, A->sf_size);
403 pdest = Aprime->
data;
408 pdest += Aprime->
wsize;
424 register int i, best_var, best_count, *count;
432 for(i = 0; i < A->sf_size; i++) {
433 if (count[i] > best_count) {
435 best_count = count[i];
441 fatal(
"abs_select_restricted: should not have best_var == -1");
#define INLINEset_diff(r, a, b)
pset_family sf_rev_contain(INOUT pset_family A)
#define PUTSIZE(set, size)
static pset_family abs_covered_many()
pset_family unate_complement(pset_family A)
#define foreach_set(R, last, p)
pcover lex_sort(pcover T)
ABC_NAMESPACE_IMPL_START pset_family sf_contain(INOUT pset_family A)
static int abs_select_restricted()
pcover map_unate_to_cover(pset_family A)
#define INLINEset_copy(r, a)
#define ABC_NAMESPACE_IMPL_END
#define is_in_set(set, e)
pset_family exact_minimum_cover(IN pset_family T)
int * sf_count_restricted()
#define WHICH_BIT(element)
#define ABC_NAMESPACE_IMPL_START
pset_family unate_intersect(pset_family A, pset_family B, bool largest_only)
#define set_remove(set, e)
static ABC_NAMESPACE_IMPL_START pset_family abs_covered()
#define set_insert(set, e)
#define GETSET(family, index)
#define WHICH_WORD(element)
pcover map_cover_to_unate(pcube *T)
pset_family sf_union(INOUT pset_family A, INOUT pset_family B)
pset_family unate_compl(pset_family A)
#define foreachi_set(R, i, p)
#define INLINEset_fill(r, size)