Merge BuDDy 2.3.

* examples/calculator/, examples/internal/: Were renamed as ...
* examples/bddcalc/, examples/bddtest/: ... these.
* configure.ac: Adjust version and output Makefiles.
* examples/Makefile.am (SUBDIRS): Adjust subdir renaming.
* examples/cmilner/milner.c, examples/fdd/statespace.cxx: Were
renamed as ...
* examples/cmilner/cmilner.c, examples/fdd/fdd.cxx: ... these.
* examples/cmilner/Makefile.am, examples/fdd/Makefile.am: Adjust
accordingly.
* src/Makefile.am (AM_CPPFLAGS): Define VERSION.
This commit is contained in:
Alexandre Duret-Lutz 2004-07-06 17:39:37 +00:00
parent 9ce6888872
commit f1c3af808f
18 changed files with 0 additions and 6730 deletions

View file

@ -1,3 +0,0 @@
include ../Makefile.def
check_PROGRAMS = bddtest
bddtest_SOURCES = bddtest.cxx

View file

@ -1,145 +0,0 @@
#include <iomanip>
#include <stdlib.h>
#include <bdd.h>
#include <iostream>
using namespace std;
static const int varnum = 5;
/**************************************************************************
Example of allsat print handler.
**************************************************************************/
void allsatHandlerPrint(char* varset, int size)
{
for (int v=0; v<size ; ++v)
{
cout << (varset[v] < 0 ? 'X' : (char)('0' + varset[v]));
}
cout << endl;
}
/**************************************************************************
allsat handler for checking that all assignments are detected.
**************************************************************************/
static bdd allsatBDD;
static bdd allsatSumBDD;
void allsatHandler(char* varset, int size)
{
bdd x = bddtrue;
for (int v=0 ; v<size ; ++v)
if (varset[v] == 0)
x &= bdd_nithvar(v);
else if (varset[v] == 1)
x &= bdd_ithvar(v);
// Sum up all assignments
allsatSumBDD |= x;
// Remove assignment from initial set
allsatBDD -= x;
}
void test1_check(bdd x)
{
double anum = bdd_satcount(x);
cout << "Checking bdd with " << setw(4) << anum << " assignments: ";
allsatBDD = x;
allsatSumBDD = bddfalse;
// Calculate whole set of asignments and remove all assignments
// from original set
bdd_allsat(x, allsatHandler);
// Now the summed set should be equal to the original set
if (allsatSumBDD == x)
cout << " Sum-OK. ";
else
cout << " Sum-ERROR. ";
// The subtracted set should be empty
if (allsatBDD == bddfalse)
cout << "Sub-OK.\n";
else
cout << "Sub-ERROR.\n";
}
void test1()
{
bdd a = bdd_ithvar(0);
bdd b = bdd_ithvar(1);
bdd c = bdd_ithvar(2);
bdd d = bdd_ithvar(3);
bdd x;
x = bddtrue;
test1_check(x);
x = bddfalse;
test1_check(x);
x = a & b | !a & !b;
test1_check(x);
x = a & b | c & d;
test1_check(x);
x = a & !b | a & !d | a & b & !c;
test1_check(x);
int i;
for (i=0 ; i<varnum ; ++i)
{
test1_check(bdd_ithvar(i));
test1_check(bdd_nithvar(i));
}
bdd set = bddtrue;
for (i=0 ; i<50 ; ++i)
{
int v = rand() % varnum;
int s = rand() % 2;
int o = rand() % 2;
if (o == 0)
{
if (s == 0)
set &= bdd_ithvar(v);
else
set &= bdd_nithvar(v);
}
else
{
if (s == 0)
set |= bdd_ithvar(v);
else
set |= bdd_nithvar(v);
}
test1_check(set);
}
}
/**************************************************************************
Main
**************************************************************************/
int main()
{
bdd_init(1000,1000);
bdd_setvarnum(varnum);
test1();
bdd_done();
return 0;
}