Exemplo n.º 1
0
/**
 * Returns the BDD corresponding to state e according to the projection of set.
 * Order: [0]<[1]<[n] and hi < lo
 */
static BDD
state_to_bdd(const int* e, size_t vec_length, BDDVAR* vec_to_bddvar, BDD projection)
{
    LACE_ME;

    check_state(e, vec_length);

    size_t varcount = vec_length * fddbits;
    char* cube = (char*)alloca(varcount*sizeof(char));
    memset(cube, 0, varcount*sizeof(char));

    size_t i;
    int j;
    for (i=0;i<vec_length;i++) {
        for (j=0;j<fddbits;j++) {
            if (e[i] & (1<<(fddbits-j-1))) cube[i*fddbits+j] = 1;
        }
    }

    // check if in right order
    for (i=0;i<varcount-1;i++) assert(vec_to_bddvar[i]<vec_to_bddvar[i+1]);

    BDDSET meta = sylvan_set_fromarray(vec_to_bddvar, varcount);
    BDD bdd = sylvan_ref(sylvan_cube(meta, cube));
    BDD proj = sylvan_ref(sylvan_exists(bdd, projection));
    sylvan_deref(bdd);

    return proj;
}
Exemplo n.º 2
0
/**
 * Calculate projection of src onto dst
 */
static void
set_project(vset_t dst,vset_t src)
{
    LACE_ME;

    sylvan_deref(dst->bdd);
    if (dst->projection != 0) dst->bdd = sylvan_exists(src->bdd, dst->projection);
    else dst->bdd = src->bdd;
    sylvan_ref(dst->bdd);
}
Exemplo n.º 3
0
JNIEXPORT jlong JNICALL
Java_jsylvan_JSylvan_makeExists(JNIEnv *env, jclass cl, jlong a, jlong b)
{
    LACE_ME;
    return sylvan_exists(a, b);
}