예제 #1
0
pcover espresso(pset_family F, pset_family D1, pset_family R)
{
    pcover E, D, Fsave;
    pset last, p;
    cost_t cost, best_cost;

begin:
    Fsave = sf_save(F);		/* save original function */
    D = sf_save(D1);		/* make a scratch copy of D */

    /* Setup has always been a problem */
    if (recompute_onset) {
	EXEC(E = simplify(cube1list(F)),     "SIMPLIFY   ", E);
	free_cover(F);
	F = E;
    }
    cover_cost(F, &cost);
    if (unwrap_onset && (cube.part_size[cube.num_vars - 1] > 1)
      && (cost.out != cost.cubes*cube.part_size[cube.num_vars-1])
      && (cost.out < 5000))
	EXEC(F = sf_contain(unravel(F, cube.num_vars - 1)), "SETUP      ", F);

    /* Initial expand and irredundant */
    foreach_set(F, last, p) {
	RESET(p, PRIME);
    }
예제 #2
0
파일: gasp.c 프로젝트: CARV-ICS-FORTH/scoop
void expand1_gasp(pset_family F, pset_family D, pset_family R, pset_family Foriginal, int c1index, pset_family *G)
{
register int c2index;
register pset p, last, c2under;
pset RAISE, FREESET, temp, *FD, c2essential;
pset_family F1;
if (debug & 0x0008) {
printf("\nEXPAND1_GASP:    \t%s\n", pc1(((F)->data + (F)->wsize * ( c1index))));
}
RAISE = set_clear(((unsigned int *) malloc(sizeof(unsigned int) * ( ((cube.size) <= 32 ? 2 : (((((cube.size)-1) >> 5) + 1) + 1))))), cube.size);
FREESET = set_clear(((unsigned int *) malloc(sizeof(unsigned int) * ( ((cube.size) <= 32 ? 2 : (((((cube.size)-1) >> 5) + 1) + 1))))), cube.size);
temp = set_clear(((unsigned int *) malloc(sizeof(unsigned int) * ( ((cube.size) <= 32 ? 2 : (((((cube.size)-1) >> 5) + 1) + 1))))), cube.size);
R->active_count = R->count;
for( p=R->data, last= p+R->count*R->wsize; p< last; p+=R->wsize) {
(p[0] |= ( 0x2000));
}
F->active_count = F->count;
for( c2under=F->data, c2index=0; c2index<F->count; c2under+=F->wsize, c2index++) {
if (c1index == c2index || (c2under[0] & ( 0x8000))) {
F->active_count--;
(c2under[0] &= ~ ( 0x2000));
} else {
(c2under[0] |= ( 0x2000));
}
}
(void) set_copy(RAISE, ((F)->data + (F)->wsize * ( c1index)));
(void) set_diff(FREESET, cube.fullset, RAISE);
essen_parts(R, F, RAISE, FREESET);
essen_raising(R, RAISE, FREESET);
for( c2under=F->data, c2index=0; c2index<F->count; c2under+=F->wsize, c2index++) {
if ((c2under[0] & ( 0x2000))) {
if (setp_implies(c2under, RAISE) ||
feasibly_covered(R, c2under, RAISE, temp)) {
F1 = sf_save(Foriginal);
(void) set_copy(((F1)->data + (F1)->wsize * ( c1index)), ((F)->data + (F)->wsize * ( c1index)));
FD = cube2list(F1, D);
c2essential = reduce_cube(FD, ((F1)->data + (F1)->wsize * ( c2index)));
((FD[0]) ? (free((char *) (FD[0])), (FD[0]) = 0) : 0); ((FD) ? (free((char *) (FD)), (FD) = 0) : 0);;
sf_free(F1);
if (feasibly_covered(R, c2essential, RAISE, temp)) {
(void) set_or(temp, RAISE, c2essential);
(temp[0] &= ~ ( 0x8000));	*G = sf_addset(*G, temp);
}
((c2essential) ? (free((char *) (c2essential)), (c2essential) = 0) : 0);
}
}
}
((RAISE) ? (free((char *) (RAISE)), (RAISE) = 0) : 0);
((FREESET) ? (free((char *) (FREESET)), (FREESET) = 0) : 0);
((temp) ? (free((char *) (temp)), (temp) = 0) : 0);
}