00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00040 #ifndef _BDD_H
00041 #define _BDD_H
00042
00043
00044 #ifdef __cplusplus
00045 #define CPLUSPLUS
00046 #endif
00047
00048 #include <stdio.h>
00049
00050
00051
00052 #define bddop_and 0
00053 #define bddop_xor 1
00054 #define bddop_or 2
00055 #define bddop_nand 3
00056 #define bddop_nor 4
00057 #define bddop_imp 5
00058 #define bddop_biimp 6
00059 #define bddop_diff 7
00060 #define bddop_less 8
00061 #define bddop_invimp 9
00062
00063
00064 #define bddop_not 10
00065 #define bddop_simplify 11
00066
00067
00068
00069
00073 typedef int BDD;
00074
00075 #ifndef CPLUSPLUS
00076
00080 typedef BDD bdd;
00081 #endif
00082
00086 typedef struct s_bddPair
00087 {
00088 BDD *result;
00089 int last;
00090 int id;
00091 struct s_bddPair *next;
00092 } bddPair;
00093
00094
00095
00096
00104 typedef struct s_bddStat
00105 {
00106 long int produced;
00107 int nodenum;
00108 int maxnodenum;
00109 int freenodes;
00110 int minfreenodes;
00111 int varnum;
00112 int cachesize;
00113 int gbcnum;
00114 } bddStat;
00115
00116
00124 typedef struct s_bddGbcStat
00125 {
00126 int nodes;
00127 int freenodes;
00128 long time;
00129 long sumtime;
00130 int num;
00131 } bddGbcStat;
00132
00133
00141 typedef struct s_bddCacheStat
00142 {
00143 long unsigned int uniqueAccess;
00144 long unsigned int uniqueChain;
00145 long unsigned int uniqueHit;
00146 long unsigned int uniqueMiss;
00147 long unsigned int opHit;
00148 long unsigned int opMiss;
00149 long unsigned int swapCount;
00150 } bddCacheStat;
00151
00152
00153
00164 #define bdd_relprod(a,b,var) bdd_appex((a),(b),bddop_and,(var))
00165
00166
00167
00168
00169 #ifdef CPLUSPLUS
00170 extern "C" {
00171 #endif
00172
00176 typedef void (*bddinthandler)(int);
00180 typedef void (*bddgbchandler)(int,bddGbcStat*);
00184 typedef void (*bdd2inthandler)(int,int);
00188 typedef int (*bddsizehandler)(void);
00192 typedef void (*bddfilehandler)(FILE *, int);
00196 typedef void (*bddallsathandler)(char*, int);
00197
00198
00217 extern bddinthandler bdd_error_hook(bddinthandler handler);
00218
00219
00240 extern bddgbchandler bdd_gbc_hook(bddgbchandler handler);
00241
00242
00260 extern bdd2inthandler bdd_resize_hook(bdd2inthandler handler);
00261
00262
00285 extern bddinthandler bdd_reorder_hook(bddinthandler handler);
00286
00287
00315 extern bddfilehandler bdd_file_hook(bddfilehandler handler);
00316
00317
00335 extern int bdd_init(int nodesize, int cachesize);
00336
00337
00347 extern void bdd_done(void);
00348
00349
00361 extern int bdd_setvarnum(int num);
00362
00363
00373 extern int bdd_extvarnum(int num);
00374
00375
00385 extern int bdd_isrunning(void);
00386
00387
00402 extern int bdd_setmaxnodenum(int size);
00403
00404
00416 extern int bdd_setmaxincrease(int size);
00417
00418
00433 extern int bdd_setminfreenodes(int mf);
00434
00435
00446 extern int bdd_getnodenum(void);
00447
00448
00458 extern int bdd_getallocnum(void);
00459
00460
00469 extern char* bdd_versionstr(void);
00470
00471
00481 extern int bdd_versionnum(void);
00482
00483
00493 extern void bdd_stats(bddStat *stat);
00494
00495
00506 extern void bdd_cachestats(bddCacheStat *s);
00507
00508
00520 extern void bdd_fprintstat(FILE *f);
00521
00522
00534 extern void bdd_printstat(void);
00535
00536
00550 extern void bdd_default_gbchandler(int, bddGbcStat *);
00551
00552
00562 extern void bdd_default_errhandler(int e);
00563
00564
00575 extern const char *bdd_errstring(int);
00576
00577
00591 extern void bdd_clear_error(void);
00592
00593
00594 #ifndef CPLUSPLUS
00595
00596
00607 extern BDD bdd_true(void);
00608
00609
00620 extern BDD bdd_false(void);
00621
00622
00623 #endif
00624
00625
00635 extern int bdd_varnum(void);
00636
00637
00652 extern BDD bdd_ithvar(int var);
00653
00654
00667 extern BDD bdd_nithvar(int var);
00668
00669
00678 extern int bdd_var(BDD r);
00679
00680
00690 extern BDD bdd_low(BDD r);
00691
00692
00702 extern BDD bdd_high(BDD r);
00703
00704
00705 extern int bdd_varlevel(int);
00706
00707
00719 extern BDD bdd_addref(BDD r);
00720
00721
00733 extern BDD bdd_delref(BDD r);
00734
00744 extern void bdd_gbc(void);
00745
00746
00760 extern int bdd_scanset(BDD a, int **varset, int *varnum);
00761
00762
00776 extern BDD bdd_makeset(int *varset, int varnum);
00777
00778
00790 extern bddPair* bdd_newpair(void);
00791
00792
00804 extern int bdd_setpair(bddPair *pair, int oldvar, int newvar);
00805
00806
00817 extern int bdd_setpairs(bddPair *pair, int *oldvar, int *newvar, int size);
00818
00819
00833 extern int bdd_setbddpair(bddPair *pair, int oldvar, BDD newvar);
00834
00835
00846 extern int bdd_setbddpairs(bddPair *pair, int *olvar, BDD *newvar, int size);
00847
00848
00858 extern void bdd_resetpair(bddPair *p);
00859
00860
00869 extern void bdd_freepair(bddPair *p);
00870
00871
00872
00887 extern int bdd_setcacheratio(int r);
00888
00889
00907 extern BDD bdd_buildcube(int value, int width, BDD *var);
00908
00909
00927 extern BDD bdd_ibuildcube(int value, int width, int *var);
00928
00929
00939 extern BDD bdd_not(BDD r);
00940
00941
00966 extern BDD bdd_apply(BDD l, BDD r, int op);
00967
00968
00979 extern BDD bdd_and(BDD l, BDD r);
00980
00981
00991 extern BDD bdd_or(BDD l, BDD r);
00992
00993
01003 extern BDD bdd_xor(BDD l, BDD r);
01004
01005
01015 extern BDD bdd_imp(BDD l, BDD r);
01016
01017
01027 extern BDD bdd_biimp(BDD l, BDD r);
01028
01029
01042 extern BDD bdd_ite(BDD f, BDD g, BDD h);
01043
01044
01066 extern BDD bdd_restrict(BDD r, BDD var);
01067
01068
01078 extern BDD bdd_constrain(BDD f, BDD c);
01079
01080
01092 extern BDD bdd_replace(BDD r, bddPair *pair);
01093
01094
01104 extern BDD bdd_compose(BDD f, BDD g, BDD v);
01105
01106
01123 extern BDD bdd_veccompose(BDD g, bddPair *pair);
01124
01125
01137 extern BDD bdd_simplify(BDD f, BDD d);
01138
01139
01149 extern BDD bdd_exist(BDD r, BDD var);
01150
01151
01161 extern BDD bdd_forall(BDD r, BDD var);
01162
01163
01175 extern BDD bdd_unique(BDD, BDD);
01176
01177
01192 extern BDD bdd_appex(BDD l, BDD r, int opr, BDD var);
01193
01194
01208 extern BDD bdd_appall(BDD l, BDD r, int opr, BDD var);
01209
01210
01224 extern BDD bdd_appuni(BDD l, BDD r, int opr, BDD var);
01225
01226
01236 extern BDD bdd_support(BDD r);
01237
01238
01249 extern BDD bdd_satone(BDD r);
01250
01251
01264 extern BDD bdd_satoneset(BDD r, BDD var, BDD pol);
01265
01266
01277 extern BDD bdd_fullsatone(BDD r);
01278
01279
01306 extern void bdd_allsat(BDD r, bddallsathandler handler);
01307
01308
01319 extern double bdd_satcount(BDD r);
01320
01321
01333 extern double bdd_satcountset(BDD, BDD);
01334
01335
01348 extern double bdd_satcountln(BDD r);
01349
01350
01364 extern double bdd_satcountlnset(BDD r, BDD varset);
01365
01366
01376 extern int bdd_nodecount(BDD r);
01377
01378
01390 extern int bdd_anodecount(BDD *r, int num);
01391
01392
01404 extern int* bdd_varprofile(BDD r);
01405
01406
01416 extern double bdd_pathcount(BDD r);
01417
01418
01419
01420
01433 extern void bdd_printall(void);
01434
01435
01448 extern void bdd_fprintall(FILE *ofile);
01449
01450
01463 extern void bdd_fprinttable(FILE *ofile, BDD r);
01464
01465
01478 extern void bdd_printtable(BDD r);
01479
01480
01500 extern void bdd_fprintset(FILE *ofile, BDD r);
01501
01502
01522 extern void bdd_printset(BDD r);
01523
01524
01535 extern int bdd_fnprintdot(char *fname, BDD r);
01536
01537
01547 extern void bdd_fprintdot(FILE *ofile, BDD r);
01548
01549
01558 extern void bdd_printdot(BDD r);
01559
01560
01571 extern int bdd_fnsave(char *fname, BDD r);
01572
01573
01583 extern int bdd_save(FILE *ofile, BDD r);
01584
01585
01604 extern int bdd_fnload(char *fname, BDD *r);
01605
01606
01624 extern int bdd_load(FILE *ifile, BDD *r);
01625
01626
01627
01642 extern int bdd_swapvar(int v1, int v2);
01643
01644
01659 extern void bdd_default_reohandler(int prestate);
01660
01661
01692 extern void bdd_reorder(int method);
01693
01694
01705 extern int bdd_reorder_gain(void);
01706
01707
01729 extern bddsizehandler bdd_reorder_probe(bddsizehandler handler);
01730
01731
01740 extern void bdd_clrvarblocks(void);
01741
01742
01768 extern int bdd_addvarblock(BDD b, int fixed);
01769
01770
01796 extern int bdd_intaddvarblock(int first, int last, int fixed);
01797
01798
01810 extern void bdd_varblockall(void);
01811
01812
01835 extern bddfilehandler bdd_blockfile_hook(bddfilehandler handler);
01836
01837
01851 extern int bdd_autoreorder(int method);
01852
01853
01869 extern int bdd_autoreorder_times(int method, int num);
01870
01871
01880 extern int bdd_var2level(int var);
01881
01882
01891 extern int bdd_level2var(int level);
01892
01893
01903 extern int bdd_getreorder_times(void);
01904
01905
01914 extern int bdd_getreorder_method(void);
01915
01916
01925 extern void bdd_enable_reorder(void);
01926
01927
01937 extern void bdd_disable_reorder(void);
01938
01939
01952 extern int bdd_reorder_verbose(int value);
01953
01954
01967 extern void bdd_setvarorder(int *neworder);
01968
01969
01986 extern void bdd_printorder(void);
01987
01988
02005 extern void bdd_fprintorder(FILE *ofile);
02006
02007 #ifdef CPLUSPLUS
02008 }
02009 #endif
02010
02011
02012
02013
02014 #ifndef CPLUSPLUS
02015
02016
02025 extern const BDD bddfalse;
02026
02027
02036 extern const BDD bddtrue;
02037
02038 #endif
02039
02040
02041
02042
02043 #define BDD_REORDER_NONE 0
02044 #define BDD_REORDER_WIN2 1
02045 #define BDD_REORDER_WIN2ITE 2
02046 #define BDD_REORDER_SIFT 3
02047 #define BDD_REORDER_SIFTITE 4
02048 #define BDD_REORDER_WIN3 5
02049 #define BDD_REORDER_WIN3ITE 6
02050 #define BDD_REORDER_RANDOM 7
02051
02052 #define BDD_REORDER_FREE 0
02053 #define BDD_REORDER_FIXED 1
02054
02055
02056
02057
02058 #define BDD_MEMORY (-1)
02059 #define BDD_VAR (-2)
02060 #define BDD_RANGE (-3)
02061 #define BDD_DEREF (-4)
02062 #define BDD_RUNNING (-5)
02063 #define BDD_FILE (-6)
02064 #define BDD_FORMAT (-7)
02065 #define BDD_ORDER (-8)
02066 #define BDD_BREAK (-9)
02067 #define BDD_VARNUM (-10)
02068 #define BDD_NODES (-11)
02070 #define BDD_OP (-12)
02071 #define BDD_VARSET (-13)
02072 #define BDD_VARBLK (-14)
02073 #define BDD_DECVNUM (-15)
02074 #define BDD_REPLACE (-16)
02075 #define BDD_NODENUM (-17)
02076 #define BDD_ILLBDD (-18)
02077 #define BDD_SIZE (-19)
02079 #define BVEC_SIZE (-20)
02080 #define BVEC_SHIFT (-21)
02081 #define BVEC_DIVZERO (-22)
02083 #define BDD_ERRNUM 24
02084
02085
02086
02087
02088
02089 #ifdef CPLUSPLUS
02090 #include <iostream>
02091
02092
02093
02094 class bvec;
02095
02096 class bdd
02097 {
02098 public:
02099
02100 bdd(void) { root=0; }
02101 bdd(const bdd &r) { bdd_addref(root=r.root); }
02102 ~bdd(void) { bdd_delref(root); }
02103
02104 int id(void) const;
02105
02106 bdd operator=(const bdd &r);
02107
02108 bdd operator&(const bdd &r) const;
02109 bdd operator&=(const bdd &r);
02110 bdd operator^(const bdd &r) const;
02111 bdd operator^=(const bdd &r);
02112 bdd operator|(const bdd &r) const;
02113 bdd operator|=(const bdd &r);
02114 bdd operator!(void) const;
02115 bdd operator>>(const bdd &r) const;
02116 bdd operator>>=(const bdd &r);
02117 bdd operator-(const bdd &r) const;
02118 bdd operator-=(const bdd &r);
02119 bdd operator>(const bdd &r) const;
02120 bdd operator<(const bdd &r) const;
02121 bdd operator<<(const bdd &r) const;
02122 bdd operator<<=(const bdd &r);
02123 int operator==(const bdd &r) const;
02124 int operator!=(const bdd &r) const;
02125
02126 private:
02127 BDD root;
02128
02129 bdd(BDD r) { bdd_addref(root=r); }
02130 bdd operator=(BDD r);
02131
02132 friend int bdd_init(int, int);
02133 friend int bdd_setvarnum(int);
02134 friend bdd bdd_true(void);
02135 friend bdd bdd_false(void);
02136 friend bdd bdd_ithvarpp(int);
02137 friend bdd bdd_nithvarpp(int);
02138 friend int bdd_var(const bdd &);
02139 friend bdd bdd_low(const bdd &);
02140 friend bdd bdd_high(const bdd &);
02141 friend int bdd_scanset(const bdd &, int *&, int &);
02142 friend bdd bdd_makesetpp(int *, int);
02143 friend int bdd_setbddpair(bddPair*, int, const bdd &);
02144 friend int bdd_setbddpairs(bddPair*, int*, const bdd *, int);
02145 friend bdd bdd_buildcube(int, int, const bdd *);
02146 friend bdd bdd_ibuildcubepp(int, int, int *);
02147 friend bdd bdd_not(const bdd &);
02148 friend bdd bdd_simplify(const bdd &, const bdd &);
02149 friend bdd bdd_apply(const bdd &, const bdd &, int);
02150 friend bdd bdd_and(const bdd &, const bdd &);
02151 friend bdd bdd_or(const bdd &, const bdd &);
02152 friend bdd bdd_xor(const bdd &, const bdd &);
02153 friend bdd bdd_imp(const bdd &, const bdd &);
02154 friend bdd bdd_biimp(const bdd &, const bdd &);
02155 friend bdd bdd_ite(const bdd &, const bdd &, const bdd &);
02156 friend bdd bdd_restrict(const bdd &, const bdd &);
02157 friend bdd bdd_constrain(const bdd &, const bdd &);
02158 friend bdd bdd_exist(const bdd &, const bdd &);
02159 friend bdd bdd_forall(const bdd &, const bdd &);
02160 friend bdd bdd_unique(const bdd &, const bdd &);
02161 friend bdd bdd_appex(const bdd &, const bdd &, int, const bdd &);
02162 friend bdd bdd_appall(const bdd &, const bdd &, int, const bdd &);
02163 friend bdd bdd_appuni(const bdd &, const bdd &, int, const bdd &);
02164 friend bdd bdd_replace(const bdd &, bddPair*);
02165 friend bdd bdd_compose(const bdd &, const bdd &, int);
02166 friend bdd bdd_veccompose(const bdd &, bddPair*);
02167 friend bdd bdd_support(const bdd &);
02168 friend bdd bdd_satone(const bdd &);
02169 friend bdd bdd_satoneset(const bdd &, const bdd &, const bdd &);
02170 friend bdd bdd_fullsatone(const bdd &);
02171 friend void bdd_allsat(const bdd &r, bddallsathandler handler);
02172 friend double bdd_satcount(const bdd &);
02173 friend double bdd_satcountset(const bdd &, const bdd &);
02174 friend double bdd_satcountln(const bdd &);
02175 friend double bdd_satcountlnset(const bdd &, const bdd &);
02176 friend int bdd_nodecount(const bdd &);
02177 friend int bdd_anodecountpp(const bdd *, int);
02178 friend int* bdd_varprofile(const bdd &);
02179 friend double bdd_pathcount(const bdd &);
02180
02181 friend void bdd_fprinttable(FILE *, const bdd &);
02182 friend void bdd_printtable(const bdd &);
02183 friend void bdd_fprintset(FILE *, const bdd &);
02184 friend void bdd_printset(const bdd &);
02185 friend void bdd_printdot(const bdd &);
02186 friend int bdd_fnprintdot(char*, const bdd &);
02187 friend void bdd_fprintdot(FILE*, const bdd &);
02188 friend std::ostream &operator<<(std::ostream &, const bdd &);
02189 friend int bdd_fnsave(char*, const bdd &);
02190 friend int bdd_save(FILE*, const bdd &);
02191 friend int bdd_fnload(char*, bdd &);
02192 friend int bdd_load(FILE*, bdd &);
02193
02194 friend bdd fdd_ithvarpp(int, int);
02195 friend bdd fdd_ithsetpp(int);
02196 friend bdd fdd_domainpp(int);
02197 friend int fdd_scanvar(const bdd &, int);
02198 friend int* fdd_scanallvar(const bdd &);
02199 friend bdd fdd_equalspp(int, int);
02200 friend void fdd_printset(const bdd &);
02201 friend void fdd_fprintset(FILE*, const bdd &);
02202 friend bdd fdd_makesetpp(int*, int);
02203 friend int fdd_scanset(const bdd &, int *&, int &);
02204
02205 friend int bdd_addvarblock(const bdd &, int);
02206
02207 friend class bvec;
02208 friend bvec bvec_ite(const bdd& a, const bvec& b, const bvec& c);
02209 friend bvec bvec_shlfixed(const bvec &e, int pos, const bdd &c);
02210 friend bvec bvec_shl(const bvec &left, const bvec &right, const bdd &c);
02211 friend bvec bvec_shrfixed(const bvec &e, int pos, const bdd &c);
02212 friend bvec bvec_shr(const bvec &left, const bvec &right, const bdd &c);
02213 friend bdd bvec_lth(const bvec &left, const bvec &right);
02214 friend bdd bvec_lte(const bvec &left, const bvec &right);
02215 friend bdd bvec_gth(const bvec &left, const bvec &right);
02216 friend bdd bvec_gte(const bvec &left, const bvec &right);
02217 friend bdd bvec_equ(const bvec &left, const bvec &right);
02218 friend bdd bvec_neq(const bvec &left, const bvec &right);
02219 };
02220
02221
02222
02223
02224 extern const bdd bddfalsepp;
02225 extern const bdd bddtruepp;
02226
02227 #define bddtrue bddtruepp
02228 #define bddfalse bddfalsepp
02229
02230
02231
02232 extern int bdd_cpp_init(int, int);
02233
02234 inline void bdd_stats(bddStat& s)
02235 { bdd_stats(&s); }
02236
02237 inline bdd bdd_ithvarpp(int v)
02238 { return bdd_ithvar(v); }
02239
02240 inline bdd bdd_nithvarpp(int v)
02241 { return bdd_nithvar(v); }
02242
02243 inline int bdd_var(const bdd &r)
02244 { return bdd_var(r.root); }
02245
02246 inline bdd bdd_low(const bdd &r)
02247 { return bdd_low(r.root); }
02248
02249 inline bdd bdd_high(const bdd &r)
02250 { return bdd_high(r.root); }
02251
02252 inline int bdd_scanset(const bdd &r, int *&v, int &n)
02253 { return bdd_scanset(r.root, &v, &n); }
02254
02255 inline bdd bdd_makesetpp(int *v, int n)
02256 { return bdd(bdd_makeset(v,n)); }
02257
02258 inline int bdd_setbddpair(bddPair *p, int ov, const bdd &nv)
02259 { return bdd_setbddpair(p,ov,nv.root); }
02260
02261
02262
02263 inline bdd bdd_replace(const bdd &r, bddPair *p)
02264 { return bdd_replace(r.root, p); }
02265
02266 inline bdd bdd_compose(const bdd &f, const bdd &g, int v)
02267 { return bdd_compose(f.root, g.root, v); }
02268
02269 inline bdd bdd_veccompose(const bdd &f, bddPair *p)
02270 { return bdd_veccompose(f.root, p); }
02271
02272 inline bdd bdd_restrict(const bdd &r, const bdd &var)
02273 { return bdd_restrict(r.root, var.root); }
02274
02275 inline bdd bdd_constrain(const bdd &f, const bdd &c)
02276 { return bdd_constrain(f.root, c.root); }
02277
02278 inline bdd bdd_simplify(const bdd &d, const bdd &b)
02279 { return bdd_simplify(d.root, b.root); }
02280
02281 inline bdd bdd_ibuildcubepp(int v, int w, int *a)
02282 { return bdd_ibuildcube(v,w,a); }
02283
02284 inline bdd bdd_not(const bdd &r)
02285 { return bdd_not(r.root); }
02286
02287 inline bdd bdd_apply(const bdd &l, const bdd &r, int op)
02288 { return bdd_apply(l.root, r.root, op); }
02289
02290 inline bdd bdd_and(const bdd &l, const bdd &r)
02291 { return bdd_apply(l.root, r.root, bddop_and); }
02292
02293 inline bdd bdd_or(const bdd &l, const bdd &r)
02294 { return bdd_apply(l.root, r.root, bddop_or); }
02295
02296 inline bdd bdd_xor(const bdd &l, const bdd &r)
02297 { return bdd_apply(l.root, r.root, bddop_xor); }
02298
02299 inline bdd bdd_imp(const bdd &l, const bdd &r)
02300 { return bdd_apply(l.root, r.root, bddop_imp); }
02301
02302 inline bdd bdd_biimp(const bdd &l, const bdd &r)
02303 { return bdd_apply(l.root, r.root, bddop_biimp); }
02304
02305 inline bdd bdd_ite(const bdd &f, const bdd &g, const bdd &h)
02306 { return bdd_ite(f.root, g.root, h.root); }
02307
02308 inline bdd bdd_exist(const bdd &r, const bdd &var)
02309 { return bdd_exist(r.root, var.root); }
02310
02311 inline bdd bdd_forall(const bdd &r, const bdd &var)
02312 { return bdd_forall(r.root, var.root); }
02313
02314 inline bdd bdd_unique(const bdd &r, const bdd &var)
02315 { return bdd_unique(r.root, var.root); }
02316
02317 inline bdd bdd_appex(const bdd &l, const bdd &r, int op, const bdd &var)
02318 { return bdd_appex(l.root, r.root, op, var.root); }
02319
02320 inline bdd bdd_appall(const bdd &l, const bdd &r, int op, const bdd &var)
02321 { return bdd_appall(l.root, r.root, op, var.root); }
02322
02323 inline bdd bdd_appuni(const bdd &l, const bdd &r, int op, const bdd &var)
02324 { return bdd_appuni(l.root, r.root, op, var.root); }
02325
02326 inline bdd bdd_support(const bdd &r)
02327 { return bdd_support(r.root); }
02328
02329 inline bdd bdd_satone(const bdd &r)
02330 { return bdd_satone(r.root); }
02331
02332 inline bdd bdd_satoneset(const bdd &r, const bdd &var, const bdd &pol)
02333 { return bdd_satoneset(r.root, var.root, pol.root); }
02334
02335 inline bdd bdd_fullsatone(const bdd &r)
02336 { return bdd_fullsatone(r.root); }
02337
02338 inline void bdd_allsat(const bdd &r, bddallsathandler handler)
02339 { bdd_allsat(r.root, handler); }
02340
02341 inline double bdd_satcount(const bdd &r)
02342 { return bdd_satcount(r.root); }
02343
02344 inline double bdd_satcountset(const bdd &r, const bdd &varset)
02345 { return bdd_satcountset(r.root, varset.root); }
02346
02347 inline double bdd_satcountln(const bdd &r)
02348 { return bdd_satcountln(r.root); }
02349
02350 inline double bdd_satcountlnset(const bdd &r, const bdd &varset)
02351 { return bdd_satcountlnset(r.root, varset.root); }
02352
02353 inline int bdd_nodecount(const bdd &r)
02354 { return bdd_nodecount(r.root); }
02355
02356 inline int* bdd_varprofile(const bdd &r)
02357 { return bdd_varprofile(r.root); }
02358
02359 inline double bdd_pathcount(const bdd &r)
02360 { return bdd_pathcount(r.root); }
02361
02362
02363
02364
02365 inline void bdd_fprinttable(FILE *file, const bdd &r)
02366 { bdd_fprinttable(file, r.root); }
02367
02368 inline void bdd_printtable(const bdd &r)
02369 { bdd_printtable(r.root); }
02370
02371 inline void bdd_fprintset(FILE *file, const bdd &r)
02372 { bdd_fprintset(file, r.root); }
02373
02374 inline void bdd_printset(const bdd &r)
02375 { bdd_printset(r.root); }
02376
02377 inline void bdd_printdot(const bdd &r)
02378 { bdd_printdot(r.root); }
02379
02380 inline void bdd_fprintdot(FILE* ofile, const bdd &r)
02381 { bdd_fprintdot(ofile, r.root); }
02382
02383 inline int bdd_fnprintdot(char* fname, const bdd &r)
02384 { return bdd_fnprintdot(fname, r.root); }
02385
02386 inline int bdd_fnsave(char *fname, const bdd &r)
02387 { return bdd_fnsave(fname, r.root); }
02388
02389 inline int bdd_save(FILE *ofile, const bdd &r)
02390 { return bdd_save(ofile, r.root); }
02391
02392 inline int bdd_fnload(char *fname, bdd &r)
02393 { int lr,e; e=bdd_fnload(fname, &lr); r=bdd(lr); return e; }
02394
02395 inline int bdd_load(FILE *ifile, bdd &r)
02396 { int lr,e; e=bdd_load(ifile, &lr); r=bdd(lr); return e; }
02397
02398 inline int bdd_addvarblock(const bdd &v, int f)
02399 { return bdd_addvarblock(v.root, f); }
02400
02401
02402 #define bdd_init bdd_cpp_init
02403 #define bdd_ithvar bdd_ithvarpp
02404 #define bdd_nithvar bdd_nithvarpp
02405 #define bdd_makeset bdd_makesetpp
02406 #define bdd_ibuildcube bdd_ibuildcubepp
02407 #define bdd_anodecount bdd_anodecountpp
02408
02409
02410
02411 inline int bdd::id(void) const
02412 { return root; }
02413
02414 inline bdd bdd::operator&(const bdd &r) const
02415 { return bdd_apply(*this,r,bddop_and); }
02416
02417 inline bdd bdd::operator&=(const bdd &r)
02418 { return (*this=bdd_apply(*this,r,bddop_and)); }
02419
02420 inline bdd bdd::operator^(const bdd &r) const
02421 { return bdd_apply(*this,r,bddop_xor); }
02422
02423 inline bdd bdd::operator^=(const bdd &r)
02424 { return (*this=bdd_apply(*this,r,bddop_xor)); }
02425
02426 inline bdd bdd::operator|(const bdd &r) const
02427 { return bdd_apply(*this,r,bddop_or); }
02428
02429 inline bdd bdd::operator|=(const bdd &r)
02430 { return (*this=bdd_apply(*this,r,bddop_or)); }
02431
02432 inline bdd bdd::operator!(void) const
02433 { return bdd_not(*this);}
02434
02435 inline bdd bdd::operator>>(const bdd &r) const
02436 { return bdd_apply(*this,r,bddop_imp); }
02437
02438 inline bdd bdd::operator>>=(const bdd &r)
02439 { return (*this=bdd_apply(*this,r,bddop_imp)); }
02440
02441 inline bdd bdd::operator-(const bdd &r) const
02442 { return bdd_apply(*this,r,bddop_diff); }
02443
02444 inline bdd bdd::operator-=(const bdd &r)
02445 { return (*this=bdd_apply(*this,r,bddop_diff)); }
02446
02447 inline bdd bdd::operator>(const bdd &r) const
02448 { return bdd_apply(*this,r,bddop_diff); }
02449
02450 inline bdd bdd::operator<(const bdd &r) const
02451 { return bdd_apply(*this,r,bddop_less); }
02452
02453 inline bdd bdd::operator<<(const bdd &r) const
02454 { return bdd_apply(*this,r,bddop_invimp); }
02455
02456 inline bdd bdd::operator<<=(const bdd &r)
02457 { return (*this=bdd_apply(*this,r,bddop_invimp)); }
02458
02459 inline int bdd::operator==(const bdd &r) const
02460 { return r.root==root; }
02461
02462 inline int bdd::operator!=(const bdd &r) const
02463 { return r.root!=root; }
02464
02465 inline bdd bdd_true(void)
02466 { return 1; }
02467
02468 inline bdd bdd_false(void)
02469 { return 0; }
02470
02471
02472
02473
02474 class bdd_ioformat
02475 {
02476 public:
02477 bdd_ioformat(int f) { format=f; }
02478 private:
02479 bdd_ioformat(void) { }
02480 int format;
02481 static int curformat;
02482
02483 friend std::ostream &operator<<(std::ostream &, const bdd_ioformat &);
02484 friend std::ostream &operator<<(std::ostream &, const bdd &);
02485 };
02486
02487 std::ostream &operator<<(std::ostream &, const bdd &);
02488 std::ostream &operator<<(std::ostream &, const bdd_ioformat &);
02489
02490 extern bdd_ioformat bddset;
02491 extern bdd_ioformat bddtable;
02492 extern bdd_ioformat bdddot;
02493 extern bdd_ioformat bddall;
02494 extern bdd_ioformat fddset;
02495
02496 typedef void (*bddstrmhandler)(std::ostream &, int);
02497
02498 extern bddstrmhandler bdd_strm_hook(bddstrmhandler);
02499
02500 #endif
02501
02502 #endif
02503
02504