#include #include #include #include "bdd.h" #include using namespace std; int N; // Number of cyclers bdd normvar; // Current state variables bdd primvar; // Next state variables bddPair *renamepair; // Variable pairs for renaming /* Build a BDD expressing that all other variables than 'z' is unchanged. */ bdd A(bdd* x, bdd* y, int z) { bdd res = bddtrue; int i; for(i=0 ; icp[i]) & (tp[i]>t[i]) & hp[i] & A(c,cp,i) & A(t,tp,i) & A(h,hp,i)) | ((h[i]>hp[i]) & cp[(i+1)%N] & A(c,cp,(i+1)%N) & A(h,hp,i) & A(t,tp,N)); E = t[i] & !tp[i] & A(t,tp,i) & A(h,hp,N) & A(c,cp,N); T |= P | E; } return T; } /* Create a BDD for the initial state. */ bdd initial_state(bdd* t, bdd* h, bdd* c) { int i; bdd I = c[0] & !h[0] & !t[0]; for(i=1; i slow tmp = T & bx; tmp = bdd_exist(tmp, normvar); #else // Apply and exist as one operation => fast tmp = bdd_appex(R, T, bddop_and, normvar); #endif tmp = bdd_replace(tmp, renamepair); R |= tmp; } while(prevR != R); return R; } int main(int argc, char** argv) { using namespace std ; int n; if(argc < 2) { cerr << "usage: milner N\n"; cerr << " N number of cyclers\n"; exit(1); } N = atoi(argv[1]); if (N <= 0) { cerr << "The number of cyclers must be more than zero\n"; exit(2); } bdd_init(500000, 50000); bdd_setvarnum(N*6); bdd* c = new bdd[N]; bdd* cp = new bdd[N]; bdd* t = new bdd[N]; bdd* tp = new bdd[N]; bdd* h = new bdd[N]; bdd* hp = new bdd[N]; int *nvar = new int[N*3]; int *pvar = new int[N*3]; for (n=0 ; n