ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
expand.c
Go to the documentation of this file.
1/*
2 * Revision Control Information
3 *
4 * $Source$
5 * $Author$
6 * $Revision$
7 * $Date$
8 *
9 */
10/*
11 module: expand.c
12 purpose: Perform the Espresso-II Expansion Step
13
14 The idea is to take each nonprime cube of the on-set and expand it
15 into a prime implicant such that we can cover as many other cubes
16 of the on-set. If no cube of the on-set can be covered, then we
17 expand each cube into a large prime implicant by transforming the
18 problem into a minimum covering problem which is solved by the
19 heuristics of minimum_cover.
20
21 These routines revolve around having a representation of the
22 OFF-set. (In contrast to the Espresso-II manuscript, we do NOT
23 require an "unwrapped" version of the OFF-set).
24
25 Some conventions on variable names:
26
27 SUPER_CUBE is the supercube of all cubes which can be covered
28 by an expansion of the cube being expanded
29
30 OVEREXPANDED_CUBE is the cube which would result from expanding
31 all parts which can expand individually of the cube being expanded
32
33 RAISE is the current expansion of the current cube
34
35 FREESET is the set of parts which haven't been raised or lowered yet.
36
37 INIT_LOWER is a set of parts to be removed from the free parts before
38 starting the expansion
39*/
40
41#include "espresso.h"
42
44
45
46/*
47 expand -- expand each nonprime cube of F into a prime implicant
48
49 If nonsparse is true, only the non-sparse variables will be expanded;
50 this is done by forcing all of the sparse variables out of the free set.
51*/
52
53pcover expand(F, R, nonsparse)
55IN pcover R;
56IN bool nonsparse; /* expand non-sparse variables only */
57{
58 register pcube last, p;
59 pcube RAISE, FREESET, INIT_LOWER, SUPER_CUBE, OVEREXPANDED_CUBE;
60 int var, num_covered;
61 bool change;
62
63 /* Order the cubes according to "chewing-away from the edges" of mini */
65 F = random_order(F);
66 else
67 F = mini_sort(F, ascend);
68
69 /* Allocate memory for variables needed by expand1() */
70 RAISE = new_cube();
71 FREESET = new_cube();
72 INIT_LOWER = new_cube();
73 SUPER_CUBE = new_cube();
74 OVEREXPANDED_CUBE = new_cube();
75
76 /* Setup the initial lowering set (differs only for nonsparse) */
77 if (nonsparse)
78 for(var = 0; var < cube.num_vars; var++)
79 if (cube.sparse[var])
80 (void) set_or(INIT_LOWER, INIT_LOWER, cube.var_mask[var]);
81
82 /* Mark all cubes as not covered, and maybe essential */
83 foreach_set(F, last, p) {
84 RESET(p, COVERED);
86 }
87
88 /* Try to expand each nonprime and noncovered cube */
89 foreach_set(F, last, p) {
90 /* do not expand if PRIME or if covered by previous expansion */
91 if (! TESTP(p, PRIME) && ! TESTP(p, COVERED)) {
92
93 /* expand the cube p, result is RAISE */
94 expand1(R, F, RAISE, FREESET, OVEREXPANDED_CUBE, SUPER_CUBE,
95 INIT_LOWER, &num_covered, p);
96 if (debug & EXPAND)
97 printf("EXPAND: %s (covered %d)\n", pc1(p), num_covered);
98 (void) set_copy(p, RAISE);
99 SET(p, PRIME);
100 RESET(p, COVERED); /* not really necessary */
101
102 /* See if we generated an inessential prime */
103 if (num_covered == 0 && ! setp_equal(p, OVEREXPANDED_CUBE)) {
104 SET(p, NONESSEN);
105 }
106 }
107 }
108
109 /* Delete any cubes of F which became covered during the expansion */
110 F->active_count = 0;
111 change = FALSE;
112 foreach_set(F, last, p) {
113 if (TESTP(p, COVERED)) {
114 RESET(p, ACTIVE);
115 change = TRUE;
116 } else {
117 SET(p, ACTIVE);
118 F->active_count++;
119 }
120 }
121 if (change)
122 F = sf_inactive(F);
123
124 free_cube(RAISE);
125 free_cube(FREESET);
126 free_cube(INIT_LOWER);
127 free_cube(SUPER_CUBE);
128 free_cube(OVEREXPANDED_CUBE);
129 return F;
130}
131
132/*
133 expand1 -- Expand a single cube against the OFF-set
134*/
135void expand1(BB, CC, RAISE, FREESET, OVEREXPANDED_CUBE, SUPER_CUBE,
136 INIT_LOWER, num_covered, c)
137pcover BB; /* Blocking matrix (OFF-set) */
138pcover CC; /* Covering matrix (ON-set) */
139pcube RAISE; /* The current parts which have been raised */
140pcube FREESET; /* The current parts which are free */
141pcube OVEREXPANDED_CUBE; /* Overexpanded cube of c */
142pcube SUPER_CUBE; /* Supercube of all cubes of CC we cover */
143pcube INIT_LOWER; /* Parts to initially remove from FREESET */
144int *num_covered; /* Number of cubes of CC which are covered */
145pcube c; /* The cube to be expanded */
146{
147 int bestindex;
148
149 if (debug & EXPAND1)
150 printf("\nEXPAND1: \t%s\n", pc1(c));
151
152 /* initialize BB and CC */
153 SET(c, PRIME); /* don't try to cover ourself */
154 setup_BB_CC(BB, CC);
155
156 /* initialize count of # cubes covered, and the supercube of them */
157 *num_covered = 0;
158 (void) set_copy(SUPER_CUBE, c);
159
160 /* Initialize the lowering, raising and unassigned sets */
161 (void) set_copy(RAISE, c);
162 (void) set_diff(FREESET, cube.fullset, RAISE);
163
164 /* If some parts are forced into lowering set, remove them */
165 if (! setp_empty(INIT_LOWER)) {
166 (void) set_diff(FREESET, FREESET, INIT_LOWER);
167 elim_lowering(BB, CC, RAISE, FREESET);
168 }
169
170 /* Determine what can be raised, and return the over-expanded cube */
171 essen_parts(BB, CC, RAISE, FREESET);
172 (void) set_or(OVEREXPANDED_CUBE, RAISE, FREESET);
173
174 /* While there are still cubes which can be covered, cover them ! */
175 if (CC->active_count > 0) {
176 select_feasible(BB, CC, RAISE, FREESET, SUPER_CUBE, num_covered);
177 }
178
179 /* While there are still cubes covered by the overexpanded cube ... */
180 while (CC->active_count > 0) {
181 bestindex = most_frequent(CC, FREESET);
182 set_insert(RAISE, bestindex);
183 set_remove(FREESET, bestindex);
184 essen_parts(BB, CC, RAISE, FREESET);
185 }
186
187 /* Finally, when all else fails, choose the largest possible prime */
188 /* We will loop only if we decide unravelling OFF-set is too expensive */
189 while (BB->active_count > 0) {
190 mincov(BB, RAISE, FREESET);
191 }
192
193 /* Raise any remaining free coordinates */
194 (void) set_or(RAISE, RAISE, FREESET);
195}
196
197/*
198 essen_parts -- determine which parts are forced into the lowering
199 set to insure that the cube be orthognal to the OFF-set.
200
201 If any cube of the OFF-set is distance 1 from the raising cube,
202 then we must lower all parts of the conflicting variable. (If the
203 cube is distance 0, we detect this error here.)
204
205 If there are essentially lowered parts, we can remove from consideration
206 any cubes of the OFF-set which are more than distance 1 from the
207 overexpanded cube of RAISE.
208*/
209
210void essen_parts(BB, CC, RAISE, FREESET)
211pcover BB, CC;
212pcube RAISE, FREESET;
213{
214 register pcube p, r = RAISE;
215 pcube lastp, xlower = cube.temp[0];
216 int dist;
217
218 (void) set_copy(xlower, cube.emptyset);
219
220 foreach_active_set(BB, lastp, p) {
221#ifdef NO_INLINE
222 if ((dist = cdist01(p, r)) > 1) goto exit_if;
223#else
224 {register int w,last;register unsigned int x;dist=0;if((last=cube.inword)!=-1)
225{x=p[last]&r[last];if((x=~(x|x>>1)&cube.inmask))if((dist=count_ones(x))>1)goto
226exit_if;for(w=1;w<last;w++){x=p[w]&r[w];if((x=~(x|x>>1)&DISJOINT))if(dist==1||(
227dist+=count_ones(x))>1)goto exit_if;}}}{register int w,var,last;register pcube
228mask;for(var=cube.num_binary_vars;var<cube.num_vars;var++){mask=cube.var_mask[
229var];last=cube.last_word[var];for(w=cube.first_word[var];w<=last;w++)if(p[w]&r[
230w]&mask[w])goto nextvar;if(++dist>1)goto exit_if;nextvar:;}}
231#endif
232 if (dist == 0) {
233 fatal("ON-set and OFF-set are not orthogonal");
234 } else {
235 (void) force_lower(xlower, p, r);
236 BB->active_count--;
237 RESET(p, ACTIVE);
238 }
239exit_if: ;
240 }
241
242 if (! setp_empty(xlower)) {
243 (void) set_diff(FREESET, FREESET, xlower);/* remove from free set */
244 elim_lowering(BB, CC, RAISE, FREESET);
245 }
246
247 if (debug & EXPAND1)
248 printf("ESSEN_PARTS:\tRAISE=%s FREESET=%s\n", pc1(RAISE), pc2(FREESET));
249}
250
251/*
252 essen_raising -- determine which parts may always be added to
253 the raising set without restricting further expansions
254
255 General rule: if some part is not blocked by any cube of BB, then
256 this part can always be raised.
257*/
258
259void essen_raising(BB, RAISE, FREESET)
260register pcover BB;
261pcube RAISE, FREESET;
262{
263 register pcube last, p, xraise = cube.temp[0];
264
265 /* Form union of all cubes of BB, and then take complement wrt FREESET */
266 (void) set_copy(xraise, cube.emptyset);
267 foreach_active_set(BB, last, p)
268 INLINEset_or(xraise, xraise, p);
269 (void) set_diff(xraise, FREESET, xraise);
270
271 (void) set_or(RAISE, RAISE, xraise); /* add to raising set */
272 (void) set_diff(FREESET, FREESET, xraise); /* remove from free set */
273
274 if (debug & EXPAND1)
275 printf("ESSEN_RAISING:\tRAISE=%s FREESET=%s\n",
276 pc1(RAISE), pc2(FREESET));
277}
278
279/*
280 elim_lowering -- after removing parts from FREESET, we can reduce the
281 size of both BB and CC.
282
283 We mark as inactive any cube of BB which does not intersect the
284 overexpanded cube (i.e., RAISE + FREESET). Likewise, we remove
285 from CC any cube which is not covered by the overexpanded cube.
286*/
287
288void elim_lowering(BB, CC, RAISE, FREESET)
289pcover BB, CC;
290pcube RAISE, FREESET;
291{
292 register pcube p, r = set_or(cube.temp[0], RAISE, FREESET);
293 pcube last;
294
295 /*
296 * Remove sets of BB which are orthogonal to future expansions
297 */
298 foreach_active_set(BB, last, p) {
299#ifdef NO_INLINE
300 if (! cdist0(p, r))
301#else
302 {register int w,lastw;register unsigned int x;if((lastw=cube.inword)!=-1){x=p[
303lastw]&r[lastw];if(~(x|x>>1)&cube.inmask)goto false;for(w=1;w<lastw;w++){x=p[w]
304&r[w];if(~(x|x>>1)&DISJOINT)goto false;}}}{register int w,var,lastw;register
305pcube mask;for(var=cube.num_binary_vars;var<cube.num_vars;var++){mask=cube.
306var_mask[var];lastw=cube.last_word[var];for(w=cube.first_word[var];w<=lastw;w++)
307if(p[w]&r[w]&mask[w])goto nextvar;goto false;nextvar:;}}continue;false:
308#endif
309 BB->active_count--, RESET(p, ACTIVE);
310 }
311
312
313 /*
314 * Remove sets of CC which cannot be covered by future expansions
315 */
316 if (CC != (pcover) NULL) {
317 foreach_active_set(CC, last, p) {
318#ifdef NO_INLINE
319 if (! setp_implies(p, r))
320#else
321 INLINEsetp_implies(p, r, /* when false => */ goto false1);
322 /* when true => go to end of loop */ continue;
323 false1:
324#endif
325 CC->active_count--, RESET(p, ACTIVE);
326 }
327 }
328}
329
330/*
331 most_frequent -- When all else fails, select a reasonable part to raise
332 The active cubes of CC are the cubes which are covered by the
333 overexpanded cube of the original cube (however, we know that none
334 of them can actually be covered by a feasible expansion of the
335 original cube). We resort to the MINI strategy of selecting to
336 raise the part which will cover the same part in the most cubes of CC.
337*/
338int most_frequent(CC, FREESET)
339pcover CC;
340pcube FREESET;
341{
342 register int i, best_part, best_count, *count;
343 register pset p, last;
344
345 /* Count occurences of each variable */
346 count = ALLOC(int, cube.size);
347 for(i = 0; i < cube.size; i++)
348 count[i] = 0;
349 if (CC != (pcover) NULL)
350 foreach_active_set(CC, last, p)
351 set_adjcnt(p, count, 1);
352
353 /* Now find which free part occurs most often */
354 best_count = best_part = -1;
355 for(i = 0; i < cube.size; i++)
356 if (is_in_set(FREESET,i) && count[i] > best_count) {
357 best_part = i;
358 best_count = count[i];
359 }
360 FREE(count);
361
362 if (debug & EXPAND1)
363 printf("MOST_FREQUENT:\tbest=%d FREESET=%s\n", best_part, pc2(FREESET));
364 return best_part;
365}
366
367/*
368 setup_BB_CC -- set up the blocking and covering set families;
369
370 Note that the blocking family is merely the set of cubes of R, and
371 that CC is the set of cubes of F which might possibly be covered
372 (i.e., nonprime cubes, and cubes not already covered)
373*/
374
375void setup_BB_CC(BB, CC)
376register pcover BB, CC;
377{
378 register pcube p, last;
379
380 /* Create the block and cover set families */
381 BB->active_count = BB->count;
382 foreach_set(BB, last, p)
383 SET(p, ACTIVE);
384
385 if (CC != (pcover) NULL) {
386 CC->active_count = CC->count;
387 foreach_set(CC, last, p)
388 if (TESTP(p, COVERED) || TESTP(p, PRIME))
389 CC->active_count--, RESET(p, ACTIVE);
390 else
391 SET(p, ACTIVE);
392 }
393}
394
395/*
396 select_feasible -- Determine if there are cubes which can be covered,
397 and if so, raise those parts necessary to cover as many as possible.
398
399 We really don't check to maximize the number that can be covered;
400 instead, we check, for each fcc, how many other fcc remain fcc
401 after expanding to cover the fcc. (Essentially one-level lookahead).
402*/
403
404void select_feasible(BB, CC, RAISE, FREESET, SUPER_CUBE, num_covered)
405pcover BB, CC;
406pcube RAISE, FREESET, SUPER_CUBE;
407int *num_covered;
408{
409 register pcube p, last;
410 register pcube bestfeas = NULL; // Suppress "might be used uninitialized"
411 register pcube *feas;
412 register int i, j;
413 pcube *feas_new_lower;
414 int bestcount, bestsize, count, size, numfeas, lastfeas;
415 pcover new_lower;
416
417 /* Start out with all cubes covered by the over-expanded cube as
418 * the "possibly" feasibly-covered cubes (pfcc)
419 */
420 feas = ALLOC(pcube, CC->active_count);
421 numfeas = 0;
422 foreach_active_set(CC, last, p)
423 feas[numfeas++] = p;
424
425 /* Setup extra cubes to record parts forced low after a covering */
426 feas_new_lower = ALLOC(pcube, CC->active_count);
427 new_lower = new_cover(numfeas);
428 for(i = 0; i < numfeas; i++)
429 feas_new_lower[i] = GETSET(new_lower, i);
430
431
432loop:
433 /* Find the essentially raised parts -- this might cover some cubes
434 for us, without having to find out if they are fcc or not
435 */
436 essen_raising(BB, RAISE, FREESET);
437
438 /* Now check all "possibly" feasibly covered cubes to check feasibility */
439 lastfeas = numfeas;
440 numfeas = 0;
441 for(i = 0; i < lastfeas; i++) {
442 p = feas[i];
443
444 /* Check active because essen_parts might have removed it */
445 if (TESTP(p, ACTIVE)) {
446
447 /* See if the cube is already covered by RAISE --
448 * this can happen because of essen_raising() or because of
449 * the previous "loop"
450 */
451 if (setp_implies(p, RAISE)) {
452 (*num_covered) += 1;
453 (void) set_or(SUPER_CUBE, SUPER_CUBE, p);
454 CC->active_count--;
455 RESET(p, ACTIVE);
456 SET(p, COVERED);
457 /* otherwise, test if it is feasibly covered */
458 } else if (feasibly_covered(BB,p,RAISE,feas_new_lower[numfeas])) {
459 feas[numfeas] = p; /* save the fcc */
460 numfeas++;
461 }
462 }
463 }
464 if (debug & EXPAND1)
465 printf("SELECT_FEASIBLE: started with %d pfcc, ended with %d fcc\n",
466 lastfeas, numfeas);
467
468 /* Exit here if there are no feasibly covered cubes */
469 if (numfeas == 0) {
470 FREE(feas);
471 FREE(feas_new_lower);
472 free_cover(new_lower);
473 return;
474 }
475
476 /* Now find which is the best feasibly covered cube */
477 bestcount = 0;
478 bestsize = 9999;
479 for(i = 0; i < numfeas; i++) {
480 size = set_dist(feas[i], FREESET); /* # of newly raised parts */
481 count = 0; /* # of other cubes which remain fcc after raising */
482
483#define NEW
484#ifdef NEW
485 for(j = 0; j < numfeas; j++)
486 if (setp_disjoint(feas_new_lower[i], feas[j]))
487 count++;
488#else
489 for(j = 0; j < numfeas; j++)
490 if (setp_implies(feas[j], feas[i]))
491 count++;
492#endif
493 if (count > bestcount) {
494 bestcount = count;
495 bestfeas = feas[i];
496 bestsize = size;
497 } else if (count == bestcount && size < bestsize) {
498 bestfeas = feas[i];
499 bestsize = size;
500 }
501 }
502
503 /* Add the necessary parts to the raising set */
504 (void) set_or(RAISE, RAISE, bestfeas);
505 (void) set_diff(FREESET, FREESET, RAISE);
506 if (debug & EXPAND1)
507 printf("FEASIBLE: \tRAISE=%s FREESET=%s\n", pc1(RAISE), pc2(FREESET));
508 essen_parts(BB, CC, RAISE, FREESET);
509 goto loop;
510/* NOTREACHED */
511}
512
513/*
514 feasibly_covered -- determine if the cube c is feasibly covered
515 (i.e., if it is possible to raise all of the necessary variables
516 while still insuring orthogonality with R). Also, if c is feasibly
517 covered, then compute the new set of parts which are forced into
518 the lowering set.
519*/
520
521bool feasibly_covered(BB, c, RAISE, new_lower)
522pcover BB;
523pcube c, RAISE, new_lower;
524{
525 register pcube p, r = set_or(cube.temp[0], RAISE, c);
526 int dist;
527 pcube lastp;
528
529 set_copy(new_lower, cube.emptyset);
530 foreach_active_set(BB, lastp, p) {
531#ifdef NO_INLINE
532 if ((dist = cdist01(p, r)) > 1) goto exit_if;
533#else
534 {register int w,last;register unsigned int x;dist=0;if((last=cube.inword)!=-1)
535{x=p[last]&r[last];if((x=~(x|x>>1)&cube.inmask))if((dist=count_ones(x))>1)goto
536exit_if;for(w=1;w<last;w++){x=p[w]&r[w];if((x=~(x|x>>1)&DISJOINT))if(dist==1||(
537dist+=count_ones(x))>1)goto exit_if;}}}{register int w,var,last;register pcube
538mask;for(var=cube.num_binary_vars;var<cube.num_vars;var++){mask=cube.var_mask[
539var];last=cube.last_word[var];for(w=cube.first_word[var];w<=last;w++)if(p[w]&r[
540w]&mask[w])goto nextvar;if(++dist>1)goto exit_if;nextvar:;}}
541#endif
542 if (dist == 0)
543 return FALSE;
544 else
545 (void) force_lower(new_lower, p, r);
546 exit_if: ;
547 }
548 return TRUE;
549}
550
551/*
552 mincov -- transform the problem of expanding a cube to a maximally-
553 large prime implicant into the problem of selecting a minimum
554 cardinality cover over a family of sets.
555
556 When we get to this point, we must unravel the remaining off-set.
557 This may be painful.
558*/
559
560void mincov(BB, RAISE, FREESET)
561pcover BB;
562pcube RAISE, FREESET;
563{
564 int expansion, nset, var, dist;
565 pset_family B;
566 register pcube xraise=cube.temp[0], xlower, p, last, plower;
567
568#ifdef RANDOM_MINCOV
569#if defined(_POSIX_SOURCE) || defined(__SVR4)
570 dist = rand() % set_ord(FREESET);
571#else
572 dist = random() % set_ord(FREESET);
573#endif
574 for(var = 0; var < cube.size && dist >= 0; var++) {
575 if (is_in_set(FREESET, var)) {
576 dist--;
577 }
578 }
579
580 set_insert(RAISE, var);
581 set_remove(FREESET, var);
582 (void) essen_parts(BB, /*CC*/ (pcover) NULL, RAISE, FREESET);
583#else
584
585 /* Create B which are those cubes which we must avoid intersecting */
586 B = new_cover(BB->active_count);
587 foreach_active_set(BB, last, p) {
588 plower = set_copy(GETSET(B, B->count++), cube.emptyset);
589 (void) force_lower(plower, p, RAISE);
590 }
591
592 /* Determine how many sets it will blow up into after the unravel */
593 nset = 0;
594 foreach_set(B, last, p) {
595 expansion = 1;
596 for(var = cube.num_binary_vars; var < cube.num_vars; var++) {
597 if ((dist=set_dist(p, cube.var_mask[var])) > 1) {
598 expansion *= dist;
599 if (expansion > 500) goto heuristic_mincov;
600 }
601 }
602 nset += expansion;
603 if (nset > 500) goto heuristic_mincov;
604 }
605
606 B = unravel(B, cube.num_binary_vars);
607 xlower = do_sm_minimum_cover(B);
608
609 /* Add any remaining free parts to the raising set */
610 (void) set_or(RAISE, RAISE, set_diff(xraise, FREESET, xlower));
611 (void) set_copy(FREESET, cube.emptyset); /* free set is empty */
612 BB->active_count = 0; /* BB satisfied */
613 if (debug & EXPAND1) {
614 printf("MINCOV: \tRAISE=%s FREESET=%s\n", pc1(RAISE), pc2(FREESET));
615 }
616 sf_free(B);
617 set_free(xlower);
618 return;
619
620heuristic_mincov:
621 sf_free(B);
622 /* most_frequent will pick first free part */
623 set_insert(RAISE, most_frequent(/*CC*/ (pcover) NULL, FREESET));
624 (void) set_diff(FREESET, FREESET, RAISE);
625 essen_parts(BB, /*CC*/ (pcover) NULL, RAISE, FREESET);
626 return;
627#endif
628}
629
630/*
631 find_all_primes -- find all of the primes which cover the
632 currently reduced BB
633*/
634pcover find_all_primes(BB, RAISE, FREESET)
635pcover BB;
636register pcube RAISE, FREESET;
637{
638 register pset last, p, plower;
639 pset_family B, B1;
640
641 if (BB->active_count == 0) {
642 B1 = new_cover(1);
643 p = GETSET(B1, B1->count++);
644 (void) set_copy(p, RAISE);
645 SET(p, PRIME);
646 } else {
647 B = new_cover(BB->active_count);
648 foreach_active_set(BB, last, p) {
649 plower = set_copy(GETSET(B, B->count++), cube.emptyset);
650 (void) force_lower(plower, p, RAISE);
651 }
652 B = sf_rev_contain(unravel(B, cube.num_binary_vars));
653 B1 = exact_minimum_cover(B);
654 foreach_set(B1, last, p) {
655 INLINEset_diff(p, FREESET, p);
656 INLINEset_or(p, p, RAISE);
657 SET(p, PRIME);
658 }
659 free_cover(B);
660 }
661 return B1;
662}
663
664/*
665 all_primes -- foreach cube in F, generate all of the primes
666 which cover the cube.
667*/
668
670pcover F, R;
671{
672 register pcube last, p, RAISE, FREESET;
673 pcover Fall_primes, B1;
674
675 FREESET = new_cube();
676 RAISE = new_cube();
677 Fall_primes = new_cover(F->count);
678
679 foreach_set(F, last, p) {
680 if (TESTP(p, PRIME)) {
681 Fall_primes = sf_addset(Fall_primes, p);
682 } else {
683 /* Setup for call to essential parts */
684 (void) set_copy(RAISE, p);
685 (void) set_diff(FREESET, cube.fullset, RAISE);
686 setup_BB_CC(R, /* CC */ (pcover) NULL);
687 essen_parts(R, /* CC */ (pcover) NULL, RAISE, FREESET);
688
689 /* Find all of the primes, and add them to the prime set */
690 B1 = find_all_primes(R, RAISE, FREESET);
691 Fall_primes = sf_append(Fall_primes, B1);
692 }
693 }
694
695 set_free(RAISE);
696 set_free(FREESET);
697 return Fall_primes;
698}
700
#define TRUE
Definition abcBm.c:38
#define FALSE
Definition abcBm.c:37
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define ALLOC(type, num)
Definition avl.h:27
#define FREE(obj)
Definition avl.h:31
#define pcover
Definition espresso.h:264
pset_family sf_addset()
#define new_cube()
Definition espresso.h:262
char * pc1()
int ascend()
void setup_BB_CC()
#define DISJOINT
Definition espresso.h:514
pcover expand()
#define INLINEset_diff(r, a, b)
Definition espresso.h:208
void mincov()
#define INLINEset_or(r, a, b)
Definition espresso.h:205
pcover all_primes()
void essen_parts()
pset_family sf_inactive()
#define INLINEsetp_implies(a, b, when_false)
Definition espresso.h:228
#define is_in_set(set, e)
Definition espresso.h:170
void select_feasible()
#define set_free(r)
Definition espresso.h:167
void elim_lowering()
#define TESTP(set, flag)
Definition espresso.h:124
#define set_insert(set, e)
Definition espresso.h:172
bool setp_disjoint()
pset_family exact_minimum_cover()
#define ACTIVE
Definition espresso.h:129
void essen_raising()
pset force_lower()
#define EXPAND1
Definition espresso.h:354
void fatal()
#define EXPAND
Definition espresso.h:353
pcover random_order()
#define foreach_active_set(R, last, p)
Definition espresso.h:139
void expand1()
pcover mini_sort()
#define INOUT
Definition espresso.h:334
#define COVERED
Definition espresso.h:131
void sf_free()
#define pcube
Definition espresso.h:261
#define free_cover(r)
Definition espresso.h:266
pcover unravel()
#define GETSET(family, index)
Definition espresso.h:161
pset set_diff()
#define free_cube(r)
Definition espresso.h:263
#define set_remove(set, e)
Definition espresso.h:171
char * pc2()
struct set_family * pset_family
#define foreach_set(R, last, p)
Definition espresso.h:135
unsigned int debug
Definition globals.c:19
#define SET(set, flag)
Definition espresso.h:122
int set_ord()
pset_family sf_rev_contain()
bool setp_empty()
#define NONESSEN
Definition espresso.h:128
bool setp_implies()
int most_frequent()
#define IN
Definition espresso.h:332
void set_adjcnt()
#define RESET(set, flag)
Definition espresso.h:123
#define PRIME
Definition espresso.h:127
bool feasibly_covered()
pset do_sm_minimum_cover()
unsigned int * pset
Definition espresso.h:73
int cdist01()
bool use_random_order
Definition globals.c:38
pset set_or()
pset_family sf_append()
bool setp_equal()
pcover find_all_primes()
#define count_ones(v)
Definition espresso.h:245
bool cdist0()
pset set_copy()
#define new_cover(i)
Definition espresso.h:265
int set_dist()
Cube * p
Definition exorList.c:222
Definition exor.h:123
int count
Definition espresso.h:80
long random()