static pset_family do_minimize(pset_family F, pset_family D, pset_family R, int exact_cover, int weighted) { pset_family newF, E, Rt, Rp; pset p, last; int heur, level, *weights; sm_matrix *table; sm_row *cover; sm_element *pe; int debug_save = debug; if (debug & 0x0400) { debug |= (0x0020 | 0x0800); } if (debug & 0x0800) { setlinebuf((&_iob[1])); } level = (debug & 0x0800) ? 4 : 0; heur = ! exact_cover; {long t=util_cpu_time();F = primes_consensus(cube2list(F, D));if(trace)print_trace( F, "PRIMES ",util_cpu_time()-t);}; {long t=util_cpu_time();irred_split_cover(F, D, &E, &Rt, &Rp);if(trace)print_trace( E, "ESSENTIALS ",util_cpu_time()-t);}; {long t=util_cpu_time();table = irred_derive_table(D, E, Rp);if(trace)print_trace( Rp, "PI-TABLE ",util_cpu_time()-t);}; if (weighted) { weights = ((int *) malloc(sizeof(int) * ( F->count))); for( p=Rp->data, last= p+Rp->count*Rp->wsize; p< last; p+=Rp->wsize) { weights[(p[0] >> 16)] = cube.size - set_ord(p); } } else {
static set_family_t * do_minimize(set_family_t *F, set_family_t *D, set_family_t *R, int exact_cover, int weighted) { set_family_t *newF, *E, *Rt, *Rp; set *p, *last; int heur, level, *weights; sm_matrix *table; sm_row *cover; sm_element *pe; int debug_save = debug; if (debug & EXACT) { debug |= (IRRED | MINCOV); } level = (debug & MINCOV) ? 4 : 0; heur = ! exact_cover; // Generate all prime implicants F = primes_consensus(cube2list(F, D)); // Setup the prime implicant table irred_split_cover(F, D, &E, &Rt, &Rp); table = irred_derive_table(D, E, Rp); // Solve either a weighted or nonweighted covering problem if (weighted) { // correct only for all 2-valued variables weights = ALLOC(int, F->count); foreach_set(Rp, last, p) { weights[SIZE(p)] = CUBE.size - set_ord(p); } }
static pcover do_minimize(pset_family F, pset_family D, pset_family R, int exact_cover, int weighted) { pcover newF, E, Rt, Rp; pset p, last; int heur, level, *weights; sm_matrix *table; sm_row *cover; sm_element *pe; int debug_save = debug; if (debug & EXACT) { debug |= (IRRED | MINCOV); } #if defined(sun) || defined(bsd4_2) /* hack ... */ if (debug & MINCOV) { setlinebuf(stdout); } #endif level = (debug & MINCOV) ? 4 : 0; heur = ! exact_cover; /* Generate all prime implicants */ EXEC(F = primes_consensus(cube2list(F, D)), "PRIMES ", F); /* Setup the prime implicant table */ EXEC(irred_split_cover(F, D, &E, &Rt, &Rp), "ESSENTIALS ", E); EXEC(table = irred_derive_table(D, E, Rp), "PI-TABLE ", Rp); /* Solve either a weighted or nonweighted covering problem */ if (weighted) { /* correct only for all 2-valued variables */ weights = ALLOC(int, F->count); foreach_set(Rp, last, p) { weights[SIZE(p)] = cube.size - set_ord(p); } } else {