Skip to content

Instantly share code, notes, and snippets.

View ggutierrez's full-sized avatar

Gustavo Gutiérrez ggutierrez

  • Université catholique de Louvain
  • Louvain la neuve
View GitHub Profile
int main() {
return 0
}
@ggutierrez
ggutierrez / uniques.c
Last active August 29, 2015 14:09
Three implementations of unique abstraction
#include "unique.h"
#include <assert.h>
#include <cuddInt.h>
/*
This is a copy of the function with the same name at the end of
cuddBddAbs.c. the reason it is here is because that function is
not in the public interface.
*/
static int bddCheckPositiveCube(DdManager *manager, DdNode *cube) {
@ggutierrez
ggutierrez / unique.c
Last active August 29, 2015 14:09
Unique abstraction reference
/**
* @brief Unique abstraction implementation.
*
* This implementation includes some optimizations from Meolic's proposal.
* However, it does make the recursive calls before combining the results
* with the ITE operator.
*/
DdNode *uniqueAbstractRec(DdManager *home, DdNode *f, DdNode *cube) {
// satLine(home)
uniqueStats.recursiveCalls++;
@ggutierrez
ggutierrez / unique.c
Created November 14, 2014 03:51
Hybrid unique abstraction
DdNode* uniqueAbstractRec(DdManager* home, DdNode* f, DdNode* cube) {
// satLine(home)
uniqueStats.recursiveCalls++;
DdNode* one = Cudd_ReadOne(home);
DdNode* zero = Cudd_Not(one);
DdNode* F = Cudd_Regular(f);
if (cube == one) // Base case 1: Cube is exhausted
return f;
@ggutierrez
ggutierrez / uniqueAbstract.c
Created November 9, 2014 23:25
Unique abstraction implementation as close to cuddBddExistAbstractRecur as possible.
DdNode* uniqueAbstractSERec(DdManager* manager, DdNode* f, DdNode* cube) {
DdNode* F, *T, *E, *res, *res1, *res2, *EX, *TX, *one, *zero;
int topf, topc;
one = DD_ONE(manager);
zero = Cudd_Not(one);
F = Cudd_Regular(f);
if (cube == one) // Base case 1: Cube is exhausted
return f;
@ggutierrez
ggutierrez / cuddExistAbstract
Created November 8, 2014 16:56
Existential abstraction implementation in CUDD
/**Function********************************************************************
Synopsis [Performs the recursive steps of Cudd_bddExistAbstract.]
Description [Performs the recursive steps of Cudd_bddExistAbstract.
Returns the BDD obtained by abstracting the variables
of cube from f if successful; NULL otherwise. It is also used by
Cudd_bddUnivAbstract.]
SideEffects [None]
@ggutierrez
ggutierrez / unique.c
Created November 6, 2014 19:20
Unique abstraction in BDDs (C implementation)
DdNode* uniqueAbstractSERec(DdManager* home, DdNode* f, DdNode* cube) {
// Constants
DdNode* one = Cudd_ReadOne(home);
DdNode* zero = Cudd_Not(one);
if (cube == one) // Base case 1: Cube is exhausted
return f;
if (f == zero || f == one) // Base case 2: f is a terminal
return zero;
@ggutierrez
ggutierrez / unique.cpp
Created November 6, 2014 19:18
Unique abstraction in BDDs. (C++ implementation)
BDD uniqueAbstractImplSE(const Cudd& home, BDD f, BDD cube) {
BDD one = home.bddOne();
BDD zero = home.bddZero();
if (cube.IsOne())
return f;
if (f.IsZero() || f.IsOne())
return zero;
int topf = level(home, f);