gecoder-with-gecode 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -0
- data/README +10 -1
- data/ext/extconf.rb +24 -7
- data/ext/gecode-2.1.1/LICENSE +25 -0
- data/ext/gecode-2.1.1/Makefile.contribs +86 -0
- data/ext/gecode-2.1.1/Makefile.dep +7622 -0
- data/ext/gecode-2.1.1/Makefile.in +1568 -0
- data/ext/gecode-2.1.1/changelog.in +2459 -0
- data/ext/gecode-2.1.1/configure +11631 -0
- data/ext/gecode-2.1.1/configure.ac +249 -0
- data/ext/gecode-2.1.1/configure.ac.in +245 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/contribs/README +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/Doxyfile +263 -0
- data/ext/gecode-2.1.1/contribs/qecode/FirstFailValueHeuristic.cc +82 -0
- data/ext/gecode-2.1.1/contribs/qecode/FirstFailValueHeuristic.hh +37 -0
- data/ext/gecode-2.1.1/contribs/qecode/Makefile.in.in +162 -0
- data/ext/gecode-2.1.1/contribs/qecode/NaiveValueHeuristics.cc +172 -0
- data/ext/gecode-2.1.1/contribs/qecode/NaiveValueHeuristics.hh +63 -0
- data/ext/gecode-2.1.1/contribs/qecode/SDFVariableHeuristic.cc +37 -0
- data/ext/gecode-2.1.1/contribs/qecode/SDFVariableHeuristic.hh +35 -0
- data/ext/gecode-2.1.1/contribs/qecode/configure +2264 -0
- data/ext/gecode-2.1.1/contribs/qecode/configure.ac +23 -0
- data/ext/gecode-2.1.1/contribs/qecode/examples/COMPILING +13 -0
- data/ext/gecode-2.1.1/contribs/qecode/examples/MatrixGame.cpp +144 -0
- data/ext/gecode-2.1.1/contribs/qecode/examples/NimFibo.cpp +73 -0
- data/ext/gecode-2.1.1/contribs/qecode/examples/stress_test.cpp +179 -0
- data/ext/gecode-2.1.1/contribs/qecode/extensivecomparator.cc +34 -0
- data/ext/gecode-2.1.1/contribs/qecode/extensivecomparator.hh +46 -0
- data/ext/gecode-2.1.1/contribs/qecode/heap.cc +151 -0
- data/ext/gecode-2.1.1/contribs/qecode/implicative.cc +595 -0
- data/ext/gecode-2.1.1/contribs/qecode/implicative.hh +184 -0
- data/ext/gecode-2.1.1/contribs/qecode/myDom.cc +39 -0
- data/ext/gecode-2.1.1/contribs/qecode/myspace.cc +69 -0
- data/ext/gecode-2.1.1/contribs/qecode/myspace.hh +69 -0
- data/ext/gecode-2.1.1/contribs/qecode/qecode.hh +56 -0
- data/ext/gecode-2.1.1/contribs/qecode/qecore.cc +145 -0
- data/ext/gecode-2.1.1/contribs/qecode/qecore.hh +247 -0
- data/ext/gecode-2.1.1/contribs/qecode/qsolver.cc +168 -0
- data/ext/gecode-2.1.1/contribs/qecode/qsolver.hh +73 -0
- data/ext/gecode-2.1.1/contribs/qecode/shortdesc.ac +1 -0
- data/ext/gecode-2.1.1/contribs/qecode/valueHeuristic.hh +91 -0
- data/ext/gecode-2.1.1/contribs/qecode/vartype.hh +31 -0
- data/ext/gecode-2.1.1/contribs/qecode/warner.cc +101 -0
- data/ext/gecode-2.1.1/contribs/qecode/warner.hh +83 -0
- data/ext/gecode-2.1.1/doxygen/doxygen.conf.in +1270 -0
- data/ext/gecode-2.1.1/doxygen/doxygen.hh.in +1111 -0
- data/ext/gecode-2.1.1/doxygen/reflection.hh +417 -0
- data/ext/gecode-2.1.1/gecode.m4 +956 -0
- data/ext/gecode-2.1.1/gecode/cpltset.hh +797 -0
- data/ext/gecode-2.1.1/gecode/cpltset/array.cc +121 -0
- data/ext/gecode-2.1.1/gecode/cpltset/array.icc +81 -0
- data/ext/gecode-2.1.1/gecode/cpltset/bddmanager.cc +59 -0
- data/ext/gecode-2.1.1/gecode/cpltset/bddmanager.icc +448 -0
- data/ext/gecode-2.1.1/gecode/cpltset/branch.cc +68 -0
- data/ext/gecode-2.1.1/gecode/cpltset/branch.hh +208 -0
- data/ext/gecode-2.1.1/gecode/cpltset/branch/select-val.icc +167 -0
- data/ext/gecode-2.1.1/gecode/cpltset/branch/select-view.icc +143 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/atmost.cc +472 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/cardinality.cc +69 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/distinct.cc +83 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/dom.cc +147 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/partition.cc +383 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/rangeroots.cc +466 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/rel.cc +530 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/select.cc +126 -0
- data/ext/gecode-2.1.1/gecode/cpltset/constraints/singleton.cc +55 -0
- data/ext/gecode-2.1.1/gecode/cpltset/exception.icc +172 -0
- data/ext/gecode-2.1.1/gecode/cpltset/propagators.hh +335 -0
- data/ext/gecode-2.1.1/gecode/cpltset/propagators/binary.icc +260 -0
- data/ext/gecode-2.1.1/gecode/cpltset/propagators/nary.icc +210 -0
- data/ext/gecode-2.1.1/gecode/cpltset/propagators/naryone.icc +165 -0
- data/ext/gecode-2.1.1/gecode/cpltset/propagators/narytwo.icc +191 -0
- data/ext/gecode-2.1.1/gecode/cpltset/propagators/singleton.icc +130 -0
- data/ext/gecode-2.1.1/gecode/cpltset/propagators/unary.icc +132 -0
- data/ext/gecode-2.1.1/gecode/cpltset/support.cc +673 -0
- data/ext/gecode-2.1.1/gecode/cpltset/support.icc +696 -0
- data/ext/gecode-2.1.1/gecode/cpltset/var-imp.icc +487 -0
- data/ext/gecode-2.1.1/gecode/cpltset/var-imp/cpltset.cc +926 -0
- data/ext/gecode-2.1.1/gecode/cpltset/var-imp/cpltset.icc +687 -0
- data/ext/gecode-2.1.1/gecode/cpltset/var-imp/cpltset.vis +86 -0
- data/ext/gecode-2.1.1/gecode/cpltset/var/cpltset.cc +101 -0
- data/ext/gecode-2.1.1/gecode/cpltset/var/cpltset.icc +219 -0
- data/ext/gecode-2.1.1/gecode/cpltset/view.icc +231 -0
- data/ext/gecode-2.1.1/gecode/cpltset/view/cpltset.icc +420 -0
- data/ext/gecode-2.1.1/gecode/cpltset/view/print.cc +166 -0
- data/ext/gecode-2.1.1/gecode/gist.hh +162 -0
- data/ext/gecode-2.1.1/gecode/gist/addchild.cc +191 -0
- data/ext/gecode-2.1.1/gecode/gist/addchild.hh +76 -0
- data/ext/gecode-2.1.1/gecode/gist/addvisualisationdialog.cc +139 -0
- data/ext/gecode-2.1.1/gecode/gist/addvisualisationdialog.hh +78 -0
- data/ext/gecode-2.1.1/gecode/gist/analysiscursor.cc +115 -0
- data/ext/gecode-2.1.1/gecode/gist/analysiscursor.hh +77 -0
- data/ext/gecode-2.1.1/gecode/gist/better.hh +59 -0
- data/ext/gecode-2.1.1/gecode/gist/config.cc +61 -0
- data/ext/gecode-2.1.1/gecode/gist/config.hh +62 -0
- data/ext/gecode-2.1.1/gecode/gist/drawingcursor.cc +245 -0
- data/ext/gecode-2.1.1/gecode/gist/drawingcursor.hh +101 -0
- data/ext/gecode-2.1.1/gecode/gist/gecodelogo.icc +522 -0
- data/ext/gecode-2.1.1/gecode/gist/gist.cc +129 -0
- data/ext/gecode-2.1.1/gecode/gist/gist.icc +76 -0
- data/ext/gecode-2.1.1/gecode/gist/mainwindow.cc +254 -0
- data/ext/gecode-2.1.1/gecode/gist/mainwindow.hh +86 -0
- data/ext/gecode-2.1.1/gecode/gist/node.cc +100 -0
- data/ext/gecode-2.1.1/gecode/gist/node.hh +89 -0
- data/ext/gecode-2.1.1/gecode/gist/nodecursor.cc +124 -0
- data/ext/gecode-2.1.1/gecode/gist/nodecursor.hh +122 -0
- data/ext/gecode-2.1.1/gecode/gist/nodecursor.icc +79 -0
- data/ext/gecode-2.1.1/gecode/gist/nodevisitor.hh +91 -0
- data/ext/gecode-2.1.1/gecode/gist/nodevisitor.icc +112 -0
- data/ext/gecode-2.1.1/gecode/gist/postscript.cc +543 -0
- data/ext/gecode-2.1.1/gecode/gist/postscript.hh +56 -0
- data/ext/gecode-2.1.1/gecode/gist/preferences.cc +110 -0
- data/ext/gecode-2.1.1/gecode/gist/preferences.hh +76 -0
- data/ext/gecode-2.1.1/gecode/gist/reflectionhelpers.cc +55 -0
- data/ext/gecode-2.1.1/gecode/gist/reflectionhelpers.hh +58 -0
- data/ext/gecode-2.1.1/gecode/gist/shapelist.cc +331 -0
- data/ext/gecode-2.1.1/gecode/gist/shapelist.hh +140 -0
- data/ext/gecode-2.1.1/gecode/gist/spacenode.cc +531 -0
- data/ext/gecode-2.1.1/gecode/gist/spacenode.hh +224 -0
- data/ext/gecode-2.1.1/gecode/gist/test.cc +78 -0
- data/ext/gecode-2.1.1/gecode/gist/textoutput.cc +114 -0
- data/ext/gecode-2.1.1/gecode/gist/textoutput.hh +67 -0
- data/ext/gecode-2.1.1/gecode/gist/treecanvas.cc +1140 -0
- data/ext/gecode-2.1.1/gecode/gist/treecanvas.hh +324 -0
- data/ext/gecode-2.1.1/gecode/gist/ui_addchild.hh +163 -0
- data/ext/gecode-2.1.1/gecode/gist/ui_addvisualisationdialog.hh +163 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/intvaritem.cc +175 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/intvaritem.hh +71 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/setvaritem.cc +219 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/setvaritem.hh +73 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/vararrayitem.hh +123 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/vararrayview.cc +146 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/vararrayview.hh +96 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/vararrayviewt.hh +105 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/varitem.cc +68 -0
- data/ext/gecode-2.1.1/gecode/gist/visualisation/varitem.hh +67 -0
- data/ext/gecode-2.1.1/gecode/gist/visualnode.cc +303 -0
- data/ext/gecode-2.1.1/gecode/gist/visualnode.hh +166 -0
- data/ext/gecode-2.1.1/gecode/int.hh +2035 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic.cc +136 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic.hh +440 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/abs.icc +279 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/max.icc +253 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/mult.icc +522 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/sqr.icc +218 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/sqrt.icc +138 -0
- data/ext/gecode-2.1.1/gecode/int/array.cc +74 -0
- data/ext/gecode-2.1.1/gecode/int/array.icc +115 -0
- data/ext/gecode-2.1.1/gecode/int/bool.cc +642 -0
- data/ext/gecode-2.1.1/gecode/int/bool.hh +487 -0
- data/ext/gecode-2.1.1/gecode/int/bool/base.icc +156 -0
- data/ext/gecode-2.1.1/gecode/int/bool/eq.icc +239 -0
- data/ext/gecode-2.1.1/gecode/int/bool/eqv.icc +179 -0
- data/ext/gecode-2.1.1/gecode/int/bool/lq.icc +147 -0
- data/ext/gecode-2.1.1/gecode/int/bool/or.icc +1000 -0
- data/ext/gecode-2.1.1/gecode/int/branch.cc +301 -0
- data/ext/gecode-2.1.1/gecode/int/branch.hh +576 -0
- data/ext/gecode-2.1.1/gecode/int/branch/select-val.icc +338 -0
- data/ext/gecode-2.1.1/gecode/int/branch/select-view.icc +421 -0
- data/ext/gecode-2.1.1/gecode/int/channel.cc +114 -0
- data/ext/gecode-2.1.1/gecode/int/channel.hh +259 -0
- data/ext/gecode-2.1.1/gecode/int/channel/base.icc +86 -0
- data/ext/gecode-2.1.1/gecode/int/channel/dom.icc +347 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-multi.cc +231 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-multi.icc +70 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-single.cc +97 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-single.icc +71 -0
- data/ext/gecode-2.1.1/gecode/int/channel/val.icc +276 -0
- data/ext/gecode-2.1.1/gecode/int/circuit.cc +63 -0
- data/ext/gecode-2.1.1/gecode/int/circuit.hh +175 -0
- data/ext/gecode-2.1.1/gecode/int/circuit/base.icc +271 -0
- data/ext/gecode-2.1.1/gecode/int/circuit/dom.icc +146 -0
- data/ext/gecode-2.1.1/gecode/int/circuit/val.icc +122 -0
- data/ext/gecode-2.1.1/gecode/int/count.cc +310 -0
- data/ext/gecode-2.1.1/gecode/int/count.hh +487 -0
- data/ext/gecode-2.1.1/gecode/int/count/int.icc +619 -0
- data/ext/gecode-2.1.1/gecode/int/count/rel.icc +144 -0
- data/ext/gecode-2.1.1/gecode/int/count/view.icc +449 -0
- data/ext/gecode-2.1.1/gecode/int/cumulatives.cc +226 -0
- data/ext/gecode-2.1.1/gecode/int/cumulatives.hh +141 -0
- data/ext/gecode-2.1.1/gecode/int/cumulatives/val.icc +429 -0
- data/ext/gecode-2.1.1/gecode/int/distinct.cc +108 -0
- data/ext/gecode-2.1.1/gecode/int/distinct.hh +341 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/bilink.icc +89 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/bnd.icc +378 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/combptr.icc +78 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/dom.icc +750 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/edge.icc +118 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/node.icc +147 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/ter-dom.icc +136 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/val.icc +209 -0
- data/ext/gecode-2.1.1/gecode/int/dom.cc +116 -0
- data/ext/gecode-2.1.1/gecode/int/dom.hh +134 -0
- data/ext/gecode-2.1.1/gecode/int/dom/range.icc +129 -0
- data/ext/gecode-2.1.1/gecode/int/dom/spec.icc +151 -0
- data/ext/gecode-2.1.1/gecode/int/element.cc +156 -0
- data/ext/gecode-2.1.1/gecode/int/element.hh +239 -0
- data/ext/gecode-2.1.1/gecode/int/element/int.icc +441 -0
- data/ext/gecode-2.1.1/gecode/int/element/view.icc +584 -0
- data/ext/gecode-2.1.1/gecode/int/exception.icc +163 -0
- data/ext/gecode-2.1.1/gecode/int/extensional.cc +138 -0
- data/ext/gecode-2.1.1/gecode/int/extensional.hh +415 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/base.icc +160 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/basic.icc +166 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/bitset.icc +113 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/dfa.cc +565 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/dfa.icc +241 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/incremental.icc +393 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/layered-graph.icc +604 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/tuple-set.cc +311 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/tuple-set.icc +207 -0
- data/ext/gecode-2.1.1/gecode/int/gcc.cc +374 -0
- data/ext/gecode-2.1.1/gecode/int/gcc.hh +329 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/bnd.icc +660 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/dom.icc +531 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/gccbndsup.icc +780 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/graphsup.icc +2422 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/lbc.icc +391 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/occur.icc +829 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/ubc.icc +255 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/val.icc +400 -0
- data/ext/gecode-2.1.1/gecode/int/int-set.cc +153 -0
- data/ext/gecode-2.1.1/gecode/int/int-set.icc +191 -0
- data/ext/gecode-2.1.1/gecode/int/limits.icc +54 -0
- data/ext/gecode-2.1.1/gecode/int/linear-bool.cc +220 -0
- data/ext/gecode-2.1.1/gecode/int/linear-int.cc +240 -0
- data/ext/gecode-2.1.1/gecode/int/linear.hh +1849 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-int.icc +791 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-post.cc +433 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-scale.icc +854 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-view.icc +399 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-bin.icc +605 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-dom.icc +539 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-nary.icc +1004 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-noview.icc +385 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-post.cc +493 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-ter.icc +357 -0
- data/ext/gecode-2.1.1/gecode/int/linear/post.icc +146 -0
- data/ext/gecode-2.1.1/gecode/int/propagator.icc +240 -0
- data/ext/gecode-2.1.1/gecode/int/rel.cc +431 -0
- data/ext/gecode-2.1.1/gecode/int/rel.hh +657 -0
- data/ext/gecode-2.1.1/gecode/int/rel/eq.icc +848 -0
- data/ext/gecode-2.1.1/gecode/int/rel/lex.icc +248 -0
- data/ext/gecode-2.1.1/gecode/int/rel/lq-le.icc +352 -0
- data/ext/gecode-2.1.1/gecode/int/rel/nq.icc +269 -0
- data/ext/gecode-2.1.1/gecode/int/sorted.cc +91 -0
- data/ext/gecode-2.1.1/gecode/int/sorted.hh +117 -0
- data/ext/gecode-2.1.1/gecode/int/sorted/matching.icc +182 -0
- data/ext/gecode-2.1.1/gecode/int/sorted/narrowing.icc +257 -0
- data/ext/gecode-2.1.1/gecode/int/sorted/order.icc +208 -0
- data/ext/gecode-2.1.1/gecode/int/sorted/propagate.icc +669 -0
- data/ext/gecode-2.1.1/gecode/int/sorted/sortsup.icc +596 -0
- data/ext/gecode-2.1.1/gecode/int/unshare.cc +148 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp.icc +745 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/bool.cc +104 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/bool.icc +423 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/bool.vis +69 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/delta.icc +64 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/int.cc +407 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/int.icc +1004 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/int.vis +195 -0
- data/ext/gecode-2.1.1/gecode/int/var/bool.cc +72 -0
- data/ext/gecode-2.1.1/gecode/int/var/bool.icc +126 -0
- data/ext/gecode-2.1.1/gecode/int/var/int.cc +79 -0
- data/ext/gecode-2.1.1/gecode/int/var/int.icc +151 -0
- data/ext/gecode-2.1.1/gecode/int/view.icc +1894 -0
- data/ext/gecode-2.1.1/gecode/int/view/bool.icc +598 -0
- data/ext/gecode-2.1.1/gecode/int/view/constint.icc +392 -0
- data/ext/gecode-2.1.1/gecode/int/view/int.icc +301 -0
- data/ext/gecode-2.1.1/gecode/int/view/iter.icc +65 -0
- data/ext/gecode-2.1.1/gecode/int/view/minus.icc +372 -0
- data/ext/gecode-2.1.1/gecode/int/view/offset.icc +362 -0
- data/ext/gecode-2.1.1/gecode/int/view/print.cc +133 -0
- data/ext/gecode-2.1.1/gecode/int/view/rtest.icc +231 -0
- data/ext/gecode-2.1.1/gecode/int/view/scale.icc +456 -0
- data/ext/gecode-2.1.1/gecode/int/view/zero.icc +384 -0
- data/ext/gecode-2.1.1/gecode/iter.hh +90 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-add.icc +144 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-append.icc +222 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-array.icc +138 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-cache.icc +337 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-compl.icc +220 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-diff.icc +142 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-empty.icc +111 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-inter.icc +216 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-minmax.icc +118 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-minus.icc +150 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-offset.icc +127 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-operations.icc +157 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-scale.icc +238 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-singleton-append.icc +111 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-singleton.icc +86 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-size.icc +146 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-union.icc +224 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-values.icc +140 -0
- data/ext/gecode-2.1.1/gecode/iter/values-array.icc +119 -0
- data/ext/gecode-2.1.1/gecode/iter/values-minus.icc +130 -0
- data/ext/gecode-2.1.1/gecode/iter/values-offset.icc +113 -0
- data/ext/gecode-2.1.1/gecode/iter/values-ranges.icc +106 -0
- data/ext/gecode-2.1.1/gecode/iter/values-singleton.icc +109 -0
- data/ext/gecode-2.1.1/gecode/iter/values-unique.icc +118 -0
- data/ext/gecode-2.1.1/gecode/iter/virtual-ranges-compl.icc +261 -0
- data/ext/gecode-2.1.1/gecode/iter/virtual-ranges-inter.icc +241 -0
- data/ext/gecode-2.1.1/gecode/iter/virtual-ranges-union.icc +249 -0
- data/ext/gecode-2.1.1/gecode/iter/virtual-ranges.icc +140 -0
- data/ext/gecode-2.1.1/gecode/kernel.hh +182 -0
- data/ext/gecode-2.1.1/gecode/kernel/advisor.icc +104 -0
- data/ext/gecode-2.1.1/gecode/kernel/array.icc +1232 -0
- data/ext/gecode-2.1.1/gecode/kernel/branching.icc +447 -0
- data/ext/gecode-2.1.1/gecode/kernel/core.cc +473 -0
- data/ext/gecode-2.1.1/gecode/kernel/core.icc +2295 -0
- data/ext/gecode-2.1.1/gecode/kernel/exception.icc +101 -0
- data/ext/gecode-2.1.1/gecode/kernel/macros.icc +117 -0
- data/ext/gecode-2.1.1/gecode/kernel/memory-manager.cc +57 -0
- data/ext/gecode-2.1.1/gecode/kernel/memory-manager.icc +458 -0
- data/ext/gecode-2.1.1/gecode/kernel/modevent.icc +69 -0
- data/ext/gecode-2.1.1/gecode/kernel/propagator.icc +845 -0
- data/ext/gecode-2.1.1/gecode/kernel/reflection.cc +921 -0
- data/ext/gecode-2.1.1/gecode/kernel/reflection.icc +1012 -0
- data/ext/gecode-2.1.1/gecode/kernel/shared-array.icc +286 -0
- data/ext/gecode-2.1.1/gecode/kernel/var-imp.icc +433 -0
- data/ext/gecode-2.1.1/gecode/kernel/var-map.cc +269 -0
- data/ext/gecode-2.1.1/gecode/kernel/var-map.icc +227 -0
- data/ext/gecode-2.1.1/gecode/kernel/var-traits.icc +72 -0
- data/ext/gecode-2.1.1/gecode/kernel/var-type.cc +68 -0
- data/ext/gecode-2.1.1/gecode/kernel/var-type.icc +915 -0
- data/ext/gecode-2.1.1/gecode/kernel/var.icc +120 -0
- data/ext/gecode-2.1.1/gecode/kernel/view.icc +611 -0
- data/ext/gecode-2.1.1/gecode/minimodel.hh +1165 -0
- data/ext/gecode-2.1.1/gecode/minimodel/arithmetic.cc +179 -0
- data/ext/gecode-2.1.1/gecode/minimodel/bool-expr.cc +327 -0
- data/ext/gecode-2.1.1/gecode/minimodel/bool-expr.icc +131 -0
- data/ext/gecode-2.1.1/gecode/minimodel/bool-rel.icc +83 -0
- data/ext/gecode-2.1.1/gecode/minimodel/exception.icc +84 -0
- data/ext/gecode-2.1.1/gecode/minimodel/lin-expr.icc +374 -0
- data/ext/gecode-2.1.1/gecode/minimodel/lin-rel.icc +324 -0
- data/ext/gecode-2.1.1/gecode/minimodel/matrix.icc +144 -0
- data/ext/gecode-2.1.1/gecode/minimodel/reg.cc +823 -0
- data/ext/gecode-2.1.1/gecode/search.hh +752 -0
- data/ext/gecode-2.1.1/gecode/search/bab.cc +169 -0
- data/ext/gecode-2.1.1/gecode/search/bab.icc +117 -0
- data/ext/gecode-2.1.1/gecode/search/dfs.cc +79 -0
- data/ext/gecode-2.1.1/gecode/search/dfs.icc +169 -0
- data/ext/gecode-2.1.1/gecode/search/engine-ctrl.icc +131 -0
- data/ext/gecode-2.1.1/gecode/search/lds.cc +265 -0
- data/ext/gecode-2.1.1/gecode/search/lds.icc +73 -0
- data/ext/gecode-2.1.1/gecode/search/options.cc +46 -0
- data/ext/gecode-2.1.1/gecode/search/options.icc +46 -0
- data/ext/gecode-2.1.1/gecode/search/reco-stack.icc +237 -0
- data/ext/gecode-2.1.1/gecode/search/restart.icc +99 -0
- data/ext/gecode-2.1.1/gecode/search/statistics.icc +46 -0
- data/ext/gecode-2.1.1/gecode/search/stop.cc +74 -0
- data/ext/gecode-2.1.1/gecode/search/stop.icc +116 -0
- data/ext/gecode-2.1.1/gecode/serialization.hh +149 -0
- data/ext/gecode-2.1.1/gecode/serialization/boost.cc +78 -0
- data/ext/gecode-2.1.1/gecode/serialization/boost.icc +381 -0
- data/ext/gecode-2.1.1/gecode/serialization/flatzinc.cc +372 -0
- data/ext/gecode-2.1.1/gecode/serialization/javascript.cc +340 -0
- data/ext/gecode-2.1.1/gecode/serialization/javascript.hh +69 -0
- data/ext/gecode-2.1.1/gecode/serialization/register.cc +8142 -0
- data/ext/gecode-2.1.1/gecode/set.hh +970 -0
- data/ext/gecode-2.1.1/gecode/set/array.cc +114 -0
- data/ext/gecode-2.1.1/gecode/set/array.icc +77 -0
- data/ext/gecode-2.1.1/gecode/set/branch.cc +78 -0
- data/ext/gecode-2.1.1/gecode/set/branch.hh +213 -0
- data/ext/gecode-2.1.1/gecode/set/branch/select-val.icc +132 -0
- data/ext/gecode-2.1.1/gecode/set/branch/select-view.icc +148 -0
- data/ext/gecode-2.1.1/gecode/set/cardinality.cc +65 -0
- data/ext/gecode-2.1.1/gecode/set/convex.cc +59 -0
- data/ext/gecode-2.1.1/gecode/set/convex.hh +126 -0
- data/ext/gecode-2.1.1/gecode/set/convex/conv.cc +118 -0
- data/ext/gecode-2.1.1/gecode/set/convex/conv.icc +67 -0
- data/ext/gecode-2.1.1/gecode/set/convex/hull.cc +140 -0
- data/ext/gecode-2.1.1/gecode/set/convex/hull.icc +68 -0
- data/ext/gecode-2.1.1/gecode/set/distinct.cc +56 -0
- data/ext/gecode-2.1.1/gecode/set/distinct.hh +90 -0
- data/ext/gecode-2.1.1/gecode/set/distinct/atmostOne.cc +192 -0
- data/ext/gecode-2.1.1/gecode/set/distinct/atmostOne.icc +66 -0
- data/ext/gecode-2.1.1/gecode/set/dom.cc +232 -0
- data/ext/gecode-2.1.1/gecode/set/exception.icc +135 -0
- data/ext/gecode-2.1.1/gecode/set/int.cc +177 -0
- data/ext/gecode-2.1.1/gecode/set/int.hh +391 -0
- data/ext/gecode-2.1.1/gecode/set/int/card.icc +116 -0
- data/ext/gecode-2.1.1/gecode/set/int/channel-bool.icc +303 -0
- data/ext/gecode-2.1.1/gecode/set/int/channel-int.icc +174 -0
- data/ext/gecode-2.1.1/gecode/set/int/match.icc +224 -0
- data/ext/gecode-2.1.1/gecode/set/int/minmax.icc +228 -0
- data/ext/gecode-2.1.1/gecode/set/int/weights.icc +370 -0
- data/ext/gecode-2.1.1/gecode/set/limits.icc +62 -0
- data/ext/gecode-2.1.1/gecode/set/projectors-compiler.hh +164 -0
- data/ext/gecode-2.1.1/gecode/set/projectors.cc +143 -0
- data/ext/gecode-2.1.1/gecode/set/projectors.hh +438 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/compiler.cc +859 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/formula.cc +312 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/formula.icc +66 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/projector-set.cc +91 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/projector-set.icc +85 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/projector.cc +147 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/projector.icc +98 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/propagator.hh +168 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/propagator/card.icc +128 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/propagator/nary.icc +144 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/propagator/re-nary.cc +100 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/propagator/re-nary.icc +71 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/set-expr.cc +339 -0
- data/ext/gecode-2.1.1/gecode/set/projectors/set-expr.icc +237 -0
- data/ext/gecode-2.1.1/gecode/set/propagator.icc +125 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op-const.cc +332 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op.cc +197 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op.hh +353 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op/common.icc +557 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op/inter.icc +409 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op/partition.icc +202 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op/post.icc +223 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op/subofunion.icc +192 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op/superofinter.icc +193 -0
- data/ext/gecode-2.1.1/gecode/set/rel-op/union.icc +383 -0
- data/ext/gecode-2.1.1/gecode/set/rel.cc +258 -0
- data/ext/gecode-2.1.1/gecode/set/rel.hh +321 -0
- data/ext/gecode-2.1.1/gecode/set/rel/common.icc +125 -0
- data/ext/gecode-2.1.1/gecode/set/rel/eq.icc +139 -0
- data/ext/gecode-2.1.1/gecode/set/rel/nosubset.icc +128 -0
- data/ext/gecode-2.1.1/gecode/set/rel/nq.icc +208 -0
- data/ext/gecode-2.1.1/gecode/set/rel/re-eq.icc +179 -0
- data/ext/gecode-2.1.1/gecode/set/rel/re-subset.icc +172 -0
- data/ext/gecode-2.1.1/gecode/set/rel/subset.icc +119 -0
- data/ext/gecode-2.1.1/gecode/set/select.cc +135 -0
- data/ext/gecode-2.1.1/gecode/set/select.hh +233 -0
- data/ext/gecode-2.1.1/gecode/set/select/disjoint.cc +308 -0
- data/ext/gecode-2.1.1/gecode/set/select/disjoint.icc +75 -0
- data/ext/gecode-2.1.1/gecode/set/select/idxarray.hh +113 -0
- data/ext/gecode-2.1.1/gecode/set/select/idxarray.icc +155 -0
- data/ext/gecode-2.1.1/gecode/set/select/inter.icc +349 -0
- data/ext/gecode-2.1.1/gecode/set/select/union.icc +371 -0
- data/ext/gecode-2.1.1/gecode/set/select/unionConst.icc +334 -0
- data/ext/gecode-2.1.1/gecode/set/sequence.cc +69 -0
- data/ext/gecode-2.1.1/gecode/set/sequence.hh +134 -0
- data/ext/gecode-2.1.1/gecode/set/sequence/common.icc +99 -0
- data/ext/gecode-2.1.1/gecode/set/sequence/seq-u.cc +176 -0
- data/ext/gecode-2.1.1/gecode/set/sequence/seq-u.icc +79 -0
- data/ext/gecode-2.1.1/gecode/set/sequence/seq.cc +94 -0
- data/ext/gecode-2.1.1/gecode/set/sequence/seq.icc +69 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp.icc +737 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/delta.icc +78 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/integerset.cc +349 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/integerset.icc +484 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/iter.icc +63 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/set.cc +214 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/set.icc +532 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/set.vis +190 -0
- data/ext/gecode-2.1.1/gecode/set/var/set.cc +105 -0
- data/ext/gecode-2.1.1/gecode/set/var/set.icc +303 -0
- data/ext/gecode-2.1.1/gecode/set/view.icc +1503 -0
- data/ext/gecode-2.1.1/gecode/set/view/complement.icc +629 -0
- data/ext/gecode-2.1.1/gecode/set/view/const.icc +907 -0
- data/ext/gecode-2.1.1/gecode/set/view/offset.icc +497 -0
- data/ext/gecode-2.1.1/gecode/set/view/print.cc +141 -0
- data/ext/gecode-2.1.1/gecode/set/view/set.icc +275 -0
- data/ext/gecode-2.1.1/gecode/set/view/singleton.icc +438 -0
- data/ext/gecode-2.1.1/gecode/support.hh +110 -0
- data/ext/gecode-2.1.1/gecode/support/block-allocator.icc +158 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/AUTHORS +11 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/ChangeLog +218 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/NEWS +200 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/README +128 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/bdd.h +939 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/bddio.c +596 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/bddop.c +2848 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/bddtree.h +62 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/bvec.c +1354 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/bvec.h +298 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/cache.c +104 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/cache.h +72 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/config.h +20 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/cppext.cc +626 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/fdd.c +1079 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/fdd.h +175 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/imatrix.c +151 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/imatrix.h +61 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/kernel.c +1555 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/kernel.h +244 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/pairs.c +336 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/prime.c +322 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/prime.h +50 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/reorder.c +2345 -0
- data/ext/gecode-2.1.1/gecode/support/buddy/tree.c +224 -0
- data/ext/gecode-2.1.1/gecode/support/cast.icc +52 -0
- data/ext/gecode-2.1.1/gecode/support/config.icc.in +80 -0
- data/ext/gecode-2.1.1/gecode/support/dynamic-array.icc +138 -0
- data/ext/gecode-2.1.1/gecode/support/dynamic-stack.icc +167 -0
- data/ext/gecode-2.1.1/gecode/support/exception.cc +65 -0
- data/ext/gecode-2.1.1/gecode/support/exception.icc +82 -0
- data/ext/gecode-2.1.1/gecode/support/macros.icc +103 -0
- data/ext/gecode-2.1.1/gecode/support/map.icc +207 -0
- data/ext/gecode-2.1.1/gecode/support/marked-pointer.icc +66 -0
- data/ext/gecode-2.1.1/gecode/support/memory.icc +220 -0
- data/ext/gecode-2.1.1/gecode/support/random.icc +121 -0
- data/ext/gecode-2.1.1/gecode/support/sentinel-stack.icc +122 -0
- data/ext/gecode-2.1.1/gecode/support/sort.icc +210 -0
- data/ext/gecode-2.1.1/gecode/support/static-pqueue.icc +242 -0
- data/ext/gecode-2.1.1/gecode/support/static-stack.icc +125 -0
- data/ext/gecode-2.1.1/gecode/support/symbol.cc +226 -0
- data/ext/gecode-2.1.1/gecode/support/symbol.icc +130 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/install-sh +0 -0
- data/ext/gecode-2.1.1/misc/AppleHelpbookInfo.plist +26 -0
- data/ext/gecode-2.1.1/misc/allexamples.perl +60 -0
- data/ext/gecode-2.1.1/misc/debian/Makefile.am +44 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/debian/changelog +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/debian/control +0 -0
- data/ext/gecode-2.1.1/misc/debian/copyright +30 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/debian/gecode.info +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/debian/gecode.install +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/debian/gecode.spec +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/debian/rules +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/doxygen/back.png +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/doxygen/footer.html +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/doxygen/gecode-logo-100.png +0 -0
- data/ext/{gecode-1.3.1 → gecode-2.1.1}/misc/doxygen/header.html +0 -0
- data/ext/gecode-2.1.1/misc/doxygen/stylesheet.css +464 -0
- data/ext/gecode-2.1.1/misc/fixproperties.sh +77 -0
- data/ext/gecode-2.1.1/misc/gecode-gist.pc.in +45 -0
- data/ext/gecode-2.1.1/misc/gecode-minimodel.pc.in +45 -0
- data/ext/gecode-2.1.1/misc/gecode-search.pc.in +45 -0
- data/ext/gecode-2.1.1/misc/gecode-serialization.pc.in +45 -0
- data/ext/gecode-2.1.1/misc/gecode.pc.in +45 -0
- data/ext/gecode-2.1.1/misc/genchangelog.perl +208 -0
- data/ext/gecode-2.1.1/misc/genlcovmakefile.perl +148 -0
- data/ext/gecode-2.1.1/misc/genlicense.perl +121 -0
- data/ext/gecode-2.1.1/misc/genregistry.perl +468 -0
- data/ext/gecode-2.1.1/misc/genstatistics.perl +178 -0
- data/ext/gecode-2.1.1/misc/gentxtchangelog.perl +192 -0
- data/ext/gecode-2.1.1/misc/genvariables.perl +905 -0
- data/ext/gecode-2.1.1/misc/getrevision.perl +47 -0
- data/ext/gecode-2.1.1/misc/makedepend.perl +85 -0
- data/ext/gecode-2.1.1/misc/svn-ignore.txt +15 -0
- data/ext/gecode-2.1.1/variables.vsl +50 -0
- data/ext/missing.cpp +1 -1
- data/ext/missing.h +1 -1
- data/ext/vararray.h +4 -4
- data/lib/gecoder/bindings.rb +21 -1
- data/lib/gecoder/bindings/bindings.rb +408 -731
- data/lib/gecoder/interface/binding_changes.rb +1 -1
- data/lib/gecoder/interface/branch.rb +25 -25
- data/lib/gecoder/interface/constraints.rb +47 -4
- data/lib/gecoder/interface/constraints/bool/boolean.rb +18 -16
- data/lib/gecoder/interface/constraints/bool_enum/boolean.rb +13 -11
- data/lib/gecoder/interface/constraints/int/arithmetic.rb +5 -4
- data/lib/gecoder/interface/constraints/int/domain.rb +8 -9
- data/lib/gecoder/interface/constraints/int/linear.rb +10 -8
- data/lib/gecoder/interface/constraints/int_enum/arithmetic.rb +4 -4
- data/lib/gecoder/interface/constraints/int_enum/channel.rb +2 -2
- data/lib/gecoder/interface/constraints/int_enum/count.rb +4 -5
- data/lib/gecoder/interface/constraints/int_enum/distinct.rb +7 -2
- data/lib/gecoder/interface/constraints/int_enum/element.rb +2 -2
- data/lib/gecoder/interface/constraints/int_enum/equality.rb +6 -3
- data/lib/gecoder/interface/constraints/int_enum/sort.rb +17 -5
- data/lib/gecoder/interface/constraints/set_enum/distinct.rb +0 -36
- data/lib/gecoder/interface/constraints/set_var_constraints.rb +5 -0
- data/lib/gecoder/interface/model.rb +3 -3
- data/lib/gecoder/interface/search.rb +5 -4
- data/lib/gecoder/version.rb +1 -1
- data/specs/branch.rb +27 -27
- data/specs/constraints/arithmetic.rb +48 -30
- data/specs/constraints/bool_enum.rb +39 -19
- data/specs/constraints/boolean.rb +10 -10
- data/specs/constraints/cardinality.rb +12 -9
- data/specs/constraints/channel.rb +6 -6
- data/specs/constraints/connection.rb +22 -26
- data/specs/constraints/constraint_helper.rb +125 -41
- data/specs/constraints/count.rb +22 -15
- data/specs/constraints/distinct.rb +10 -64
- data/specs/constraints/element.rb +14 -12
- data/specs/constraints/equality.rb +4 -4
- data/specs/constraints/int_domain.rb +8 -7
- data/specs/constraints/int_relation.rb +12 -8
- data/specs/constraints/linear.rb +4 -4
- data/specs/constraints/reification_sugar.rb +22 -4
- data/specs/constraints/selection.rb +2 -2
- data/specs/constraints/set_domain.rb +7 -3
- data/specs/constraints/set_operation.rb +2 -2
- data/specs/constraints/set_relation.rb +2 -6
- data/specs/constraints/sort.rb +20 -16
- data/specs/distribution.rb +14 -0
- data/specs/model.rb +4 -4
- data/tasks/dependencies.txt +21 -0
- data/tasks/distribution.rake +49 -14
- data/vendor/rust/include/rust_checks.hh +2 -1
- data/vendor/rust/include/rust_conversions.hh +2 -2
- data/vendor/rust/rust/attribute.rb +2 -2
- data/vendor/rust/rust/class.rb +2 -2
- data/vendor/rust/rust/cxxclass.rb +0 -2
- data/vendor/rust/rust/function.rb +2 -2
- data/vendor/rust/rust/templates/AttributeDefinition.rusttpl +1 -1
- data/vendor/rust/rust/templates/StandaloneClassDeclarations.rusttpl +1 -1
- data/vendor/rust/rust/templates/VariableFunctionCall.rusttpl +1 -1
- data/vendor/rust/rust/type.rb +1 -1
- metadata +599 -542
- data/ext/gecode-1.3.1/LICENSE +0 -34
- data/ext/gecode-1.3.1/Makefile.contribs +0 -71
- data/ext/gecode-1.3.1/Makefile.dep +0 -3928
- data/ext/gecode-1.3.1/Makefile.in +0 -966
- data/ext/gecode-1.3.1/changelog.in +0 -1065
- data/ext/gecode-1.3.1/configure +0 -8590
- data/ext/gecode-1.3.1/configure.ac +0 -179
- data/ext/gecode-1.3.1/configure.ac.in +0 -175
- data/ext/gecode-1.3.1/contribs/graph/INSTALL +0 -53
- data/ext/gecode-1.3.1/contribs/graph/LICENSE +0 -11
- data/ext/gecode-1.3.1/contribs/graph/Makefile +0 -167
- data/ext/gecode-1.3.1/contribs/graph/Makefile.in.in +0 -169
- data/ext/gecode-1.3.1/contribs/graph/TODO +0 -28
- data/ext/gecode-1.3.1/contribs/graph/binarysimple.hh +0 -82
- data/ext/gecode-1.3.1/contribs/graph/binarysimple.icc +0 -186
- data/ext/gecode-1.3.1/contribs/graph/branch/branch.icc +0 -257
- data/ext/gecode-1.3.1/contribs/graph/configure +0 -2160
- data/ext/gecode-1.3.1/contribs/graph/configure.ac +0 -33
- data/ext/gecode-1.3.1/contribs/graph/doxygen.conf +0 -1226
- data/ext/gecode-1.3.1/contribs/graph/doxygen.hh +0 -132
- data/ext/gecode-1.3.1/contribs/graph/examples/cpgraph-basic.cc +0 -94
- data/ext/gecode-1.3.1/contribs/graph/examples/cpgraph-complement.cc +0 -104
- data/ext/gecode-1.3.1/contribs/graph/examples/cpgraph-instUB.cc +0 -105
- data/ext/gecode-1.3.1/contribs/graph/examples/cpgraph-path.cc +0 -92
- data/ext/gecode-1.3.1/contribs/graph/examples/cpgraph-path2.cc +0 -273
- data/ext/gecode-1.3.1/contribs/graph/examples/cpgraph-pathcost.cc +0 -311
- data/ext/gecode-1.3.1/contribs/graph/examples/g1.txt +0 -1
- data/ext/gecode-1.3.1/contribs/graph/examples/g2.txt +0 -1
- data/ext/gecode-1.3.1/contribs/graph/graph.hh +0 -51
- data/ext/gecode-1.3.1/contribs/graph/graphutils.h +0 -46
- data/ext/gecode-1.3.1/contribs/graph/graphutils.icc +0 -140
- data/ext/gecode-1.3.1/contribs/graph/misc/doxygen/footer.html +0 -1
- data/ext/gecode-1.3.1/contribs/graph/path.hh +0 -116
- data/ext/gecode-1.3.1/contribs/graph/path.icc +0 -64
- data/ext/gecode-1.3.1/contribs/graph/path/path.icc +0 -139
- data/ext/gecode-1.3.1/contribs/graph/path/pathdegree.icc +0 -133
- data/ext/gecode-1.3.1/contribs/graph/path/pathgraphs.icc +0 -341
- data/ext/gecode-1.3.1/contribs/graph/shortdesc.ac +0 -1
- data/ext/gecode-1.3.1/contribs/graph/stlutility.icc +0 -105
- data/ext/gecode-1.3.1/contribs/graph/var.icc +0 -106
- data/ext/gecode-1.3.1/contribs/graph/view.icc +0 -373
- data/ext/gecode-1.3.1/contribs/graph/view/arcnode.cc +0 -162
- data/ext/gecode-1.3.1/contribs/graph/view/arcnode.hh +0 -78
- data/ext/gecode-1.3.1/contribs/graph/view/boundsgraphs.icc +0 -349
- data/ext/gecode-1.3.1/contribs/graph/view/constant.icc +0 -148
- data/ext/gecode-1.3.1/contribs/graph/view/iter.icc +0 -337
- data/ext/gecode-1.3.1/contribs/graph/view/nodearcsets.icc +0 -493
- data/ext/gecode-1.3.1/contribs/graph/view/nodeset.icc +0 -60
- data/ext/gecode-1.3.1/contribs/graph/view/outadjsets.icc +0 -600
- data/ext/gecode-1.3.1/contribs/graph/view/prop.icc +0 -135
- data/ext/gecode-1.3.1/contribs/map/COMPILING +0 -68
- data/ext/gecode-1.3.1/contribs/map/LICENSE +0 -11
- data/ext/gecode-1.3.1/contribs/map/Makefile.in.in +0 -173
- data/ext/gecode-1.3.1/contribs/map/configure +0 -2285
- data/ext/gecode-1.3.1/contribs/map/configure.ac +0 -32
- data/ext/gecode-1.3.1/contribs/map/constraints.hh +0 -46
- data/ext/gecode-1.3.1/contribs/map/constraints.icc +0 -84
- data/ext/gecode-1.3.1/contribs/map/doxygen.conf +0 -1229
- data/ext/gecode-1.3.1/contribs/map/doxygen.hh +0 -33
- data/ext/gecode-1.3.1/contribs/map/examples/approximateMatching.cc +0 -199
- data/ext/gecode-1.3.1/contribs/map/examples/g1.txt +0 -1
- data/ext/gecode-1.3.1/contribs/map/examples/g2.txt +0 -1
- data/ext/gecode-1.3.1/contribs/map/examples/graph-examples.tgz +0 -0
- data/ext/gecode-1.3.1/contribs/map/examples/isomorphism.cc +0 -148
- data/ext/gecode-1.3.1/contribs/map/examples/map +0 -0
- data/ext/gecode-1.3.1/contribs/map/examples/map.cc +0 -80
- data/ext/gecode-1.3.1/contribs/map/examples/subgraphmonomorphism.cc +0 -155
- data/ext/gecode-1.3.1/contribs/map/map.hh +0 -65
- data/ext/gecode-1.3.1/contribs/map/matching/mono.hh +0 -235
- data/ext/gecode-1.3.1/contribs/map/matching/mono.icc +0 -771
- data/ext/gecode-1.3.1/contribs/map/shortdesc.ac +0 -2
- data/ext/gecode-1.3.1/contribs/map/var.icc +0 -346
- data/ext/gecode-1.3.1/contribs/map/var/imp.cc +0 -42
- data/ext/gecode-1.3.1/contribs/map/var/imp.icc +0 -436
- data/ext/gecode-1.3.1/doxygen.conf.in +0 -1225
- data/ext/gecode-1.3.1/doxygen.hh.in +0 -877
- data/ext/gecode-1.3.1/examples/all-interval-sort.cc +0 -201
- data/ext/gecode-1.3.1/examples/all-interval.cc +0 -114
- data/ext/gecode-1.3.1/examples/alpha.cc +0 -112
- data/ext/gecode-1.3.1/examples/baseline.cc +0 -71
- data/ext/gecode-1.3.1/examples/bibd.cc +0 -173
- data/ext/gecode-1.3.1/examples/black-hole.cc +0 -281
- data/ext/gecode-1.3.1/examples/cars.cc +0 -165
- data/ext/gecode-1.3.1/examples/crew.cc +0 -220
- data/ext/gecode-1.3.1/examples/crowded-chess.cc +0 -312
- data/ext/gecode-1.3.1/examples/donald.cc +0 -93
- data/ext/gecode-1.3.1/examples/eq20.cc +0 -111
- data/ext/gecode-1.3.1/examples/golf.cc +0 -242
- data/ext/gecode-1.3.1/examples/golomb.cc +0 -141
- data/ext/gecode-1.3.1/examples/graph-color.cc +0 -371
- data/ext/gecode-1.3.1/examples/grocery.cc +0 -107
- data/ext/gecode-1.3.1/examples/hamming.cc +0 -107
- data/ext/gecode-1.3.1/examples/ind-set.cc +0 -130
- data/ext/gecode-1.3.1/examples/knights.cc +0 -146
- data/ext/gecode-1.3.1/examples/langfordnum.cc +0 -244
- data/ext/gecode-1.3.1/examples/magic-sequence-gcc.cc +0 -93
- data/ext/gecode-1.3.1/examples/magic-sequence.cc +0 -108
- data/ext/gecode-1.3.1/examples/magic-square.cc +0 -120
- data/ext/gecode-1.3.1/examples/money.cc +0 -92
- data/ext/gecode-1.3.1/examples/ortho-latin.cc +0 -156
- data/ext/gecode-1.3.1/examples/packing.cc +0 -211
- data/ext/gecode-1.3.1/examples/partition.cc +0 -126
- data/ext/gecode-1.3.1/examples/photo.cc +0 -155
- data/ext/gecode-1.3.1/examples/picture-puzzle.cc +0 -481
- data/ext/gecode-1.3.1/examples/queen-armies.cc +0 -240
- data/ext/gecode-1.3.1/examples/queens.cc +0 -99
- data/ext/gecode-1.3.1/examples/sports-league.cc +0 -454
- data/ext/gecode-1.3.1/examples/steiner.cc +0 -148
- data/ext/gecode-1.3.1/examples/stress-domain.cc +0 -86
- data/ext/gecode-1.3.1/examples/stress-element.cc +0 -95
- data/ext/gecode-1.3.1/examples/stress-exec.cc +0 -74
- data/ext/gecode-1.3.1/examples/stress-min.cc +0 -84
- data/ext/gecode-1.3.1/examples/stress-search.cc +0 -72
- data/ext/gecode-1.3.1/examples/sudoku-mixed.cc +0 -282
- data/ext/gecode-1.3.1/examples/sudoku-set.cc +0 -162
- data/ext/gecode-1.3.1/examples/sudoku.cc +0 -188
- data/ext/gecode-1.3.1/examples/sudoku.icc +0 -703
- data/ext/gecode-1.3.1/examples/support.cc +0 -160
- data/ext/gecode-1.3.1/examples/support.hh +0 -98
- data/ext/gecode-1.3.1/examples/support.icc +0 -187
- data/ext/gecode-1.3.1/examples/timer.cc +0 -47
- data/ext/gecode-1.3.1/examples/timer.hh +0 -72
- data/ext/gecode-1.3.1/examples/warehouses.cc +0 -176
- data/ext/gecode-1.3.1/extconf.rb +0 -8
- data/ext/gecode-1.3.1/gecode.m4 +0 -736
- data/ext/gecode-1.3.1/gecode/config.icc.in +0 -50
- data/ext/gecode-1.3.1/gecode/int.hh +0 -1426
- data/ext/gecode-1.3.1/gecode/int/arithmetic.cc +0 -87
- data/ext/gecode-1.3.1/gecode/int/arithmetic.hh +0 -292
- data/ext/gecode-1.3.1/gecode/int/arithmetic/abs.icc +0 -213
- data/ext/gecode-1.3.1/gecode/int/arithmetic/max.icc +0 -196
- data/ext/gecode-1.3.1/gecode/int/arithmetic/mult.icc +0 -478
- data/ext/gecode-1.3.1/gecode/int/array.cc +0 -61
- data/ext/gecode-1.3.1/gecode/int/array.icc +0 -264
- data/ext/gecode-1.3.1/gecode/int/bool.cc +0 -187
- data/ext/gecode-1.3.1/gecode/int/bool.hh +0 -255
- data/ext/gecode-1.3.1/gecode/int/bool/base.icc +0 -123
- data/ext/gecode-1.3.1/gecode/int/bool/eq.icc +0 -89
- data/ext/gecode-1.3.1/gecode/int/bool/eqv.icc +0 -132
- data/ext/gecode-1.3.1/gecode/int/bool/or.icc +0 -380
- data/ext/gecode-1.3.1/gecode/int/branch.cc +0 -81
- data/ext/gecode-1.3.1/gecode/int/branch.hh +0 -444
- data/ext/gecode-1.3.1/gecode/int/branch/assign.cc +0 -83
- data/ext/gecode-1.3.1/gecode/int/branch/assign.icc +0 -76
- data/ext/gecode-1.3.1/gecode/int/branch/select-val.icc +0 -104
- data/ext/gecode-1.3.1/gecode/int/branch/select-view.icc +0 -219
- data/ext/gecode-1.3.1/gecode/int/channel.cc +0 -62
- data/ext/gecode-1.3.1/gecode/int/channel.hh +0 -144
- data/ext/gecode-1.3.1/gecode/int/channel/base.icc +0 -60
- data/ext/gecode-1.3.1/gecode/int/channel/dom.icc +0 -313
- data/ext/gecode-1.3.1/gecode/int/channel/stack.icc +0 -59
- data/ext/gecode-1.3.1/gecode/int/channel/val.icc +0 -239
- data/ext/gecode-1.3.1/gecode/int/count.cc +0 -174
- data/ext/gecode-1.3.1/gecode/int/count.hh +0 -401
- data/ext/gecode-1.3.1/gecode/int/count/int.icc +0 -495
- data/ext/gecode-1.3.1/gecode/int/count/rel.icc +0 -100
- data/ext/gecode-1.3.1/gecode/int/count/view.icc +0 -332
- data/ext/gecode-1.3.1/gecode/int/cumulatives.cc +0 -210
- data/ext/gecode-1.3.1/gecode/int/cumulatives.hh +0 -118
- data/ext/gecode-1.3.1/gecode/int/cumulatives/val.icc +0 -377
- data/ext/gecode-1.3.1/gecode/int/distinct.cc +0 -77
- data/ext/gecode-1.3.1/gecode/int/distinct.hh +0 -272
- data/ext/gecode-1.3.1/gecode/int/distinct/bilink.icc +0 -73
- data/ext/gecode-1.3.1/gecode/int/distinct/bnd.icc +0 -335
- data/ext/gecode-1.3.1/gecode/int/distinct/combptr.icc +0 -62
- data/ext/gecode-1.3.1/gecode/int/distinct/dom.icc +0 -740
- data/ext/gecode-1.3.1/gecode/int/distinct/edge.icc +0 -96
- data/ext/gecode-1.3.1/gecode/int/distinct/node.icc +0 -107
- data/ext/gecode-1.3.1/gecode/int/distinct/ter-dom.icc +0 -97
- data/ext/gecode-1.3.1/gecode/int/distinct/val.icc +0 -171
- data/ext/gecode-1.3.1/gecode/int/dom.cc +0 -81
- data/ext/gecode-1.3.1/gecode/int/dom.hh +0 -101
- data/ext/gecode-1.3.1/gecode/int/dom/range.icc +0 -85
- data/ext/gecode-1.3.1/gecode/int/dom/spec.icc +0 -85
- data/ext/gecode-1.3.1/gecode/int/element.cc +0 -58
- data/ext/gecode-1.3.1/gecode/int/element.hh +0 -203
- data/ext/gecode-1.3.1/gecode/int/element/int.icc +0 -396
- data/ext/gecode-1.3.1/gecode/int/element/view.icc +0 -443
- data/ext/gecode-1.3.1/gecode/int/exception.icc +0 -137
- data/ext/gecode-1.3.1/gecode/int/gcc.cc +0 -708
- data/ext/gecode-1.3.1/gecode/int/gcc.hh +0 -338
- data/ext/gecode-1.3.1/gecode/int/gcc/bnd.icc +0 -629
- data/ext/gecode-1.3.1/gecode/int/gcc/dom.icc +0 -504
- data/ext/gecode-1.3.1/gecode/int/gcc/gccbndsup.icc +0 -760
- data/ext/gecode-1.3.1/gecode/int/gcc/graphsup.icc +0 -2375
- data/ext/gecode-1.3.1/gecode/int/gcc/lbc.icc +0 -375
- data/ext/gecode-1.3.1/gecode/int/gcc/occur.icc +0 -687
- data/ext/gecode-1.3.1/gecode/int/gcc/ubc.icc +0 -236
- data/ext/gecode-1.3.1/gecode/int/gcc/val.icc +0 -373
- data/ext/gecode-1.3.1/gecode/int/int-set.cc +0 -115
- data/ext/gecode-1.3.1/gecode/int/int-set.icc +0 -151
- data/ext/gecode-1.3.1/gecode/int/linear.cc +0 -247
- data/ext/gecode-1.3.1/gecode/int/linear.hh +0 -1056
- data/ext/gecode-1.3.1/gecode/int/linear/binary.icc +0 -439
- data/ext/gecode-1.3.1/gecode/int/linear/bool-int.icc +0 -422
- data/ext/gecode-1.3.1/gecode/int/linear/bool-view.icc +0 -311
- data/ext/gecode-1.3.1/gecode/int/linear/dom.icc +0 -503
- data/ext/gecode-1.3.1/gecode/int/linear/nary.icc +0 -857
- data/ext/gecode-1.3.1/gecode/int/linear/noview.icc +0 -264
- data/ext/gecode-1.3.1/gecode/int/linear/post.cc +0 -542
- data/ext/gecode-1.3.1/gecode/int/linear/ternary.icc +0 -255
- data/ext/gecode-1.3.1/gecode/int/propagator.icc +0 -194
- data/ext/gecode-1.3.1/gecode/int/regular.cc +0 -40
- data/ext/gecode-1.3.1/gecode/int/regular.hh +0 -83
- data/ext/gecode-1.3.1/gecode/int/regular/dfa.cc +0 -466
- data/ext/gecode-1.3.1/gecode/int/regular/dfa.icc +0 -172
- data/ext/gecode-1.3.1/gecode/int/regular/dom.icc +0 -480
- data/ext/gecode-1.3.1/gecode/int/regular/reg.cc +0 -738
- data/ext/gecode-1.3.1/gecode/int/rel.cc +0 -293
- data/ext/gecode-1.3.1/gecode/int/rel.hh +0 -526
- data/ext/gecode-1.3.1/gecode/int/rel/eq.icc +0 -640
- data/ext/gecode-1.3.1/gecode/int/rel/lex.icc +0 -212
- data/ext/gecode-1.3.1/gecode/int/rel/lq-le.icc +0 -246
- data/ext/gecode-1.3.1/gecode/int/rel/nq.icc +0 -188
- data/ext/gecode-1.3.1/gecode/int/sortedness.cc +0 -124
- data/ext/gecode-1.3.1/gecode/int/sortedness.hh +0 -108
- data/ext/gecode-1.3.1/gecode/int/sortedness/matching.icc +0 -177
- data/ext/gecode-1.3.1/gecode/int/sortedness/narrowing.icc +0 -243
- data/ext/gecode-1.3.1/gecode/int/sortedness/order.icc +0 -232
- data/ext/gecode-1.3.1/gecode/int/sortedness/sortedness.icc +0 -727
- data/ext/gecode-1.3.1/gecode/int/sortedness/sortsup.icc +0 -666
- data/ext/gecode-1.3.1/gecode/int/var-imp.vis +0 -198
- data/ext/gecode-1.3.1/gecode/int/var.icc +0 -590
- data/ext/gecode-1.3.1/gecode/int/var/bool.icc +0 -52
- data/ext/gecode-1.3.1/gecode/int/var/imp-body.icc +0 -65
- data/ext/gecode-1.3.1/gecode/int/var/imp-hdr.icc +0 -191
- data/ext/gecode-1.3.1/gecode/int/var/imp.cc +0 -361
- data/ext/gecode-1.3.1/gecode/int/var/imp.icc +0 -579
- data/ext/gecode-1.3.1/gecode/int/var/int.cc +0 -63
- data/ext/gecode-1.3.1/gecode/int/var/int.icc +0 -135
- data/ext/gecode-1.3.1/gecode/int/view.icc +0 -1219
- data/ext/gecode-1.3.1/gecode/int/view/bool.icc +0 -270
- data/ext/gecode-1.3.1/gecode/int/view/constint.icc +0 -306
- data/ext/gecode-1.3.1/gecode/int/view/int.icc +0 -221
- data/ext/gecode-1.3.1/gecode/int/view/iter.icc +0 -49
- data/ext/gecode-1.3.1/gecode/int/view/minus.icc +0 -285
- data/ext/gecode-1.3.1/gecode/int/view/offset.icc +0 -274
- data/ext/gecode-1.3.1/gecode/int/view/print.cc +0 -109
- data/ext/gecode-1.3.1/gecode/int/view/rtest.icc +0 -215
- data/ext/gecode-1.3.1/gecode/int/view/scale.icc +0 -373
- data/ext/gecode-1.3.1/gecode/iter.hh +0 -65
- data/ext/gecode-1.3.1/gecode/iter/ranges-add.icc +0 -130
- data/ext/gecode-1.3.1/gecode/iter/ranges-append.icc +0 -208
- data/ext/gecode-1.3.1/gecode/iter/ranges-array.icc +0 -123
- data/ext/gecode-1.3.1/gecode/iter/ranges-cache.icc +0 -143
- data/ext/gecode-1.3.1/gecode/iter/ranges-compl.icc +0 -206
- data/ext/gecode-1.3.1/gecode/iter/ranges-diff.icc +0 -127
- data/ext/gecode-1.3.1/gecode/iter/ranges-empty.icc +0 -96
- data/ext/gecode-1.3.1/gecode/iter/ranges-inter.icc +0 -202
- data/ext/gecode-1.3.1/gecode/iter/ranges-minmax.icc +0 -103
- data/ext/gecode-1.3.1/gecode/iter/ranges-minus.icc +0 -138
- data/ext/gecode-1.3.1/gecode/iter/ranges-offset.icc +0 -112
- data/ext/gecode-1.3.1/gecode/iter/ranges-operations.icc +0 -142
- data/ext/gecode-1.3.1/gecode/iter/ranges-scale.icc +0 -224
- data/ext/gecode-1.3.1/gecode/iter/ranges-singleton.icc +0 -71
- data/ext/gecode-1.3.1/gecode/iter/ranges-size.icc +0 -131
- data/ext/gecode-1.3.1/gecode/iter/ranges-union.icc +0 -211
- data/ext/gecode-1.3.1/gecode/iter/ranges-values.icc +0 -125
- data/ext/gecode-1.3.1/gecode/iter/values-ranges.icc +0 -91
- data/ext/gecode-1.3.1/gecode/iter/virtual-ranges-compl.icc +0 -247
- data/ext/gecode-1.3.1/gecode/iter/virtual-ranges-inter.icc +0 -227
- data/ext/gecode-1.3.1/gecode/iter/virtual-ranges-union.icc +0 -236
- data/ext/gecode-1.3.1/gecode/iter/virtual-ranges.icc +0 -126
- data/ext/gecode-1.3.1/gecode/kernel.hh +0 -141
- data/ext/gecode-1.3.1/gecode/kernel/array.icc +0 -954
- data/ext/gecode-1.3.1/gecode/kernel/branching.icc +0 -233
- data/ext/gecode-1.3.1/gecode/kernel/core.cc +0 -417
- data/ext/gecode-1.3.1/gecode/kernel/core.icc +0 -1681
- data/ext/gecode-1.3.1/gecode/kernel/exception.cc +0 -49
- data/ext/gecode-1.3.1/gecode/kernel/exception.icc +0 -104
- data/ext/gecode-1.3.1/gecode/kernel/macros.icc +0 -98
- data/ext/gecode-1.3.1/gecode/kernel/memory-manager.cc +0 -41
- data/ext/gecode-1.3.1/gecode/kernel/memory-manager.icc +0 -438
- data/ext/gecode-1.3.1/gecode/kernel/memory.icc +0 -205
- data/ext/gecode-1.3.1/gecode/kernel/modevent.icc +0 -53
- data/ext/gecode-1.3.1/gecode/kernel/propagator.icc +0 -680
- data/ext/gecode-1.3.1/gecode/kernel/view.icc +0 -583
- data/ext/gecode-1.3.1/gecode/limits.hh +0 -87
- data/ext/gecode-1.3.1/gecode/minimodel.hh +0 -942
- data/ext/gecode-1.3.1/gecode/minimodel/arithmetic.cc +0 -137
- data/ext/gecode-1.3.1/gecode/minimodel/bool-expr.cc +0 -207
- data/ext/gecode-1.3.1/gecode/minimodel/bool-expr.icc +0 -191
- data/ext/gecode-1.3.1/gecode/minimodel/bool-rel.icc +0 -66
- data/ext/gecode-1.3.1/gecode/minimodel/exception.icc +0 -59
- data/ext/gecode-1.3.1/gecode/minimodel/lin-expr.cc +0 -103
- data/ext/gecode-1.3.1/gecode/minimodel/lin-expr.icc +0 -192
- data/ext/gecode-1.3.1/gecode/minimodel/lin-rel.icc +0 -200
- data/ext/gecode-1.3.1/gecode/minimodel/matrix.icc +0 -118
- data/ext/gecode-1.3.1/gecode/minimodel/scheduling.cc +0 -241
- data/ext/gecode-1.3.1/gecode/search.hh +0 -745
- data/ext/gecode-1.3.1/gecode/search/bab.cc +0 -153
- data/ext/gecode-1.3.1/gecode/search/bab.icc +0 -101
- data/ext/gecode-1.3.1/gecode/search/dfs.cc +0 -63
- data/ext/gecode-1.3.1/gecode/search/dfs.icc +0 -144
- data/ext/gecode-1.3.1/gecode/search/engine-ctrl.icc +0 -109
- data/ext/gecode-1.3.1/gecode/search/lds.cc +0 -237
- data/ext/gecode-1.3.1/gecode/search/lds.icc +0 -57
- data/ext/gecode-1.3.1/gecode/search/reco-stack.icc +0 -219
- data/ext/gecode-1.3.1/gecode/search/restart.icc +0 -76
- data/ext/gecode-1.3.1/gecode/search/statistics.icc +0 -30
- data/ext/gecode-1.3.1/gecode/search/stop.cc +0 -58
- data/ext/gecode-1.3.1/gecode/search/stop.icc +0 -100
- data/ext/gecode-1.3.1/gecode/set.hh +0 -419
- data/ext/gecode-1.3.1/gecode/set/array.cc +0 -114
- data/ext/gecode-1.3.1/gecode/set/array.icc +0 -134
- data/ext/gecode-1.3.1/gecode/set/branch.cc +0 -57
- data/ext/gecode-1.3.1/gecode/set/branch.hh +0 -176
- data/ext/gecode-1.3.1/gecode/set/branch/select-val.icc +0 -72
- data/ext/gecode-1.3.1/gecode/set/branch/select-view.icc +0 -112
- data/ext/gecode-1.3.1/gecode/set/cardinality.cc +0 -49
- data/ext/gecode-1.3.1/gecode/set/convex.cc +0 -43
- data/ext/gecode-1.3.1/gecode/set/convex.hh +0 -92
- data/ext/gecode-1.3.1/gecode/set/convex/conv.cc +0 -81
- data/ext/gecode-1.3.1/gecode/set/convex/conv.icc +0 -51
- data/ext/gecode-1.3.1/gecode/set/convex/hull.cc +0 -100
- data/ext/gecode-1.3.1/gecode/set/convex/hull.icc +0 -52
- data/ext/gecode-1.3.1/gecode/set/distinct.cc +0 -48
- data/ext/gecode-1.3.1/gecode/set/distinct.hh +0 -97
- data/ext/gecode-1.3.1/gecode/set/distinct/atmostOne.cc +0 -151
- data/ext/gecode-1.3.1/gecode/set/distinct/atmostOne.icc +0 -50
- data/ext/gecode-1.3.1/gecode/set/distinct/binomial.cc +0 -46
- data/ext/gecode-1.3.1/gecode/set/distinct/binomial.icc +0 -157
- data/ext/gecode-1.3.1/gecode/set/distinct/distinct.cc +0 -124
- data/ext/gecode-1.3.1/gecode/set/distinct/distinct.icc +0 -58
- data/ext/gecode-1.3.1/gecode/set/dom.cc +0 -224
- data/ext/gecode-1.3.1/gecode/set/exception.icc +0 -132
- data/ext/gecode-1.3.1/gecode/set/int.cc +0 -139
- data/ext/gecode-1.3.1/gecode/set/int.hh +0 -226
- data/ext/gecode-1.3.1/gecode/set/int/card.cc +0 -61
- data/ext/gecode-1.3.1/gecode/set/int/card.icc +0 -54
- data/ext/gecode-1.3.1/gecode/set/int/channel.cc +0 -100
- data/ext/gecode-1.3.1/gecode/set/int/channel.icc +0 -75
- data/ext/gecode-1.3.1/gecode/set/int/match.cc +0 -148
- data/ext/gecode-1.3.1/gecode/set/int/match.icc +0 -67
- data/ext/gecode-1.3.1/gecode/set/int/minmax.cc +0 -109
- data/ext/gecode-1.3.1/gecode/set/int/minmax.icc +0 -63
- data/ext/gecode-1.3.1/gecode/set/int/weights.cc +0 -182
- data/ext/gecode-1.3.1/gecode/set/int/weights.icc +0 -174
- data/ext/gecode-1.3.1/gecode/set/projectors-compiler.hh +0 -148
- data/ext/gecode-1.3.1/gecode/set/projectors.cc +0 -109
- data/ext/gecode-1.3.1/gecode/set/projectors.hh +0 -319
- data/ext/gecode-1.3.1/gecode/set/projectors/compiler.cc +0 -841
- data/ext/gecode-1.3.1/gecode/set/projectors/projector-set.cc +0 -69
- data/ext/gecode-1.3.1/gecode/set/projectors/projector-set.icc +0 -66
- data/ext/gecode-1.3.1/gecode/set/projectors/projector.cc +0 -125
- data/ext/gecode-1.3.1/gecode/set/projectors/projector.icc +0 -79
- data/ext/gecode-1.3.1/gecode/set/projectors/propagator.hh +0 -127
- data/ext/gecode-1.3.1/gecode/set/projectors/propagator/card.icc +0 -96
- data/ext/gecode-1.3.1/gecode/set/projectors/propagator/nary.icc +0 -106
- data/ext/gecode-1.3.1/gecode/set/projectors/propagator/re-nary.cc +0 -76
- data/ext/gecode-1.3.1/gecode/set/projectors/propagator/re-nary.icc +0 -53
- data/ext/gecode-1.3.1/gecode/set/projectors/set-expr.cc +0 -306
- data/ext/gecode-1.3.1/gecode/set/projectors/set-expr.icc +0 -192
- data/ext/gecode-1.3.1/gecode/set/propagator.icc +0 -96
- data/ext/gecode-1.3.1/gecode/set/rel-op-const.cc +0 -233
- data/ext/gecode-1.3.1/gecode/set/rel-op.cc +0 -96
- data/ext/gecode-1.3.1/gecode/set/rel-op.hh +0 -267
- data/ext/gecode-1.3.1/gecode/set/rel-op/common.icc +0 -528
- data/ext/gecode-1.3.1/gecode/set/rel-op/inter.icc +0 -312
- data/ext/gecode-1.3.1/gecode/set/rel-op/partition.icc +0 -131
- data/ext/gecode-1.3.1/gecode/set/rel-op/post.icc +0 -198
- data/ext/gecode-1.3.1/gecode/set/rel-op/subofunion.icc +0 -150
- data/ext/gecode-1.3.1/gecode/set/rel-op/superofinter.icc +0 -151
- data/ext/gecode-1.3.1/gecode/set/rel-op/union.icc +0 -292
- data/ext/gecode-1.3.1/gecode/set/rel.cc +0 -201
- data/ext/gecode-1.3.1/gecode/set/rel.hh +0 -250
- data/ext/gecode-1.3.1/gecode/set/rel/common.icc +0 -109
- data/ext/gecode-1.3.1/gecode/set/rel/eq.icc +0 -101
- data/ext/gecode-1.3.1/gecode/set/rel/nosubset.icc +0 -88
- data/ext/gecode-1.3.1/gecode/set/rel/nq.icc +0 -132
- data/ext/gecode-1.3.1/gecode/set/rel/re-eq.icc +0 -142
- data/ext/gecode-1.3.1/gecode/set/rel/re-subset.icc +0 -121
- data/ext/gecode-1.3.1/gecode/set/rel/subset.icc +0 -80
- data/ext/gecode-1.3.1/gecode/set/select.cc +0 -88
- data/ext/gecode-1.3.1/gecode/set/select.hh +0 -113
- data/ext/gecode-1.3.1/gecode/set/select/disjoint.cc +0 -267
- data/ext/gecode-1.3.1/gecode/set/select/disjoint.icc +0 -59
- data/ext/gecode-1.3.1/gecode/set/select/idxarray.hh +0 -91
- data/ext/gecode-1.3.1/gecode/set/select/idxarray.icc +0 -112
- data/ext/gecode-1.3.1/gecode/set/select/inter.icc +0 -300
- data/ext/gecode-1.3.1/gecode/set/sequence.cc +0 -48
- data/ext/gecode-1.3.1/gecode/set/sequence.hh +0 -97
- data/ext/gecode-1.3.1/gecode/set/sequence/common.icc +0 -79
- data/ext/gecode-1.3.1/gecode/set/sequence/seq-u.cc +0 -83
- data/ext/gecode-1.3.1/gecode/set/sequence/seq-u.icc +0 -63
- data/ext/gecode-1.3.1/gecode/set/sequence/seq.cc +0 -61
- data/ext/gecode-1.3.1/gecode/set/sequence/seq.icc +0 -53
- data/ext/gecode-1.3.1/gecode/set/var-imp.vis +0 -205
- data/ext/gecode-1.3.1/gecode/set/var.icc +0 -1090
- data/ext/gecode-1.3.1/gecode/set/var/imp-body.icc +0 -192
- data/ext/gecode-1.3.1/gecode/set/var/imp-hdr.icc +0 -235
- data/ext/gecode-1.3.1/gecode/set/var/imp.cc +0 -127
- data/ext/gecode-1.3.1/gecode/set/var/imp.icc +0 -356
- data/ext/gecode-1.3.1/gecode/set/var/integerset.cc +0 -256
- data/ext/gecode-1.3.1/gecode/set/var/integerset.icc +0 -512
- data/ext/gecode-1.3.1/gecode/set/var/iter.icc +0 -47
- data/ext/gecode-1.3.1/gecode/set/var/set.cc +0 -99
- data/ext/gecode-1.3.1/gecode/set/var/set.icc +0 -282
- data/ext/gecode-1.3.1/gecode/set/view.icc +0 -1075
- data/ext/gecode-1.3.1/gecode/set/view/complement.icc +0 -525
- data/ext/gecode-1.3.1/gecode/set/view/const.icc +0 -651
- data/ext/gecode-1.3.1/gecode/set/view/print.cc +0 -120
- data/ext/gecode-1.3.1/gecode/set/view/set.icc +0 -217
- data/ext/gecode-1.3.1/gecode/set/view/singleton.icc +0 -348
- data/ext/gecode-1.3.1/gecode/support/block-allocator.hh +0 -152
- data/ext/gecode-1.3.1/gecode/support/dynamic-array.hh +0 -131
- data/ext/gecode-1.3.1/gecode/support/dynamic-stack.hh +0 -157
- data/ext/gecode-1.3.1/gecode/support/random.hh +0 -100
- data/ext/gecode-1.3.1/gecode/support/shared-array.hh +0 -255
- data/ext/gecode-1.3.1/gecode/support/sort.hh +0 -193
- data/ext/gecode-1.3.1/gecode/support/static-pqueue.hh +0 -240
- data/ext/gecode-1.3.1/gecode/support/static-stack.hh +0 -117
- data/ext/gecode-1.3.1/misc/debian/Makefile.am +0 -8
- data/ext/gecode-1.3.1/misc/debian/copyright +0 -44
- data/ext/gecode-1.3.1/misc/doxygen/stylesheet.css +0 -460
- data/ext/gecode-1.3.1/misc/fixproperties.sh +0 -32
- data/ext/gecode-1.3.1/misc/gecode-minimodel.pc.in +0 -12
- data/ext/gecode-1.3.1/misc/gecode-search.pc.in +0 -12
- data/ext/gecode-1.3.1/misc/gecode.pc.in +0 -12
- data/ext/gecode-1.3.1/misc/genchangelog.perl +0 -190
- data/ext/gecode-1.3.1/misc/genlicense.perl +0 -113
- data/ext/gecode-1.3.1/misc/genstatistics.perl +0 -155
- data/ext/gecode-1.3.1/misc/gentxtchangelog.perl +0 -170
- data/ext/gecode-1.3.1/misc/genvarimp.perl +0 -666
- data/ext/gecode-1.3.1/misc/getrevision.perl +0 -32
- data/ext/gecode-1.3.1/misc/makedepend.perl +0 -66
- data/ext/gecode-1.3.1/test/int.cc +0 -497
- data/ext/gecode-1.3.1/test/int.hh +0 -119
- data/ext/gecode-1.3.1/test/int/arithmetic.cc +0 -262
- data/ext/gecode-1.3.1/test/int/basic.cc +0 -42
- data/ext/gecode-1.3.1/test/int/bool.cc +0 -189
- data/ext/gecode-1.3.1/test/int/channel.cc +0 -79
- data/ext/gecode-1.3.1/test/int/count.cc +0 -264
- data/ext/gecode-1.3.1/test/int/distinct.cc +0 -121
- data/ext/gecode-1.3.1/test/int/dom.cc +0 -69
- data/ext/gecode-1.3.1/test/int/element.cc +0 -132
- data/ext/gecode-1.3.1/test/int/gcc.cc +0 -592
- data/ext/gecode-1.3.1/test/int/linear.cc +0 -315
- data/ext/gecode-1.3.1/test/int/minimodel.cc +0 -451
- data/ext/gecode-1.3.1/test/int/regular.cc +0 -105
- data/ext/gecode-1.3.1/test/int/rel.cc +0 -283
- data/ext/gecode-1.3.1/test/int/scheduling.cc +0 -259
- data/ext/gecode-1.3.1/test/int/sortedness.cc +0 -272
- data/ext/gecode-1.3.1/test/intset.cc +0 -40
- data/ext/gecode-1.3.1/test/log.cc +0 -515
- data/ext/gecode-1.3.1/test/log.hh +0 -68
- data/ext/gecode-1.3.1/test/set.cc +0 -542
- data/ext/gecode-1.3.1/test/set.hh +0 -152
- data/ext/gecode-1.3.1/test/set/convex.cc +0 -94
- data/ext/gecode-1.3.1/test/set/distinct.cc +0 -148
- data/ext/gecode-1.3.1/test/set/dom.cc +0 -67
- data/ext/gecode-1.3.1/test/set/int.cc +0 -249
- data/ext/gecode-1.3.1/test/set/projection.cc +0 -333
- data/ext/gecode-1.3.1/test/set/rel-op.cc +0 -662
- data/ext/gecode-1.3.1/test/set/rel.cc +0 -198
- data/ext/gecode-1.3.1/test/set/select.cc +0 -108
- data/ext/gecode-1.3.1/test/set/sequence.cc +0 -83
- data/ext/gecode-1.3.1/test/stress.cc +0 -93
- data/ext/gecode-1.3.1/test/stress.hh +0 -74
- data/ext/gecode-1.3.1/test/stress/distinct.cc +0 -70
- data/ext/gecode-1.3.1/test/stress/domain.cc +0 -69
- data/ext/gecode-1.3.1/test/stress/exec.cc +0 -60
- data/ext/gecode-1.3.1/test/stress/minsort.cc +0 -63
- data/ext/gecode-1.3.1/test/stress/regular.cc +0 -112
- data/ext/gecode-1.3.1/test/test.cc +0 -215
- data/ext/gecode-1.3.1/test/test.hh +0 -107
@@ -0,0 +1,2848 @@
|
|
1
|
+
/*========================================================================
|
2
|
+
Copyright (C) 1996-2002 by Jorn Lind-Nielsen
|
3
|
+
All rights reserved
|
4
|
+
|
5
|
+
Permission is hereby granted, without written agreement and without
|
6
|
+
license or royalty fees, to use, reproduce, prepare derivative
|
7
|
+
works, distribute, and display this software and its documentation
|
8
|
+
for any purpose, provided that (1) the above copyright notice and
|
9
|
+
the following two paragraphs appear in all copies of the source code
|
10
|
+
and (2) redistributions, including without limitation binaries,
|
11
|
+
reproduce these notices in the supporting documentation. Substantial
|
12
|
+
modifications to this software may be copyrighted by their authors
|
13
|
+
and need not follow the licensing terms described here, provided
|
14
|
+
that the new terms are clearly indicated in all files where they apply.
|
15
|
+
|
16
|
+
IN NO EVENT SHALL JORN LIND-NIELSEN, OR DISTRIBUTORS OF THIS
|
17
|
+
SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
18
|
+
INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS
|
19
|
+
SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE
|
20
|
+
ABOVE PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
21
|
+
|
22
|
+
JORN LIND-NIELSEN SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
|
23
|
+
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
25
|
+
ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO
|
26
|
+
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
27
|
+
MODIFICATIONS.
|
28
|
+
========================================================================*/
|
29
|
+
|
30
|
+
/*************************************************************************
|
31
|
+
$Header: /cvsroot/buddy/buddy/src/bddop.c,v 1.1.1.1 2004/06/25 13:22:22 haimcohen Exp $
|
32
|
+
FILE: bddop.c
|
33
|
+
DESCR: BDD operators
|
34
|
+
AUTH: Jorn Lind
|
35
|
+
DATE: (C) nov 1997
|
36
|
+
*************************************************************************/
|
37
|
+
#include <stdlib.h>
|
38
|
+
#include <string.h>
|
39
|
+
#include <math.h>
|
40
|
+
#include <time.h>
|
41
|
+
#include <assert.h>
|
42
|
+
|
43
|
+
#include "gecode/support/buddy/kernel.h"
|
44
|
+
#include "gecode/support/buddy/cache.h"
|
45
|
+
|
46
|
+
/* Hash value modifiers to distinguish between entries in misccache */
|
47
|
+
#define CACHEID_CONSTRAIN 0x0
|
48
|
+
#define CACHEID_RESTRICT 0x1
|
49
|
+
#define CACHEID_SATCOU 0x2
|
50
|
+
#define CACHEID_SATCOULN 0x3
|
51
|
+
#define CACHEID_PATHCOU 0x4
|
52
|
+
|
53
|
+
/* Hash value modifiers for replace/compose */
|
54
|
+
#define CACHEID_REPLACE 0x0
|
55
|
+
#define CACHEID_COMPOSE 0x1
|
56
|
+
#define CACHEID_VECCOMPOSE 0x2
|
57
|
+
|
58
|
+
/* Hash value modifiers for quantification */
|
59
|
+
#define CACHEID_EXIST 0x0
|
60
|
+
#define CACHEID_FORALL 0x1
|
61
|
+
#define CACHEID_UNIQUE 0x2
|
62
|
+
#define CACHEID_APPEX 0x3
|
63
|
+
#define CACHEID_APPAL 0x4
|
64
|
+
#define CACHEID_APPUN 0x5
|
65
|
+
|
66
|
+
|
67
|
+
/* Number of boolean operators */
|
68
|
+
#define OPERATOR_NUM 11
|
69
|
+
|
70
|
+
/* Operator results - entry = left<<1 | right (left,right in {0,1}) */
|
71
|
+
static int oprres[OPERATOR_NUM][4] =
|
72
|
+
{ {0,0,0,1}, /* and ( & ) */
|
73
|
+
{0,1,1,0}, /* xor ( ^ ) */
|
74
|
+
{0,1,1,1}, /* or ( | ) */
|
75
|
+
{1,1,1,0}, /* nand */
|
76
|
+
{1,0,0,0}, /* nor */
|
77
|
+
{1,1,0,1}, /* implication ( >> ) */
|
78
|
+
{1,0,0,1}, /* bi-implication */
|
79
|
+
{0,0,1,0}, /* difference /greater than ( - ) ( > ) */
|
80
|
+
{0,1,0,0}, /* less than ( < ) */
|
81
|
+
{1,0,1,1}, /* inverse implication ( << ) */
|
82
|
+
{1,1,0,0} /* not ( ! ) */
|
83
|
+
};
|
84
|
+
|
85
|
+
|
86
|
+
/* Variables needed for the operators */
|
87
|
+
static int applyop; /* Current operator for apply */
|
88
|
+
static int appexop; /* Current operator for appex */
|
89
|
+
static int appexid; /* Current cache id for appex */
|
90
|
+
static int quantid; /* Current cache id for quantifications */
|
91
|
+
static int *quantvarset; /* Current variable set for quant. */
|
92
|
+
static int quantvarsetID; /* Current id used in quantvarset */
|
93
|
+
static int quantlast; /* Current last variable to be quant. */
|
94
|
+
static int replaceid; /* Current cache id for replace */
|
95
|
+
static int *replacepair; /* Current replace pair */
|
96
|
+
static int replacelast; /* Current last var. level to replace */
|
97
|
+
static int composelevel; /* Current variable used for compose */
|
98
|
+
static int miscid; /* Current cache id for other results */
|
99
|
+
static int *varprofile; /* Current variable profile */
|
100
|
+
static int supportID; /* Current ID (true value) for support */
|
101
|
+
static int supportMin; /* Min. used level in support calc. */
|
102
|
+
static int supportMax; /* Max. used level in support calc. */
|
103
|
+
static int* supportSet; /* The found support set */
|
104
|
+
static BddCache applycache; /* Cache for apply results */
|
105
|
+
static BddCache itecache; /* Cache for ITE results */
|
106
|
+
static BddCache quantcache; /* Cache for exist/forall results */
|
107
|
+
static BddCache appexcache; /* Cache for appex/appall results */
|
108
|
+
static BddCache replacecache; /* Cache for replace results */
|
109
|
+
static BddCache misccache; /* Cache for other results */
|
110
|
+
static int cacheratio;
|
111
|
+
static BDD satPolarity;
|
112
|
+
static int firstReorder; /* Used instead of local variable in order
|
113
|
+
to avoid compiler warning about 'first'
|
114
|
+
being clobbered by setjmp */
|
115
|
+
static BDD bddParam; /* Used instead of local variable in order
|
116
|
+
to avoid compiler warning about 'r'
|
117
|
+
being clobbered by setjmp */
|
118
|
+
|
119
|
+
static char* allsatProfile; /* Variable profile for bdd_allsat() */
|
120
|
+
static bddallsathandler allsatHandler; /* Callback handler for bdd_allsat() */
|
121
|
+
|
122
|
+
extern bddCacheStat bddcachestats;
|
123
|
+
|
124
|
+
/* Internal prototypes */
|
125
|
+
static BDD not_rec(BDD);
|
126
|
+
static BDD apply_rec(BDD, BDD);
|
127
|
+
static BDD ite_rec(BDD, BDD, BDD);
|
128
|
+
static int simplify_rec(BDD, BDD);
|
129
|
+
static int quant_rec(int);
|
130
|
+
static int appquant_rec(int, int);
|
131
|
+
static int restrict_rec(int);
|
132
|
+
static BDD constrain_rec(BDD, BDD);
|
133
|
+
static BDD replace_rec(BDD);
|
134
|
+
static BDD bdd_correctify(int, BDD, BDD);
|
135
|
+
static BDD compose_rec(BDD, BDD);
|
136
|
+
static BDD veccompose_rec(BDD);
|
137
|
+
static void support_rec(int, int*);
|
138
|
+
static BDD satone_rec(BDD);
|
139
|
+
static BDD satoneset_rec(BDD, BDD);
|
140
|
+
static int fullsatone_rec(int);
|
141
|
+
static void allsat_rec(BDD r);
|
142
|
+
static double satcount_rec(int);
|
143
|
+
static double satcountln_rec(int);
|
144
|
+
static void varprofile_rec(int);
|
145
|
+
static double bdd_pathcount_rec(BDD);
|
146
|
+
static int varset2vartable(BDD);
|
147
|
+
static int varset2svartable(BDD);
|
148
|
+
|
149
|
+
|
150
|
+
/* Hashvalues */
|
151
|
+
#define NOTHASH(r) (r)
|
152
|
+
#define APPLYHASH(l,r,op) (TRIPLE(l,r,op))
|
153
|
+
#define ITEHASH(f,g,h) (TRIPLE(f,g,h))
|
154
|
+
#define RESTRHASH(r,var) (PAIR(r,var))
|
155
|
+
#define CONSTRAINHASH(f,c) (PAIR(f,c))
|
156
|
+
#define QUANTHASH(r) (r)
|
157
|
+
#define REPLACEHASH(r) (r)
|
158
|
+
#define VECCOMPOSEHASH(f) (f)
|
159
|
+
#define COMPOSEHASH(f,g) (PAIR(f,g))
|
160
|
+
#define SATCOUHASH(r) (r)
|
161
|
+
#define PATHCOUHASH(r) (r)
|
162
|
+
#define APPEXHASH(l,r,op) (PAIR(l,r))
|
163
|
+
|
164
|
+
#ifndef M_LN2
|
165
|
+
#define M_LN2 0.69314718055994530942
|
166
|
+
#endif
|
167
|
+
|
168
|
+
#define log1p(a) (log(1.0+a))
|
169
|
+
|
170
|
+
#define INVARSET(a) (quantvarset[a] == quantvarsetID) /* unsigned check */
|
171
|
+
#define INSVARSET(a) (abs(quantvarset[a]) == quantvarsetID) /* signed check */
|
172
|
+
|
173
|
+
/*************************************************************************
|
174
|
+
Setup and shutdown
|
175
|
+
*************************************************************************/
|
176
|
+
|
177
|
+
int bdd_operator_init(int cachesize)
|
178
|
+
{
|
179
|
+
if (BddCache_init(&applycache,cachesize) < 0)
|
180
|
+
return bdd_error(BDD_MEMORY);
|
181
|
+
if (BddCache_init(&itecache,cachesize) < 0)
|
182
|
+
return bdd_error(BDD_MEMORY);
|
183
|
+
if (BddCache_init(&quantcache,cachesize) < 0)
|
184
|
+
return bdd_error(BDD_MEMORY);
|
185
|
+
if (BddCache_init(&appexcache,cachesize) < 0)
|
186
|
+
return bdd_error(BDD_MEMORY);
|
187
|
+
if (BddCache_init(&replacecache,cachesize) < 0)
|
188
|
+
return bdd_error(BDD_MEMORY);
|
189
|
+
if (BddCache_init(&misccache,cachesize) < 0)
|
190
|
+
return bdd_error(BDD_MEMORY);
|
191
|
+
quantvarsetID = 0;
|
192
|
+
quantvarset = NULL;
|
193
|
+
cacheratio = 0;
|
194
|
+
supportSet = NULL;
|
195
|
+
return 0;
|
196
|
+
}
|
197
|
+
|
198
|
+
|
199
|
+
void bdd_operator_done(void)
|
200
|
+
{
|
201
|
+
if (quantvarset != NULL)
|
202
|
+
free(quantvarset);
|
203
|
+
|
204
|
+
BddCache_done(&applycache);
|
205
|
+
BddCache_done(&itecache);
|
206
|
+
BddCache_done(&quantcache);
|
207
|
+
BddCache_done(&appexcache);
|
208
|
+
BddCache_done(&replacecache);
|
209
|
+
BddCache_done(&misccache);
|
210
|
+
|
211
|
+
if (supportSet != NULL)
|
212
|
+
free(supportSet);
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
void bdd_operator_reset(void)
|
217
|
+
{
|
218
|
+
BddCache_reset(&applycache);
|
219
|
+
BddCache_reset(&itecache);
|
220
|
+
BddCache_reset(&quantcache);
|
221
|
+
BddCache_reset(&appexcache);
|
222
|
+
BddCache_reset(&replacecache);
|
223
|
+
BddCache_reset(&misccache);
|
224
|
+
}
|
225
|
+
|
226
|
+
|
227
|
+
void bdd_operator_varresize(void)
|
228
|
+
{
|
229
|
+
if (quantvarset != NULL)
|
230
|
+
free(quantvarset);
|
231
|
+
|
232
|
+
if ((quantvarset=NEW(int,bddvarnum)) == NULL)
|
233
|
+
bdd_error(BDD_MEMORY);
|
234
|
+
|
235
|
+
memset(quantvarset, 0, sizeof(int)*bddvarnum);
|
236
|
+
quantvarsetID = 0;
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
static void bdd_operator_noderesize(void)
|
241
|
+
{
|
242
|
+
if (cacheratio > 0)
|
243
|
+
{
|
244
|
+
int newcachesize = bddnodesize / cacheratio;
|
245
|
+
|
246
|
+
BddCache_resize(&applycache, newcachesize);
|
247
|
+
BddCache_resize(&itecache, newcachesize);
|
248
|
+
BddCache_resize(&quantcache, newcachesize);
|
249
|
+
BddCache_resize(&appexcache, newcachesize);
|
250
|
+
BddCache_resize(&replacecache, newcachesize);
|
251
|
+
BddCache_resize(&misccache, newcachesize);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
/*************************************************************************
|
257
|
+
Other
|
258
|
+
*************************************************************************/
|
259
|
+
|
260
|
+
/*
|
261
|
+
NAME {* bdd\_setcacheratio *}
|
262
|
+
SECTION {* kernel *}
|
263
|
+
SHORT {* Sets the cache ratio for the operator caches *}
|
264
|
+
PROTO {* int bdd_setcacheratio(int r) *}
|
265
|
+
DESCR {* The ratio between the number of nodes in the nodetable
|
266
|
+
and the number of entries in the operator cachetables is called
|
267
|
+
the cache ratio. So a cache ratio of say, four, allocates one cache
|
268
|
+
entry for each four unique node entries. This value can be set with
|
269
|
+
{\tt bdd\_setcacheratio} to any positive value. When this is done
|
270
|
+
the caches are resized instantly to fit the new ratio.
|
271
|
+
The default is a fixed cache size determined at
|
272
|
+
initialization time. *}
|
273
|
+
RETURN {* The previous cache ratio or a negative number on error. *}
|
274
|
+
ALSO {* bdd\_init *}
|
275
|
+
*/
|
276
|
+
int bdd_setcacheratio(int r)
|
277
|
+
{
|
278
|
+
int old = cacheratio;
|
279
|
+
|
280
|
+
if (r <= 0)
|
281
|
+
return bdd_error(BDD_RANGE);
|
282
|
+
if (bddnodesize == 0)
|
283
|
+
return old;
|
284
|
+
|
285
|
+
cacheratio = r;
|
286
|
+
bdd_operator_noderesize();
|
287
|
+
return old;
|
288
|
+
}
|
289
|
+
|
290
|
+
|
291
|
+
/*************************************************************************
|
292
|
+
Operators
|
293
|
+
*************************************************************************/
|
294
|
+
|
295
|
+
static void checkresize(void)
|
296
|
+
{
|
297
|
+
if (bddresized)
|
298
|
+
bdd_operator_noderesize();
|
299
|
+
bddresized = 0;
|
300
|
+
}
|
301
|
+
|
302
|
+
|
303
|
+
/*=== BUILD A CUBE =====================================================*/
|
304
|
+
|
305
|
+
/*
|
306
|
+
NAME {* bdd\_buildcube *}
|
307
|
+
EXTRA {* bdd\_ibuildcube *}
|
308
|
+
SECTION {* operator *}
|
309
|
+
SHORT {* build a cube from an array of variables *}
|
310
|
+
PROTO {* BDD bdd_buildcube(int value, int width, BDD *var)
|
311
|
+
BDD bdd_ibuildcube(int value, int width, int *var)*}
|
312
|
+
DESCR {* This function builds a cube from the variables in {\tt
|
313
|
+
var}. It does so by interpreting the {\tt width} low order
|
314
|
+
bits of {\tt value} as a bit mask--a set bit indicates that the
|
315
|
+
variable should be added in it's positive form, and a cleared
|
316
|
+
bit the opposite. The most significant bits are encoded with
|
317
|
+
the first variables in {\tt var}. Consider as an example
|
318
|
+
the call {\tt bdd\_buildcube(0xB, 4, var)}. This corresponds
|
319
|
+
to the expression: $var[0] \conj \neg var[1] \conj var[2]
|
320
|
+
\conj var[3]$. The first version of the function takes an array
|
321
|
+
of BDDs, whereas the second takes an array of variable numbers
|
322
|
+
as used in {\tt bdd\_ithvar}. *}
|
323
|
+
RETURN {* The resulting cube *}
|
324
|
+
ALSO {* bdd\_ithvar, fdd\_ithvar *}
|
325
|
+
*/
|
326
|
+
BDD bdd_buildcube(int value, int width, BDD *variables)
|
327
|
+
{
|
328
|
+
BDD result = BDDONE;
|
329
|
+
int z;
|
330
|
+
|
331
|
+
for (z=0 ; z<width ; z++, value>>=1)
|
332
|
+
{
|
333
|
+
BDD tmp;
|
334
|
+
BDD v;
|
335
|
+
|
336
|
+
if (value & 0x1)
|
337
|
+
v = bdd_addref( variables[width-z-1] );
|
338
|
+
else
|
339
|
+
v = bdd_addref( bdd_not(variables[width-z-1]) );
|
340
|
+
|
341
|
+
bdd_addref(result);
|
342
|
+
tmp = bdd_apply(result,v,bddop_and);
|
343
|
+
bdd_delref(result);
|
344
|
+
bdd_delref(v);
|
345
|
+
|
346
|
+
result = tmp;
|
347
|
+
}
|
348
|
+
|
349
|
+
return result;
|
350
|
+
}
|
351
|
+
|
352
|
+
|
353
|
+
BDD bdd_ibuildcube(int value, int width, int *variables)
|
354
|
+
{
|
355
|
+
BDD result = BDDONE;
|
356
|
+
int z;
|
357
|
+
|
358
|
+
for (z=0 ; z<width ; z++, value>>=1)
|
359
|
+
{
|
360
|
+
BDD tmp;
|
361
|
+
BDD v;
|
362
|
+
|
363
|
+
if (value & 0x1)
|
364
|
+
v = bdd_ithvar(variables[width-z-1]);
|
365
|
+
else
|
366
|
+
v = bdd_nithvar(variables[width-z-1]);
|
367
|
+
|
368
|
+
bdd_addref(result);
|
369
|
+
tmp = bdd_apply(result,v,bddop_and);
|
370
|
+
bdd_delref(result);
|
371
|
+
|
372
|
+
result = tmp;
|
373
|
+
}
|
374
|
+
|
375
|
+
return result;
|
376
|
+
}
|
377
|
+
|
378
|
+
|
379
|
+
/*=== NOT ==============================================================*/
|
380
|
+
|
381
|
+
/*
|
382
|
+
NAME {* bdd\_not *}
|
383
|
+
SECTION {* operator *}
|
384
|
+
SHORT {* negates a bdd *}
|
385
|
+
PROTO {* BDD bdd_not(BDD r) *}
|
386
|
+
DESCR {* Negates the BDD {\tt r} by exchanging
|
387
|
+
all references to the zero-terminal with references to the
|
388
|
+
one-terminal and vice versa. *}
|
389
|
+
RETURN {* The negated bdd. *}
|
390
|
+
*/
|
391
|
+
BDD bdd_not(BDD r)
|
392
|
+
{
|
393
|
+
BDD res;
|
394
|
+
firstReorder = 1;
|
395
|
+
CHECKa(r, bddfalse);
|
396
|
+
|
397
|
+
again:
|
398
|
+
if (setjmp(bddexception) == 0)
|
399
|
+
{
|
400
|
+
INITREF;
|
401
|
+
|
402
|
+
if (!firstReorder)
|
403
|
+
bdd_disable_reorder();
|
404
|
+
res = not_rec(r);
|
405
|
+
if (!firstReorder)
|
406
|
+
bdd_enable_reorder();
|
407
|
+
}
|
408
|
+
else
|
409
|
+
{
|
410
|
+
bdd_checkreorder();
|
411
|
+
if (firstReorder-- == 1)
|
412
|
+
goto again;
|
413
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
414
|
+
}
|
415
|
+
|
416
|
+
checkresize();
|
417
|
+
return res;
|
418
|
+
}
|
419
|
+
|
420
|
+
|
421
|
+
static BDD not_rec(BDD r)
|
422
|
+
{
|
423
|
+
BddCacheData *entry;
|
424
|
+
BDD res;
|
425
|
+
|
426
|
+
if (ISZERO(r))
|
427
|
+
return BDDONE;
|
428
|
+
if (ISONE(r))
|
429
|
+
return BDDZERO;
|
430
|
+
|
431
|
+
entry = BddCache_lookup(&applycache, NOTHASH(r));
|
432
|
+
|
433
|
+
if (entry->a == r && entry->c == bddop_not)
|
434
|
+
{
|
435
|
+
#ifdef CACHESTATS
|
436
|
+
bddcachestats.opHit++;
|
437
|
+
#endif
|
438
|
+
return entry->r.res;
|
439
|
+
}
|
440
|
+
#ifdef CACHESTATS
|
441
|
+
bddcachestats.opMiss++;
|
442
|
+
#endif
|
443
|
+
|
444
|
+
PUSHREF( not_rec(LOW(r)) );
|
445
|
+
PUSHREF( not_rec(HIGH(r)) );
|
446
|
+
res = bdd_makenode(LEVEL(r), READREF(2), READREF(1));
|
447
|
+
POPREF(2);
|
448
|
+
|
449
|
+
entry->a = r;
|
450
|
+
entry->c = bddop_not;
|
451
|
+
entry->r.res = res;
|
452
|
+
|
453
|
+
return res;
|
454
|
+
}
|
455
|
+
|
456
|
+
|
457
|
+
/*=== APPLY ============================================================*/
|
458
|
+
|
459
|
+
/*
|
460
|
+
NAME {* bdd\_apply *}
|
461
|
+
SECTION {* operator *}
|
462
|
+
SHORT {* basic bdd operations *}
|
463
|
+
PROTO {* BDD bdd_apply(BDD left, BDD right, int opr) *}
|
464
|
+
DESCR {* The {\tt bdd\_apply} function performs all of the basic
|
465
|
+
bdd operations with two operands, such as AND, OR etc.
|
466
|
+
The {\tt left} argument is the left bdd operand and {\tt right}
|
467
|
+
is the right operand. The {\tt opr} argument is the requested
|
468
|
+
operation and must be one of the following\\
|
469
|
+
|
470
|
+
\begin{tabular}{lllc}
|
471
|
+
{\bf Identifier} & {\bf Description} & {\bf Truth table}
|
472
|
+
& {\bf C++ opr.} \\
|
473
|
+
{\tt bddop\_and} & logical and ($A \wedge B$) & [0,0,0,1]
|
474
|
+
& \verb%&% \\
|
475
|
+
{\tt bddop\_xor} & logical xor ($A \oplus B$) & [0,1,1,0]
|
476
|
+
& \verb%^% \\
|
477
|
+
{\tt bddop\_or} & logical or ($A \vee B$) & [0,1,1,1]
|
478
|
+
& \verb%|% \\
|
479
|
+
{\tt bddop\_nand} & logical not-and & [1,1,1,0] \\
|
480
|
+
{\tt bddop\_nor} & logical not-or & [1,0,0,0] \\
|
481
|
+
{\tt bddop\_imp} & implication ($A \Rightarrow B$) & [1,1,0,1]
|
482
|
+
& \verb%>>% \\
|
483
|
+
{\tt bddop\_biimp} & bi-implication ($A \Leftrightarrow B$)& [1,0,0,1] \\
|
484
|
+
{\tt bddop\_diff} & set difference ($A \setminus B$) & [0,0,1,0]
|
485
|
+
& \verb%-% \\
|
486
|
+
{\tt bddop\_less} & less than ($A < B$) & [0,1,0,0]
|
487
|
+
& \verb%<% \\
|
488
|
+
{\tt bddop\_invimp} & reverse implication ($A \Leftarrow B$)& [1,0,1,1]
|
489
|
+
& \verb%<<% \\
|
490
|
+
\end{tabular}
|
491
|
+
*}
|
492
|
+
RETURN {* The result of the operation. *}
|
493
|
+
ALSO {* bdd\_ite *}
|
494
|
+
*/
|
495
|
+
BDD bdd_apply(BDD l, BDD r, int op)
|
496
|
+
{
|
497
|
+
BDD res;
|
498
|
+
firstReorder = 1;
|
499
|
+
|
500
|
+
CHECKa(l, bddfalse);
|
501
|
+
CHECKa(r, bddfalse);
|
502
|
+
|
503
|
+
if (op<0 || op>bddop_invimp)
|
504
|
+
{
|
505
|
+
bdd_error(BDD_OP);
|
506
|
+
return bddfalse;
|
507
|
+
}
|
508
|
+
|
509
|
+
again:
|
510
|
+
if (setjmp(bddexception) == 0)
|
511
|
+
{
|
512
|
+
INITREF;
|
513
|
+
applyop = op;
|
514
|
+
|
515
|
+
if (!firstReorder)
|
516
|
+
bdd_disable_reorder();
|
517
|
+
res = apply_rec(l, r);
|
518
|
+
if (!firstReorder)
|
519
|
+
bdd_enable_reorder();
|
520
|
+
}
|
521
|
+
else
|
522
|
+
{
|
523
|
+
bdd_checkreorder();
|
524
|
+
|
525
|
+
if (firstReorder-- == 1)
|
526
|
+
goto again;
|
527
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
528
|
+
}
|
529
|
+
|
530
|
+
checkresize();
|
531
|
+
return res;
|
532
|
+
}
|
533
|
+
|
534
|
+
|
535
|
+
static BDD apply_rec(BDD l, BDD r)
|
536
|
+
{
|
537
|
+
BddCacheData *entry;
|
538
|
+
BDD res;
|
539
|
+
|
540
|
+
switch (applyop)
|
541
|
+
{
|
542
|
+
case bddop_and:
|
543
|
+
if (l == r)
|
544
|
+
return l;
|
545
|
+
if (ISZERO(l) || ISZERO(r))
|
546
|
+
return 0;
|
547
|
+
if (ISONE(l))
|
548
|
+
return r;
|
549
|
+
if (ISONE(r))
|
550
|
+
return l;
|
551
|
+
break;
|
552
|
+
case bddop_or:
|
553
|
+
if (l == r)
|
554
|
+
return l;
|
555
|
+
if (ISONE(l) || ISONE(r))
|
556
|
+
return 1;
|
557
|
+
if (ISZERO(l))
|
558
|
+
return r;
|
559
|
+
if (ISZERO(r))
|
560
|
+
return l;
|
561
|
+
break;
|
562
|
+
case bddop_xor:
|
563
|
+
if (l == r)
|
564
|
+
return 0;
|
565
|
+
if (ISZERO(l))
|
566
|
+
return r;
|
567
|
+
if (ISZERO(r))
|
568
|
+
return l;
|
569
|
+
break;
|
570
|
+
case bddop_nand:
|
571
|
+
if (ISZERO(l) || ISZERO(r))
|
572
|
+
return 1;
|
573
|
+
break;
|
574
|
+
case bddop_nor:
|
575
|
+
if (ISONE(l) || ISONE(r))
|
576
|
+
return 0;
|
577
|
+
break;
|
578
|
+
case bddop_imp:
|
579
|
+
if (ISZERO(l))
|
580
|
+
return 1;
|
581
|
+
if (ISONE(l))
|
582
|
+
return r;
|
583
|
+
if (ISONE(r))
|
584
|
+
return 1;
|
585
|
+
break;
|
586
|
+
}
|
587
|
+
|
588
|
+
if (ISCONST(l) && ISCONST(r))
|
589
|
+
res = oprres[applyop][l<<1 | r];
|
590
|
+
else
|
591
|
+
{
|
592
|
+
entry = BddCache_lookup(&applycache, APPLYHASH(l,r,applyop));
|
593
|
+
|
594
|
+
if (entry->a == l && entry->b == r && entry->c == applyop)
|
595
|
+
{
|
596
|
+
#ifdef CACHESTATS
|
597
|
+
bddcachestats.opHit++;
|
598
|
+
#endif
|
599
|
+
return entry->r.res;
|
600
|
+
}
|
601
|
+
#ifdef CACHESTATS
|
602
|
+
bddcachestats.opMiss++;
|
603
|
+
#endif
|
604
|
+
|
605
|
+
if (LEVEL(l) == LEVEL(r))
|
606
|
+
{
|
607
|
+
PUSHREF( apply_rec(LOW(l), LOW(r)) );
|
608
|
+
PUSHREF( apply_rec(HIGH(l), HIGH(r)) );
|
609
|
+
res = bdd_makenode(LEVEL(l), READREF(2), READREF(1));
|
610
|
+
}
|
611
|
+
else
|
612
|
+
if (LEVEL(l) < LEVEL(r))
|
613
|
+
{
|
614
|
+
PUSHREF( apply_rec(LOW(l), r) );
|
615
|
+
PUSHREF( apply_rec(HIGH(l), r) );
|
616
|
+
res = bdd_makenode(LEVEL(l), READREF(2), READREF(1));
|
617
|
+
}
|
618
|
+
else
|
619
|
+
{
|
620
|
+
PUSHREF( apply_rec(l, LOW(r)) );
|
621
|
+
PUSHREF( apply_rec(l, HIGH(r)) );
|
622
|
+
res = bdd_makenode(LEVEL(r), READREF(2), READREF(1));
|
623
|
+
}
|
624
|
+
|
625
|
+
POPREF(2);
|
626
|
+
|
627
|
+
entry->a = l;
|
628
|
+
entry->b = r;
|
629
|
+
entry->c = applyop;
|
630
|
+
entry->r.res = res;
|
631
|
+
}
|
632
|
+
|
633
|
+
return res;
|
634
|
+
}
|
635
|
+
|
636
|
+
|
637
|
+
/*
|
638
|
+
NAME {* bdd\_and *}
|
639
|
+
SECTION {* operator *}
|
640
|
+
SHORT {* The logical 'and' of two BDDs *}
|
641
|
+
PROTO {* BDD bdd_and(BDD l, BDD r) *}
|
642
|
+
DESCR {* This a wrapper that calls {\tt bdd\_apply(l,r,bddop\_and)}. *}
|
643
|
+
RETURN {* The logical 'and' of {\tt l} and {\tt r}. *}
|
644
|
+
ALSO {* bdd\_apply, bdd\_or, bdd\_xor *}
|
645
|
+
*/
|
646
|
+
BDD bdd_and(BDD l, BDD r)
|
647
|
+
{
|
648
|
+
return bdd_apply(l,r,bddop_and);
|
649
|
+
}
|
650
|
+
|
651
|
+
|
652
|
+
/*
|
653
|
+
NAME {* bdd\_or *}
|
654
|
+
SECTION {* operator *}
|
655
|
+
SHORT {* The logical 'or' of two BDDs *}
|
656
|
+
PROTO {* BDD bdd_or(BDD l, BDD r) *}
|
657
|
+
DESCR {* This a wrapper that calls {\tt bdd\_apply(l,r,bddop\_or)}. *}
|
658
|
+
RETURN {* The logical 'or' of {\tt l} and {\tt r}. *}
|
659
|
+
ALSO {* bdd\_apply, bdd\_xor, bdd\_and *}
|
660
|
+
*/
|
661
|
+
BDD bdd_or(BDD l, BDD r)
|
662
|
+
{
|
663
|
+
return bdd_apply(l,r,bddop_or);
|
664
|
+
}
|
665
|
+
|
666
|
+
|
667
|
+
/*
|
668
|
+
NAME {* bdd\_xor *}
|
669
|
+
SECTION {* operator *}
|
670
|
+
SHORT {* The logical 'xor' of two BDDs *}
|
671
|
+
PROTO {* BDD bdd_xor(BDD l, BDD r) *}
|
672
|
+
DESCR {* This a wrapper that calls {\tt bdd\_apply(l,r,bddop\_xor)}. *}
|
673
|
+
RETURN {* The logical 'xor' of {\tt l} and {\tt r}. *}
|
674
|
+
ALSO {* bdd\_apply, bdd\_or, bdd\_and *}
|
675
|
+
*/
|
676
|
+
BDD bdd_xor(BDD l, BDD r)
|
677
|
+
{
|
678
|
+
return bdd_apply(l,r,bddop_xor);
|
679
|
+
}
|
680
|
+
|
681
|
+
|
682
|
+
/*
|
683
|
+
NAME {* bdd\_imp *}
|
684
|
+
SECTION {* operator *}
|
685
|
+
SHORT {* The logical 'implication' between two BDDs *}
|
686
|
+
PROTO {* BDD bdd_imp(BDD l, BDD r) *}
|
687
|
+
DESCR {* This a wrapper that calls {\tt bdd\_apply(l,r,bddop\_imp)}. *}
|
688
|
+
RETURN {* The logical 'implication' of {\tt l} and {\tt r} ($l \Rightarrow r$). *}
|
689
|
+
ALSO {* bdd\_apply, bdd\_biimp *}
|
690
|
+
*/
|
691
|
+
BDD bdd_imp(BDD l, BDD r)
|
692
|
+
{
|
693
|
+
return bdd_apply(l,r,bddop_imp);
|
694
|
+
}
|
695
|
+
|
696
|
+
|
697
|
+
/*
|
698
|
+
NAME {* bdd\_biimp *}
|
699
|
+
SECTION {* operator *}
|
700
|
+
SHORT {* The logical 'bi-implication' between two BDDs *}
|
701
|
+
PROTO {* BDD bdd_biimp(BDD l, BDD r) *}
|
702
|
+
DESCR {* This a wrapper that calls {\tt bdd\_apply(l,r,bddop\_biimp)}. *}
|
703
|
+
RETURN {* The logical 'bi-implication' of {\tt l} and {\tt r} ($l \Leftrightarrow r$). *}
|
704
|
+
ALSO {* bdd\_apply, bdd\_imp *}
|
705
|
+
*/
|
706
|
+
BDD bdd_biimp(BDD l, BDD r)
|
707
|
+
{
|
708
|
+
return bdd_apply(l,r,bddop_biimp);
|
709
|
+
}
|
710
|
+
|
711
|
+
|
712
|
+
/*=== ITE ==============================================================*/
|
713
|
+
|
714
|
+
/*
|
715
|
+
NAME {* bdd\_ite *}
|
716
|
+
SECTION {* operator *}
|
717
|
+
SHORT {* if-then-else operator *}
|
718
|
+
PROTO {* BDD bdd_ite(BDD f, BDD g, BDD h) *}
|
719
|
+
DESCR {* Calculates the BDD for the expression
|
720
|
+
$(f \conj g) \disj (\neg f \conj h)$ more efficiently than doing
|
721
|
+
the three operations separately. {\tt bdd\_ite} can also be used
|
722
|
+
for conjunction, disjunction and any other boolean operator, but
|
723
|
+
is not as efficient for the binary and unary operations. *}
|
724
|
+
RETURN {* The BDD for $(f \conj g) \disj (\neg f \conj h)$ *}
|
725
|
+
ALSO {* bdd\_apply *}
|
726
|
+
*/
|
727
|
+
BDD bdd_ite(BDD f, BDD g, BDD h)
|
728
|
+
{
|
729
|
+
BDD res;
|
730
|
+
firstReorder = 1;
|
731
|
+
|
732
|
+
CHECKa(f, bddfalse);
|
733
|
+
CHECKa(g, bddfalse);
|
734
|
+
CHECKa(h, bddfalse);
|
735
|
+
|
736
|
+
again:
|
737
|
+
if (setjmp(bddexception) == 0)
|
738
|
+
{
|
739
|
+
INITREF;
|
740
|
+
|
741
|
+
if (!firstReorder)
|
742
|
+
bdd_disable_reorder();
|
743
|
+
res = ite_rec(f,g,h);
|
744
|
+
if (!firstReorder)
|
745
|
+
bdd_enable_reorder();
|
746
|
+
}
|
747
|
+
else
|
748
|
+
{
|
749
|
+
bdd_checkreorder();
|
750
|
+
|
751
|
+
if (firstReorder-- == 1)
|
752
|
+
goto again;
|
753
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
754
|
+
}
|
755
|
+
|
756
|
+
checkresize();
|
757
|
+
return res;
|
758
|
+
}
|
759
|
+
|
760
|
+
|
761
|
+
static BDD ite_rec(BDD f, BDD g, BDD h)
|
762
|
+
{
|
763
|
+
BddCacheData *entry;
|
764
|
+
BDD res;
|
765
|
+
|
766
|
+
if (ISONE(f))
|
767
|
+
return g;
|
768
|
+
if (ISZERO(f))
|
769
|
+
return h;
|
770
|
+
if (g == h)
|
771
|
+
return g;
|
772
|
+
if (ISONE(g) && ISZERO(h))
|
773
|
+
return f;
|
774
|
+
if (ISZERO(g) && ISONE(h))
|
775
|
+
return not_rec(f);
|
776
|
+
|
777
|
+
entry = BddCache_lookup(&itecache, ITEHASH(f,g,h));
|
778
|
+
if (entry->a == f && entry->b == g && entry->c == h)
|
779
|
+
{
|
780
|
+
#ifdef CACHESTATS
|
781
|
+
bddcachestats.opHit++;
|
782
|
+
#endif
|
783
|
+
return entry->r.res;
|
784
|
+
}
|
785
|
+
#ifdef CACHESTATS
|
786
|
+
bddcachestats.opMiss++;
|
787
|
+
#endif
|
788
|
+
|
789
|
+
if (LEVEL(f) == LEVEL(g))
|
790
|
+
{
|
791
|
+
if (LEVEL(f) == LEVEL(h))
|
792
|
+
{
|
793
|
+
PUSHREF( ite_rec(LOW(f), LOW(g), LOW(h)) );
|
794
|
+
PUSHREF( ite_rec(HIGH(f), HIGH(g), HIGH(h)) );
|
795
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
796
|
+
}
|
797
|
+
else
|
798
|
+
if (LEVEL(f) < LEVEL(h))
|
799
|
+
{
|
800
|
+
PUSHREF( ite_rec(LOW(f), LOW(g), h) );
|
801
|
+
PUSHREF( ite_rec(HIGH(f), HIGH(g), h) );
|
802
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
803
|
+
}
|
804
|
+
else /* f > h */
|
805
|
+
{
|
806
|
+
PUSHREF( ite_rec(f, g, LOW(h)) );
|
807
|
+
PUSHREF( ite_rec(f, g, HIGH(h)) );
|
808
|
+
res = bdd_makenode(LEVEL(h), READREF(2), READREF(1));
|
809
|
+
}
|
810
|
+
}
|
811
|
+
else
|
812
|
+
if (LEVEL(f) < LEVEL(g))
|
813
|
+
{
|
814
|
+
if (LEVEL(f) == LEVEL(h))
|
815
|
+
{
|
816
|
+
PUSHREF( ite_rec(LOW(f), g, LOW(h)) );
|
817
|
+
PUSHREF( ite_rec(HIGH(f), g, HIGH(h)) );
|
818
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
819
|
+
}
|
820
|
+
else
|
821
|
+
if (LEVEL(f) < LEVEL(h))
|
822
|
+
{
|
823
|
+
PUSHREF( ite_rec(LOW(f), g, h) );
|
824
|
+
PUSHREF( ite_rec(HIGH(f), g, h) );
|
825
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
826
|
+
}
|
827
|
+
else /* f > h */
|
828
|
+
{
|
829
|
+
PUSHREF( ite_rec(f, g, LOW(h)) );
|
830
|
+
PUSHREF( ite_rec(f, g, HIGH(h)) );
|
831
|
+
res = bdd_makenode(LEVEL(h), READREF(2), READREF(1));
|
832
|
+
}
|
833
|
+
}
|
834
|
+
else /* f > g */
|
835
|
+
{
|
836
|
+
if (LEVEL(g) == LEVEL(h))
|
837
|
+
{
|
838
|
+
PUSHREF( ite_rec(f, LOW(g), LOW(h)) );
|
839
|
+
PUSHREF( ite_rec(f, HIGH(g), HIGH(h)) );
|
840
|
+
res = bdd_makenode(LEVEL(g), READREF(2), READREF(1));
|
841
|
+
}
|
842
|
+
else
|
843
|
+
if (LEVEL(g) < LEVEL(h))
|
844
|
+
{
|
845
|
+
PUSHREF( ite_rec(f, LOW(g), h) );
|
846
|
+
PUSHREF( ite_rec(f, HIGH(g), h) );
|
847
|
+
res = bdd_makenode(LEVEL(g), READREF(2), READREF(1));
|
848
|
+
}
|
849
|
+
else /* g > h */
|
850
|
+
{
|
851
|
+
PUSHREF( ite_rec(f, g, LOW(h)) );
|
852
|
+
PUSHREF( ite_rec(f, g, HIGH(h)) );
|
853
|
+
res = bdd_makenode(LEVEL(h), READREF(2), READREF(1));
|
854
|
+
}
|
855
|
+
}
|
856
|
+
|
857
|
+
POPREF(2);
|
858
|
+
|
859
|
+
entry->a = f;
|
860
|
+
entry->b = g;
|
861
|
+
entry->c = h;
|
862
|
+
entry->r.res = res;
|
863
|
+
|
864
|
+
return res;
|
865
|
+
}
|
866
|
+
|
867
|
+
|
868
|
+
/*=== RESTRICT =========================================================*/
|
869
|
+
|
870
|
+
/*
|
871
|
+
NAME {* bdd\_restrict *}
|
872
|
+
SECTION {* operator *}
|
873
|
+
SHORT {* restric a set of variables to constant values *}
|
874
|
+
PROTO {* BDD bdd_restrict(BDD r, BDD var) *}
|
875
|
+
DESCR {* This function restricts the variables in {\tt r} to constant
|
876
|
+
true or false. How this is done
|
877
|
+
depends on how the variables are included in the variable set
|
878
|
+
{\tt var}. If they
|
879
|
+
are included in their positive form then they are restricted to
|
880
|
+
true and vice versa. Unfortunately it is not possible to
|
881
|
+
insert variables in their negated form using {\tt bdd\_makeset},
|
882
|
+
so the variable set has to be build manually as a
|
883
|
+
conjunction of the variables. Example: Assume variable 1 should be
|
884
|
+
restricted to true and variable 3 to false.
|
885
|
+
\begin{verbatim}
|
886
|
+
bdd X = make_user_bdd();
|
887
|
+
bdd R1 = bdd_ithvar(1);
|
888
|
+
bdd R2 = bdd_nithvar(3);
|
889
|
+
bdd R = bdd_addref( bdd_apply(R1,R2, bddop_and) );
|
890
|
+
bdd RES = bdd_addref( bdd_restrict(X,R) );
|
891
|
+
\end{verbatim}
|
892
|
+
*}
|
893
|
+
RETURN {* The restricted bdd. *}
|
894
|
+
ALSO {* bdd\_makeset, bdd\_exist, bdd\_forall *}
|
895
|
+
*/
|
896
|
+
BDD bdd_restrict(BDD r, BDD var)
|
897
|
+
{
|
898
|
+
BDD res;
|
899
|
+
firstReorder = 1;
|
900
|
+
bddParam = r;
|
901
|
+
|
902
|
+
CHECKa(r,bddfalse);
|
903
|
+
CHECKa(var,bddfalse);
|
904
|
+
|
905
|
+
if (var < 2) /* Empty set */
|
906
|
+
return r;
|
907
|
+
|
908
|
+
again:
|
909
|
+
if (setjmp(bddexception) == 0)
|
910
|
+
{
|
911
|
+
if (varset2svartable(var) < 0)
|
912
|
+
return bddfalse;
|
913
|
+
|
914
|
+
INITREF;
|
915
|
+
miscid = (var << 3) | CACHEID_RESTRICT;
|
916
|
+
|
917
|
+
if (!firstReorder)
|
918
|
+
bdd_disable_reorder();
|
919
|
+
res = restrict_rec(bddParam);
|
920
|
+
if (!firstReorder)
|
921
|
+
bdd_enable_reorder();
|
922
|
+
}
|
923
|
+
else
|
924
|
+
{
|
925
|
+
bdd_checkreorder();
|
926
|
+
|
927
|
+
if (firstReorder-- == 1)
|
928
|
+
goto again;
|
929
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
930
|
+
}
|
931
|
+
|
932
|
+
checkresize();
|
933
|
+
return res;
|
934
|
+
}
|
935
|
+
|
936
|
+
|
937
|
+
static int restrict_rec(int r)
|
938
|
+
{
|
939
|
+
BddCacheData *entry;
|
940
|
+
int res;
|
941
|
+
|
942
|
+
if (ISCONST(r) || LEVEL(r) > quantlast)
|
943
|
+
return r;
|
944
|
+
|
945
|
+
entry = BddCache_lookup(&misccache, RESTRHASH(r,miscid));
|
946
|
+
if (entry->a == r && entry->c == miscid)
|
947
|
+
{
|
948
|
+
#ifdef CACHESTATS
|
949
|
+
bddcachestats.opHit++;
|
950
|
+
#endif
|
951
|
+
return entry->r.res;
|
952
|
+
}
|
953
|
+
#ifdef CACHESTATS
|
954
|
+
bddcachestats.opMiss++;
|
955
|
+
#endif
|
956
|
+
|
957
|
+
if (INSVARSET(LEVEL(r)))
|
958
|
+
{
|
959
|
+
if (quantvarset[LEVEL(r)] > 0)
|
960
|
+
res = restrict_rec(HIGH(r));
|
961
|
+
else
|
962
|
+
res = restrict_rec(LOW(r));
|
963
|
+
}
|
964
|
+
else
|
965
|
+
{
|
966
|
+
PUSHREF( restrict_rec(LOW(r)) );
|
967
|
+
PUSHREF( restrict_rec(HIGH(r)) );
|
968
|
+
res = bdd_makenode(LEVEL(r), READREF(2), READREF(1));
|
969
|
+
POPREF(2);
|
970
|
+
}
|
971
|
+
|
972
|
+
entry->a = r;
|
973
|
+
entry->c = miscid;
|
974
|
+
entry->r.res = res;
|
975
|
+
|
976
|
+
return res;
|
977
|
+
}
|
978
|
+
|
979
|
+
|
980
|
+
/*=== GENERALIZED COFACTOR =============================================*/
|
981
|
+
|
982
|
+
/*
|
983
|
+
NAME {* bdd\_constrain *}
|
984
|
+
SECTION {* operator *}
|
985
|
+
SHORT {* generalized cofactor *}
|
986
|
+
PROTO {* BDD bdd_constrain(BDD f, BDD c) *}
|
987
|
+
DESCR {* Computes the generalized cofactor of {\tt f} with respect to
|
988
|
+
{\tt c}. *}
|
989
|
+
RETURN {* The constrained BDD *}
|
990
|
+
ALSO {* bdd\_restrict, bdd\_simplify *}
|
991
|
+
*/
|
992
|
+
BDD bdd_constrain(BDD f, BDD c)
|
993
|
+
{
|
994
|
+
BDD res;
|
995
|
+
firstReorder = 1;
|
996
|
+
|
997
|
+
CHECKa(f,bddfalse);
|
998
|
+
CHECKa(c,bddfalse);
|
999
|
+
|
1000
|
+
again:
|
1001
|
+
if (setjmp(bddexception) == 0)
|
1002
|
+
{
|
1003
|
+
INITREF;
|
1004
|
+
miscid = CACHEID_CONSTRAIN;
|
1005
|
+
|
1006
|
+
if (!firstReorder)
|
1007
|
+
bdd_disable_reorder();
|
1008
|
+
res = constrain_rec(f, c);
|
1009
|
+
if (!firstReorder)
|
1010
|
+
bdd_enable_reorder();
|
1011
|
+
}
|
1012
|
+
else
|
1013
|
+
{
|
1014
|
+
bdd_checkreorder();
|
1015
|
+
|
1016
|
+
if (firstReorder-- == 1)
|
1017
|
+
goto again;
|
1018
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
checkresize();
|
1022
|
+
return res;
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
|
1026
|
+
static BDD constrain_rec(BDD f, BDD c)
|
1027
|
+
{
|
1028
|
+
BddCacheData *entry;
|
1029
|
+
BDD res;
|
1030
|
+
|
1031
|
+
if (ISONE(c))
|
1032
|
+
return f;
|
1033
|
+
if (ISCONST(f))
|
1034
|
+
return f;
|
1035
|
+
if (c == f)
|
1036
|
+
return BDDONE;
|
1037
|
+
if (ISZERO(c))
|
1038
|
+
return BDDZERO;
|
1039
|
+
|
1040
|
+
entry = BddCache_lookup(&misccache, CONSTRAINHASH(f,c));
|
1041
|
+
if (entry->a == f && entry->b == c && entry->c == miscid)
|
1042
|
+
{
|
1043
|
+
#ifdef CACHESTATS
|
1044
|
+
bddcachestats.opHit++;
|
1045
|
+
#endif
|
1046
|
+
return entry->r.res;
|
1047
|
+
}
|
1048
|
+
#ifdef CACHESTATS
|
1049
|
+
bddcachestats.opMiss++;
|
1050
|
+
#endif
|
1051
|
+
|
1052
|
+
if (LEVEL(f) == LEVEL(c))
|
1053
|
+
{
|
1054
|
+
if (ISZERO(LOW(c)))
|
1055
|
+
res = constrain_rec(HIGH(f), HIGH(c));
|
1056
|
+
else if (ISZERO(HIGH(c)))
|
1057
|
+
res = constrain_rec(LOW(f), LOW(c));
|
1058
|
+
else
|
1059
|
+
{
|
1060
|
+
PUSHREF( constrain_rec(LOW(f), LOW(c)) );
|
1061
|
+
PUSHREF( constrain_rec(HIGH(f), HIGH(c)) );
|
1062
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
1063
|
+
POPREF(2);
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
else
|
1067
|
+
if (LEVEL(f) < LEVEL(c))
|
1068
|
+
{
|
1069
|
+
PUSHREF( constrain_rec(LOW(f), c) );
|
1070
|
+
PUSHREF( constrain_rec(HIGH(f), c) );
|
1071
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
1072
|
+
POPREF(2);
|
1073
|
+
}
|
1074
|
+
else
|
1075
|
+
{
|
1076
|
+
if (ISZERO(LOW(c)))
|
1077
|
+
res = constrain_rec(f, HIGH(c));
|
1078
|
+
else if (ISZERO(HIGH(c)))
|
1079
|
+
res = constrain_rec(f, LOW(c));
|
1080
|
+
else
|
1081
|
+
{
|
1082
|
+
PUSHREF( constrain_rec(f, LOW(c)) );
|
1083
|
+
PUSHREF( constrain_rec(f, HIGH(c)) );
|
1084
|
+
res = bdd_makenode(LEVEL(c), READREF(2), READREF(1));
|
1085
|
+
POPREF(2);
|
1086
|
+
}
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
entry->a = f;
|
1090
|
+
entry->b = c;
|
1091
|
+
entry->c = miscid;
|
1092
|
+
entry->r.res = res;
|
1093
|
+
|
1094
|
+
return res;
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
|
1098
|
+
/*=== REPLACE ==========================================================*/
|
1099
|
+
|
1100
|
+
/*
|
1101
|
+
NAME {* bdd\_replace *}
|
1102
|
+
SECTION {* operator *}
|
1103
|
+
SHORT {* replaces variables with other variables *}
|
1104
|
+
PROTO {* BDD bdd_replace(BDD r, bddPair *pair) *}
|
1105
|
+
DESCR {* Replaces all variables in the BDD {\tt r} with the variables
|
1106
|
+
defined by {\tt pair}. Each entry in {\tt pair} consists of a
|
1107
|
+
old and a new variable. Whenever the old variable is found in
|
1108
|
+
{\tt r} then a new node with the new variable is inserted instead.
|
1109
|
+
*}
|
1110
|
+
ALSO {* bdd\_newpair, bdd\_setpair, bdd\_setpairs *}
|
1111
|
+
RETURN {* The result of the operation. *}
|
1112
|
+
*/
|
1113
|
+
BDD bdd_replace(BDD r, bddPair *pair)
|
1114
|
+
{
|
1115
|
+
BDD res;
|
1116
|
+
firstReorder = 1;
|
1117
|
+
|
1118
|
+
CHECKa(r, bddfalse);
|
1119
|
+
|
1120
|
+
again:
|
1121
|
+
if (setjmp(bddexception) == 0)
|
1122
|
+
{
|
1123
|
+
INITREF;
|
1124
|
+
replacepair = pair->result;
|
1125
|
+
replacelast = pair->last;
|
1126
|
+
replaceid = (pair->id << 2) | CACHEID_REPLACE;
|
1127
|
+
|
1128
|
+
if (!firstReorder)
|
1129
|
+
bdd_disable_reorder();
|
1130
|
+
res = replace_rec(r);
|
1131
|
+
if (!firstReorder)
|
1132
|
+
bdd_enable_reorder();
|
1133
|
+
}
|
1134
|
+
else
|
1135
|
+
{
|
1136
|
+
bdd_checkreorder();
|
1137
|
+
|
1138
|
+
if (firstReorder-- == 1)
|
1139
|
+
goto again;
|
1140
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
checkresize();
|
1144
|
+
return res;
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
|
1148
|
+
static BDD replace_rec(BDD r)
|
1149
|
+
{
|
1150
|
+
BddCacheData *entry;
|
1151
|
+
BDD res;
|
1152
|
+
|
1153
|
+
if (ISCONST(r) || LEVEL(r) > replacelast)
|
1154
|
+
return r;
|
1155
|
+
|
1156
|
+
entry = BddCache_lookup(&replacecache, REPLACEHASH(r));
|
1157
|
+
if (entry->a == r && entry->c == replaceid)
|
1158
|
+
{
|
1159
|
+
#ifdef CACHESTATS
|
1160
|
+
bddcachestats.opHit++;
|
1161
|
+
#endif
|
1162
|
+
return entry->r.res;
|
1163
|
+
}
|
1164
|
+
#ifdef CACHESTATS
|
1165
|
+
bddcachestats.opMiss++;
|
1166
|
+
#endif
|
1167
|
+
|
1168
|
+
PUSHREF( replace_rec(LOW(r)) );
|
1169
|
+
PUSHREF( replace_rec(HIGH(r)) );
|
1170
|
+
|
1171
|
+
res = bdd_correctify(LEVEL(replacepair[LEVEL(r)]), READREF(2), READREF(1));
|
1172
|
+
POPREF(2);
|
1173
|
+
|
1174
|
+
entry->a = r;
|
1175
|
+
entry->c = replaceid;
|
1176
|
+
entry->r.res = res;
|
1177
|
+
|
1178
|
+
return res;
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
|
1182
|
+
static BDD bdd_correctify(int level, BDD l, BDD r)
|
1183
|
+
{
|
1184
|
+
BDD res;
|
1185
|
+
|
1186
|
+
if (level < LEVEL(l) && level < LEVEL(r))
|
1187
|
+
return bdd_makenode(level, l, r);
|
1188
|
+
|
1189
|
+
if (level == LEVEL(l) || level == LEVEL(r))
|
1190
|
+
{
|
1191
|
+
bdd_error(BDD_REPLACE);
|
1192
|
+
return 0;
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
if (LEVEL(l) == LEVEL(r))
|
1196
|
+
{
|
1197
|
+
PUSHREF( bdd_correctify(level, LOW(l), LOW(r)) );
|
1198
|
+
PUSHREF( bdd_correctify(level, HIGH(l), HIGH(r)) );
|
1199
|
+
res = bdd_makenode(LEVEL(l), READREF(2), READREF(1));
|
1200
|
+
}
|
1201
|
+
else
|
1202
|
+
if (LEVEL(l) < LEVEL(r))
|
1203
|
+
{
|
1204
|
+
PUSHREF( bdd_correctify(level, LOW(l), r) );
|
1205
|
+
PUSHREF( bdd_correctify(level, HIGH(l), r) );
|
1206
|
+
res = bdd_makenode(LEVEL(l), READREF(2), READREF(1));
|
1207
|
+
}
|
1208
|
+
else
|
1209
|
+
{
|
1210
|
+
PUSHREF( bdd_correctify(level, l, LOW(r)) );
|
1211
|
+
PUSHREF( bdd_correctify(level, l, HIGH(r)) );
|
1212
|
+
res = bdd_makenode(LEVEL(r), READREF(2), READREF(1));
|
1213
|
+
}
|
1214
|
+
POPREF(2);
|
1215
|
+
|
1216
|
+
return res; /* FIXME: cache ? */
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
|
1220
|
+
/*=== COMPOSE ==========================================================*/
|
1221
|
+
|
1222
|
+
/*
|
1223
|
+
NAME {* bdd\_compose *}
|
1224
|
+
SECTION {* operator *}
|
1225
|
+
SHORT {* functional composition *}
|
1226
|
+
PROTO {* BDD bdd_compose(BDD f, BDD g, int var) *}
|
1227
|
+
DESCR {* Substitutes the variable {\tt var} with the BDD {\tt g} in
|
1228
|
+
the BDD {\tt f}: result $= f[g/var]$. *}
|
1229
|
+
RETURN {* The composed BDD *}
|
1230
|
+
ALSO {* bdd\_veccompose, bdd\_replace, bdd\_restrict *}
|
1231
|
+
*/
|
1232
|
+
BDD bdd_compose(BDD f, BDD g, int var)
|
1233
|
+
{
|
1234
|
+
BDD res;
|
1235
|
+
firstReorder = 1;
|
1236
|
+
|
1237
|
+
CHECKa(f, bddfalse);
|
1238
|
+
CHECKa(g, bddfalse);
|
1239
|
+
if (var < 0 || var >= bddvarnum)
|
1240
|
+
{
|
1241
|
+
bdd_error(BDD_VAR);
|
1242
|
+
return bddfalse;
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
again:
|
1246
|
+
if (setjmp(bddexception) == 0)
|
1247
|
+
{
|
1248
|
+
INITREF;
|
1249
|
+
composelevel = bddvar2level[var];
|
1250
|
+
replaceid = (composelevel << 2) | CACHEID_COMPOSE;
|
1251
|
+
|
1252
|
+
if (!firstReorder)
|
1253
|
+
bdd_disable_reorder();
|
1254
|
+
res = compose_rec(f, g);
|
1255
|
+
if (!firstReorder)
|
1256
|
+
bdd_enable_reorder();
|
1257
|
+
}
|
1258
|
+
else
|
1259
|
+
{
|
1260
|
+
bdd_checkreorder();
|
1261
|
+
|
1262
|
+
if (firstReorder-- == 1)
|
1263
|
+
goto again;
|
1264
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1265
|
+
}
|
1266
|
+
|
1267
|
+
checkresize();
|
1268
|
+
return res;
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
|
1272
|
+
static BDD compose_rec(BDD f, BDD g)
|
1273
|
+
{
|
1274
|
+
BddCacheData *entry;
|
1275
|
+
BDD res;
|
1276
|
+
|
1277
|
+
if (LEVEL(f) > composelevel)
|
1278
|
+
return f;
|
1279
|
+
|
1280
|
+
entry = BddCache_lookup(&replacecache, COMPOSEHASH(f,g));
|
1281
|
+
if (entry->a == f && entry->b == g && entry->c == replaceid)
|
1282
|
+
{
|
1283
|
+
#ifdef CACHESTATS
|
1284
|
+
bddcachestats.opHit++;
|
1285
|
+
#endif
|
1286
|
+
return entry->r.res;
|
1287
|
+
}
|
1288
|
+
#ifdef CACHESTATS
|
1289
|
+
bddcachestats.opMiss++;
|
1290
|
+
#endif
|
1291
|
+
|
1292
|
+
if (LEVEL(f) < composelevel)
|
1293
|
+
{
|
1294
|
+
if (LEVEL(f) == LEVEL(g))
|
1295
|
+
{
|
1296
|
+
PUSHREF( compose_rec(LOW(f), LOW(g)) );
|
1297
|
+
PUSHREF( compose_rec(HIGH(f), HIGH(g)) );
|
1298
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
1299
|
+
}
|
1300
|
+
else
|
1301
|
+
if (LEVEL(f) < LEVEL(g))
|
1302
|
+
{
|
1303
|
+
PUSHREF( compose_rec(LOW(f), g) );
|
1304
|
+
PUSHREF( compose_rec(HIGH(f), g) );
|
1305
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
1306
|
+
}
|
1307
|
+
else
|
1308
|
+
{
|
1309
|
+
PUSHREF( compose_rec(f, LOW(g)) );
|
1310
|
+
PUSHREF( compose_rec(f, HIGH(g)) );
|
1311
|
+
res = bdd_makenode(LEVEL(g), READREF(2), READREF(1));
|
1312
|
+
}
|
1313
|
+
POPREF(2);
|
1314
|
+
}
|
1315
|
+
else
|
1316
|
+
/*if (LEVEL(f) == composelevel) changed 2-nov-98 */
|
1317
|
+
{
|
1318
|
+
res = ite_rec(g, HIGH(f), LOW(f));
|
1319
|
+
}
|
1320
|
+
|
1321
|
+
entry->a = f;
|
1322
|
+
entry->b = g;
|
1323
|
+
entry->c = replaceid;
|
1324
|
+
entry->r.res = res;
|
1325
|
+
|
1326
|
+
return res;
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
|
1330
|
+
/*
|
1331
|
+
NAME {* bdd\_veccompose *}
|
1332
|
+
SECTION {* operator *}
|
1333
|
+
SHORT {* simultaneous functional composition *}
|
1334
|
+
PROTO {* BDD bdd_veccompose(BDD f, bddPair *pair) *}
|
1335
|
+
DESCR {* Uses the pairs of variables and BDDs in {\tt pair} to make
|
1336
|
+
the simultaneous substitution: $f[g_1/V_1, \ldots, g_n/V_n]$.
|
1337
|
+
In this way one or more BDDs
|
1338
|
+
may be substituted in one step. The BDDs in
|
1339
|
+
{\tt pair} may depend on the variables they are substituting.
|
1340
|
+
{\tt bdd\_compose} may be used instead of
|
1341
|
+
{\tt bdd\_replace} but is not as efficient when $g_i$ is a
|
1342
|
+
single variable, the same applies to {\tt bdd\_restrict}.
|
1343
|
+
Note that simultaneous substitution is not necessarily the same
|
1344
|
+
as repeated substitution. Example:
|
1345
|
+
$(x_1 \disj x_2)[x_3/x_1,x_4/x_3] = (x_3 \disj x_2) \neq
|
1346
|
+
((x_1 \disj x_2)[x_3/x_1])[x_4/x_3] = (x_4 \disj x_2)$. *}
|
1347
|
+
RETURN {* The composed BDD *}
|
1348
|
+
ALSO {* bdd\_compose, bdd\_replace, bdd\_restrict *}
|
1349
|
+
*/
|
1350
|
+
BDD bdd_veccompose(BDD f, bddPair *pair)
|
1351
|
+
{
|
1352
|
+
BDD res;
|
1353
|
+
firstReorder = 1;
|
1354
|
+
|
1355
|
+
CHECKa(f, bddfalse);
|
1356
|
+
|
1357
|
+
again:
|
1358
|
+
if (setjmp(bddexception) == 0)
|
1359
|
+
{
|
1360
|
+
INITREF;
|
1361
|
+
replacepair = pair->result;
|
1362
|
+
replaceid = (pair->id << 2) | CACHEID_VECCOMPOSE;
|
1363
|
+
replacelast = pair->last;
|
1364
|
+
|
1365
|
+
if (!firstReorder)
|
1366
|
+
bdd_disable_reorder();
|
1367
|
+
res = veccompose_rec(f);
|
1368
|
+
if (!firstReorder)
|
1369
|
+
bdd_enable_reorder();
|
1370
|
+
}
|
1371
|
+
else
|
1372
|
+
{
|
1373
|
+
bdd_checkreorder();
|
1374
|
+
|
1375
|
+
if (firstReorder-- == 1)
|
1376
|
+
goto again;
|
1377
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
checkresize();
|
1381
|
+
return res;
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
|
1385
|
+
static BDD veccompose_rec(BDD f)
|
1386
|
+
{
|
1387
|
+
BddCacheData *entry;
|
1388
|
+
register BDD res;
|
1389
|
+
|
1390
|
+
if (LEVEL(f) > replacelast)
|
1391
|
+
return f;
|
1392
|
+
|
1393
|
+
entry = BddCache_lookup(&replacecache, VECCOMPOSEHASH(f));
|
1394
|
+
if (entry->a == f && entry->c == replaceid)
|
1395
|
+
{
|
1396
|
+
#ifdef CACHESTATS
|
1397
|
+
bddcachestats.opHit++;
|
1398
|
+
#endif
|
1399
|
+
return entry->r.res;
|
1400
|
+
}
|
1401
|
+
#ifdef CACHESTATS
|
1402
|
+
bddcachestats.opMiss++;
|
1403
|
+
#endif
|
1404
|
+
|
1405
|
+
PUSHREF( veccompose_rec(LOW(f)) );
|
1406
|
+
PUSHREF( veccompose_rec(HIGH(f)) );
|
1407
|
+
res = ite_rec(replacepair[LEVEL(f)], READREF(1), READREF(2));
|
1408
|
+
POPREF(2);
|
1409
|
+
|
1410
|
+
entry->a = f;
|
1411
|
+
entry->c = replaceid;
|
1412
|
+
entry->r.res = res;
|
1413
|
+
|
1414
|
+
return res;
|
1415
|
+
}
|
1416
|
+
|
1417
|
+
|
1418
|
+
/*=== SIMPLIFY =========================================================*/
|
1419
|
+
|
1420
|
+
/*
|
1421
|
+
NAME {* bdd\_simplify *}
|
1422
|
+
SECTION {* operator *}
|
1423
|
+
SHORT {* coudert and Madre's restrict function *}
|
1424
|
+
PROTO {* BDD bdd_simplify(BDD f, BDD d) *}
|
1425
|
+
DESCR {* Tries to simplify the BDD {\tt f} by restricting it to the
|
1426
|
+
domaine covered by {\tt d}. No checks are done to see if the
|
1427
|
+
result is actually smaller than the input. This can be done
|
1428
|
+
by the user with a call to {\tt bdd\_nodecount}. *}
|
1429
|
+
ALSO {* bdd\_restrict *}
|
1430
|
+
RETURN {* The simplified BDD *}
|
1431
|
+
*/
|
1432
|
+
BDD bdd_simplify(BDD f, BDD d)
|
1433
|
+
{
|
1434
|
+
BDD res;
|
1435
|
+
firstReorder = 1;
|
1436
|
+
|
1437
|
+
CHECKa(f, bddfalse);
|
1438
|
+
CHECKa(d, bddfalse);
|
1439
|
+
|
1440
|
+
again:
|
1441
|
+
if (setjmp(bddexception) == 0)
|
1442
|
+
{
|
1443
|
+
INITREF;
|
1444
|
+
applyop = bddop_or;
|
1445
|
+
|
1446
|
+
if (!firstReorder)
|
1447
|
+
bdd_disable_reorder();
|
1448
|
+
res = simplify_rec(f, d);
|
1449
|
+
if (!firstReorder)
|
1450
|
+
bdd_enable_reorder();
|
1451
|
+
}
|
1452
|
+
else
|
1453
|
+
{
|
1454
|
+
bdd_checkreorder();
|
1455
|
+
|
1456
|
+
if (firstReorder-- == 1)
|
1457
|
+
goto again;
|
1458
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
checkresize();
|
1462
|
+
return res;
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
|
1466
|
+
static BDD simplify_rec(BDD f, BDD d)
|
1467
|
+
{
|
1468
|
+
BddCacheData *entry;
|
1469
|
+
BDD res;
|
1470
|
+
|
1471
|
+
if (ISONE(d) || ISCONST(f))
|
1472
|
+
return f;
|
1473
|
+
if (d == f)
|
1474
|
+
return BDDONE;
|
1475
|
+
if (ISZERO(d))
|
1476
|
+
return BDDZERO;
|
1477
|
+
|
1478
|
+
entry = BddCache_lookup(&applycache, APPLYHASH(f,d,bddop_simplify));
|
1479
|
+
|
1480
|
+
if (entry->a == f && entry->b == d && entry->c == bddop_simplify)
|
1481
|
+
{
|
1482
|
+
#ifdef CACHESTATS
|
1483
|
+
bddcachestats.opHit++;
|
1484
|
+
#endif
|
1485
|
+
return entry->r.res;
|
1486
|
+
}
|
1487
|
+
#ifdef CACHESTATS
|
1488
|
+
bddcachestats.opMiss++;
|
1489
|
+
#endif
|
1490
|
+
|
1491
|
+
if (LEVEL(f) == LEVEL(d))
|
1492
|
+
{
|
1493
|
+
if (ISZERO(LOW(d)))
|
1494
|
+
res = simplify_rec(HIGH(f), HIGH(d));
|
1495
|
+
else
|
1496
|
+
if (ISZERO(HIGH(d)))
|
1497
|
+
res = simplify_rec(LOW(f), LOW(d));
|
1498
|
+
else
|
1499
|
+
{
|
1500
|
+
PUSHREF( simplify_rec(LOW(f), LOW(d)) );
|
1501
|
+
PUSHREF( simplify_rec(HIGH(f), HIGH(d)) );
|
1502
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
1503
|
+
POPREF(2);
|
1504
|
+
}
|
1505
|
+
}
|
1506
|
+
else
|
1507
|
+
if (LEVEL(f) < LEVEL(d))
|
1508
|
+
{
|
1509
|
+
PUSHREF( simplify_rec(LOW(f), d) );
|
1510
|
+
PUSHREF( simplify_rec(HIGH(f), d) );
|
1511
|
+
res = bdd_makenode(LEVEL(f), READREF(2), READREF(1));
|
1512
|
+
POPREF(2);
|
1513
|
+
}
|
1514
|
+
else /* LEVEL(d) < LEVEL(f) */
|
1515
|
+
{
|
1516
|
+
PUSHREF( apply_rec(LOW(d), HIGH(d)) ); /* Exist quant */
|
1517
|
+
res = simplify_rec(f, READREF(1));
|
1518
|
+
POPREF(1);
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
entry->a = f;
|
1522
|
+
entry->b = d;
|
1523
|
+
entry->c = bddop_simplify;
|
1524
|
+
entry->r.res = res;
|
1525
|
+
|
1526
|
+
return res;
|
1527
|
+
}
|
1528
|
+
|
1529
|
+
|
1530
|
+
/*=== QUANTIFICATION ===================================================*/
|
1531
|
+
|
1532
|
+
/*
|
1533
|
+
NAME {* bdd\_exist *}
|
1534
|
+
SECTION {* operator *}
|
1535
|
+
SHORT {* existential quantification of variables *}
|
1536
|
+
PROTO {* BDD bdd_exist(BDD r, BDD var) *}
|
1537
|
+
DESCR {* Removes all occurences in {\tt r} of variables in the set
|
1538
|
+
{\tt var} by existential quantification. *}
|
1539
|
+
ALSO {* bdd\_forall, bdd\_unique, bdd\_makeset *}
|
1540
|
+
RETURN {* The quantified BDD. *}
|
1541
|
+
*/
|
1542
|
+
BDD bdd_exist(BDD r, BDD var)
|
1543
|
+
{
|
1544
|
+
BDD res;
|
1545
|
+
firstReorder = 1;
|
1546
|
+
bddParam = r;
|
1547
|
+
|
1548
|
+
CHECKa(r, bddfalse);
|
1549
|
+
CHECKa(var, bddfalse);
|
1550
|
+
|
1551
|
+
if (var < 2) /* Empty set */
|
1552
|
+
return r;
|
1553
|
+
|
1554
|
+
again:
|
1555
|
+
if (setjmp(bddexception) == 0)
|
1556
|
+
{
|
1557
|
+
if (varset2vartable(var) < 0)
|
1558
|
+
return bddfalse;
|
1559
|
+
|
1560
|
+
INITREF;
|
1561
|
+
quantid = (var << 3) | CACHEID_EXIST; /* FIXME: range */
|
1562
|
+
applyop = bddop_or;
|
1563
|
+
|
1564
|
+
if (!firstReorder)
|
1565
|
+
bdd_disable_reorder();
|
1566
|
+
res = quant_rec(bddParam);
|
1567
|
+
if (!firstReorder)
|
1568
|
+
bdd_enable_reorder();
|
1569
|
+
}
|
1570
|
+
else
|
1571
|
+
{
|
1572
|
+
bdd_checkreorder();
|
1573
|
+
|
1574
|
+
if (firstReorder-- == 1)
|
1575
|
+
goto again;
|
1576
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
checkresize();
|
1580
|
+
return res;
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
|
1584
|
+
/*
|
1585
|
+
NAME {* bdd\_forall *}
|
1586
|
+
SECTION {* operator *}
|
1587
|
+
SHORT {* universal quantification of variables *}
|
1588
|
+
PROTO {* BDD bdd_forall(BDD r, BDD var) *}
|
1589
|
+
DESCR {* Removes all occurences in {\tt r} of variables in the set
|
1590
|
+
{\tt var} by universal quantification. *}
|
1591
|
+
ALSO {* bdd\_exist, bdd\_unique, bdd\_makeset *}
|
1592
|
+
RETURN {* The quantified BDD. *}
|
1593
|
+
*/
|
1594
|
+
BDD bdd_forall(BDD r, BDD var)
|
1595
|
+
{
|
1596
|
+
BDD res;
|
1597
|
+
firstReorder = 1;
|
1598
|
+
bddParam = r;
|
1599
|
+
|
1600
|
+
CHECKa(r, bddfalse);
|
1601
|
+
CHECKa(var, bddfalse);
|
1602
|
+
|
1603
|
+
if (var < 2) /* Empty set */
|
1604
|
+
return r;
|
1605
|
+
|
1606
|
+
again:
|
1607
|
+
if (setjmp(bddexception) == 0)
|
1608
|
+
{
|
1609
|
+
if (varset2vartable(var) < 0)
|
1610
|
+
return bddfalse;
|
1611
|
+
|
1612
|
+
INITREF;
|
1613
|
+
quantid = (var << 3) | CACHEID_FORALL;
|
1614
|
+
applyop = bddop_and;
|
1615
|
+
|
1616
|
+
if (!firstReorder)
|
1617
|
+
bdd_disable_reorder();
|
1618
|
+
res = quant_rec(bddParam);
|
1619
|
+
if (!firstReorder)
|
1620
|
+
bdd_enable_reorder();
|
1621
|
+
}
|
1622
|
+
else
|
1623
|
+
{
|
1624
|
+
bdd_checkreorder();
|
1625
|
+
|
1626
|
+
if (firstReorder-- == 1)
|
1627
|
+
goto again;
|
1628
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1629
|
+
}
|
1630
|
+
|
1631
|
+
checkresize();
|
1632
|
+
return res;
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
|
1636
|
+
/*
|
1637
|
+
NAME {* bdd\_unique *}
|
1638
|
+
SECTION {* operator *}
|
1639
|
+
SHORT {* unique quantification of variables *}
|
1640
|
+
PROTO {* BDD bdd_unique(BDD r, BDD var) *}
|
1641
|
+
DESCR {* Removes all occurences in {\tt r} of variables in the set
|
1642
|
+
{\tt var} by unique quantification. This type of quantification
|
1643
|
+
uses a XOR operator instead of an OR operator as in the
|
1644
|
+
existential quantification, and an AND operator as in the
|
1645
|
+
universal quantification. *}
|
1646
|
+
ALSO {* bdd\_exist, bdd\_forall, bdd\_makeset *}
|
1647
|
+
RETURN {* The quantified BDD. *}
|
1648
|
+
*/
|
1649
|
+
BDD bdd_unique(BDD r, BDD var)
|
1650
|
+
{
|
1651
|
+
BDD res;
|
1652
|
+
firstReorder = 1;
|
1653
|
+
bddParam = r;
|
1654
|
+
|
1655
|
+
CHECKa(r, bddfalse);
|
1656
|
+
CHECKa(var, bddfalse);
|
1657
|
+
|
1658
|
+
if (var < 2) /* Empty set */
|
1659
|
+
return r;
|
1660
|
+
|
1661
|
+
again:
|
1662
|
+
if (setjmp(bddexception) == 0)
|
1663
|
+
{
|
1664
|
+
if (varset2vartable(var) < 0)
|
1665
|
+
return bddfalse;
|
1666
|
+
|
1667
|
+
INITREF;
|
1668
|
+
quantid = (var << 3) | CACHEID_UNIQUE;
|
1669
|
+
applyop = bddop_xor;
|
1670
|
+
|
1671
|
+
if (!firstReorder)
|
1672
|
+
bdd_disable_reorder();
|
1673
|
+
res = quant_rec(bddParam);
|
1674
|
+
if (!firstReorder)
|
1675
|
+
bdd_enable_reorder();
|
1676
|
+
}
|
1677
|
+
else
|
1678
|
+
{
|
1679
|
+
bdd_checkreorder();
|
1680
|
+
|
1681
|
+
if (firstReorder-- == 1)
|
1682
|
+
goto again;
|
1683
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
checkresize();
|
1687
|
+
return res;
|
1688
|
+
}
|
1689
|
+
|
1690
|
+
|
1691
|
+
static int quant_rec(int r)
|
1692
|
+
{
|
1693
|
+
BddCacheData *entry;
|
1694
|
+
int res;
|
1695
|
+
|
1696
|
+
if (r < 2 || LEVEL(r) > quantlast)
|
1697
|
+
return r;
|
1698
|
+
|
1699
|
+
entry = BddCache_lookup(&quantcache, QUANTHASH(r));
|
1700
|
+
if (entry->a == r && entry->c == quantid)
|
1701
|
+
{
|
1702
|
+
#ifdef CACHESTATS
|
1703
|
+
bddcachestats.opHit++;
|
1704
|
+
#endif
|
1705
|
+
return entry->r.res;
|
1706
|
+
}
|
1707
|
+
#ifdef CACHESTATS
|
1708
|
+
bddcachestats.opMiss++;
|
1709
|
+
#endif
|
1710
|
+
|
1711
|
+
PUSHREF( quant_rec(LOW(r)) );
|
1712
|
+
PUSHREF( quant_rec(HIGH(r)) );
|
1713
|
+
|
1714
|
+
if (INVARSET(LEVEL(r)))
|
1715
|
+
res = apply_rec(READREF(2), READREF(1));
|
1716
|
+
else
|
1717
|
+
res = bdd_makenode(LEVEL(r), READREF(2), READREF(1));
|
1718
|
+
|
1719
|
+
POPREF(2);
|
1720
|
+
|
1721
|
+
entry->a = r;
|
1722
|
+
entry->c = quantid;
|
1723
|
+
entry->r.res = res;
|
1724
|
+
|
1725
|
+
return res;
|
1726
|
+
}
|
1727
|
+
|
1728
|
+
|
1729
|
+
/*=== APPLY & QUANTIFY =================================================*/
|
1730
|
+
|
1731
|
+
/*
|
1732
|
+
NAME {* bdd\_appex *}
|
1733
|
+
SECTION {* operator *}
|
1734
|
+
SHORT {* apply operation and existential quantification *}
|
1735
|
+
PROTO {* BDD bdd_appex(BDD left, BDD right, int opr, BDD var) *}
|
1736
|
+
DESCR {* Applies the binary operator {\tt opr} to the arguments
|
1737
|
+
{\tt left} and {\tt right} and then performs an existential
|
1738
|
+
quantification of the variables from the variable set
|
1739
|
+
{\tt var}. This is done in a bottom up manner such that both the
|
1740
|
+
apply and quantification is done on the lower nodes before
|
1741
|
+
stepping up to the higher nodes. This makes the {\tt bdd\_appex}
|
1742
|
+
function much more efficient than an apply operation followed
|
1743
|
+
by a quantification. If the operator is a conjunction then this
|
1744
|
+
is similar to the relational product of the two BDDs.
|
1745
|
+
\index{relational product} *}
|
1746
|
+
ALSO {* bdd\_appall, bdd\_appuni, bdd\_apply, bdd\_exist, bdd\_forall, bdd\_unique, bdd\_makeset *}
|
1747
|
+
RETURN {* The result of the operation. *}
|
1748
|
+
*/
|
1749
|
+
BDD bdd_appex(BDD l, BDD r, int opr, BDD var)
|
1750
|
+
{
|
1751
|
+
BDD res;
|
1752
|
+
firstReorder = 1;
|
1753
|
+
|
1754
|
+
CHECKa(l, bddfalse);
|
1755
|
+
CHECKa(r, bddfalse);
|
1756
|
+
CHECKa(var, bddfalse);
|
1757
|
+
|
1758
|
+
if (opr<0 || opr>bddop_invimp)
|
1759
|
+
{
|
1760
|
+
bdd_error(BDD_OP);
|
1761
|
+
return bddfalse;
|
1762
|
+
}
|
1763
|
+
|
1764
|
+
if (var < 2) /* Empty set */
|
1765
|
+
return bdd_apply(l,r,opr);
|
1766
|
+
|
1767
|
+
again:
|
1768
|
+
if (setjmp(bddexception) == 0)
|
1769
|
+
{
|
1770
|
+
if (varset2vartable(var) < 0)
|
1771
|
+
return bddfalse;
|
1772
|
+
|
1773
|
+
INITREF;
|
1774
|
+
applyop = bddop_or;
|
1775
|
+
appexop = opr;
|
1776
|
+
appexid = (var << 5) | (appexop << 1); /* FIXME: range! */
|
1777
|
+
quantid = (appexid << 3) | CACHEID_APPEX;
|
1778
|
+
|
1779
|
+
if (!firstReorder)
|
1780
|
+
bdd_disable_reorder();
|
1781
|
+
res = appquant_rec(l, r);
|
1782
|
+
if (!firstReorder)
|
1783
|
+
bdd_enable_reorder();
|
1784
|
+
}
|
1785
|
+
else
|
1786
|
+
{
|
1787
|
+
bdd_checkreorder();
|
1788
|
+
|
1789
|
+
if (firstReorder-- == 1)
|
1790
|
+
goto again;
|
1791
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
checkresize();
|
1795
|
+
return res;
|
1796
|
+
}
|
1797
|
+
|
1798
|
+
|
1799
|
+
/*
|
1800
|
+
NAME {* bdd\_appall *}
|
1801
|
+
SECTION {* operator *}
|
1802
|
+
SHORT {* apply operation and universal quantification *}
|
1803
|
+
PROTO {* BDD bdd_appall(BDD left, BDD right, int opr, BDD var) *}
|
1804
|
+
DESCR {* Applies the binary operator {\tt opr} to the arguments
|
1805
|
+
{\tt left} and {\tt right} and then performs an universal
|
1806
|
+
quantification of the variables from the variable set
|
1807
|
+
{\tt var}. This is done in a bottom up manner such that both the
|
1808
|
+
apply and quantification is done on the lower nodes before
|
1809
|
+
stepping up to the higher nodes. This makes the {\tt bdd\_appall}
|
1810
|
+
function much more efficient than an apply operation followed
|
1811
|
+
by a quantification. *}
|
1812
|
+
ALSO {* bdd\_appex, bdd\_appuni, bdd\_apply, bdd\_exist, bdd\_forall, bdd\_unique, bdd\_makeset *}
|
1813
|
+
RETURN {* The result of the operation. *}
|
1814
|
+
*/
|
1815
|
+
BDD bdd_appall(BDD l, BDD r, int opr, BDD var)
|
1816
|
+
{
|
1817
|
+
BDD res;
|
1818
|
+
firstReorder = 1;
|
1819
|
+
|
1820
|
+
CHECKa(l, bddfalse);
|
1821
|
+
CHECKa(r, bddfalse);
|
1822
|
+
CHECKa(var, bddfalse);
|
1823
|
+
|
1824
|
+
if (opr<0 || opr>bddop_invimp)
|
1825
|
+
{
|
1826
|
+
bdd_error(BDD_OP);
|
1827
|
+
return bddfalse;
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
if (var < 2) /* Empty set */
|
1831
|
+
return bdd_apply(l,r,opr);
|
1832
|
+
|
1833
|
+
again:
|
1834
|
+
if (setjmp(bddexception) == 0)
|
1835
|
+
{
|
1836
|
+
if (varset2vartable(var) < 0)
|
1837
|
+
return bddfalse;
|
1838
|
+
|
1839
|
+
INITREF;
|
1840
|
+
applyop = bddop_and;
|
1841
|
+
appexop = opr;
|
1842
|
+
appexid = (var << 5) | (appexop << 1) | 1; /* FIXME: range! */
|
1843
|
+
quantid = (appexid << 3) | CACHEID_APPAL;
|
1844
|
+
|
1845
|
+
if (!firstReorder)
|
1846
|
+
bdd_disable_reorder();
|
1847
|
+
res = appquant_rec(l, r);
|
1848
|
+
if (!firstReorder)
|
1849
|
+
bdd_enable_reorder();
|
1850
|
+
}
|
1851
|
+
else
|
1852
|
+
{
|
1853
|
+
bdd_checkreorder();
|
1854
|
+
|
1855
|
+
if (firstReorder-- == 1)
|
1856
|
+
goto again;
|
1857
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1858
|
+
}
|
1859
|
+
|
1860
|
+
checkresize();
|
1861
|
+
return res;
|
1862
|
+
}
|
1863
|
+
|
1864
|
+
|
1865
|
+
/*
|
1866
|
+
NAME {* bdd\_appuni *}
|
1867
|
+
SECTION {* operator *}
|
1868
|
+
SHORT {* apply operation and unique quantification *}
|
1869
|
+
PROTO {* BDD bdd_appuni(BDD left, BDD right, int opr, BDD var) *}
|
1870
|
+
DESCR {* Applies the binary operator {\tt opr} to the arguments
|
1871
|
+
{\tt left} and {\tt right} and then performs a unique
|
1872
|
+
quantification of the variables from the variable set
|
1873
|
+
{\tt var}. This is done in a bottom up manner such that both the
|
1874
|
+
apply and quantification is done on the lower nodes before
|
1875
|
+
stepping up to the higher nodes. This makes the {\tt bdd\_appuni}
|
1876
|
+
function much more efficient than an apply operation followed
|
1877
|
+
by a quantification. *}
|
1878
|
+
ALSO {* bdd\_appex, bdd\_appall, bdd\_apply, bdd\_exist, bdd\_unique, bdd\_forall, bdd\_makeset *}
|
1879
|
+
RETURN {* The result of the operation. *}
|
1880
|
+
*/
|
1881
|
+
BDD bdd_appuni(BDD l, BDD r, int opr, BDD var)
|
1882
|
+
{
|
1883
|
+
BDD res;
|
1884
|
+
firstReorder = 1;
|
1885
|
+
|
1886
|
+
CHECKa(l, bddfalse);
|
1887
|
+
CHECKa(r, bddfalse);
|
1888
|
+
CHECKa(var, bddfalse);
|
1889
|
+
|
1890
|
+
if (opr<0 || opr>bddop_invimp)
|
1891
|
+
{
|
1892
|
+
bdd_error(BDD_OP);
|
1893
|
+
return bddfalse;
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
if (var < 2) /* Empty set */
|
1897
|
+
return bdd_apply(l,r,opr);
|
1898
|
+
|
1899
|
+
again:
|
1900
|
+
if (setjmp(bddexception) == 0)
|
1901
|
+
{
|
1902
|
+
if (varset2vartable(var) < 0)
|
1903
|
+
return bddfalse;
|
1904
|
+
|
1905
|
+
INITREF;
|
1906
|
+
applyop = bddop_xor;
|
1907
|
+
appexop = opr;
|
1908
|
+
appexid = (var << 5) | (appexop << 1) | 1; /* FIXME: range! */
|
1909
|
+
quantid = (appexid << 3) | CACHEID_APPUN;
|
1910
|
+
|
1911
|
+
if (!firstReorder)
|
1912
|
+
bdd_disable_reorder();
|
1913
|
+
res = appquant_rec(l, r);
|
1914
|
+
if (!firstReorder)
|
1915
|
+
bdd_enable_reorder();
|
1916
|
+
}
|
1917
|
+
else
|
1918
|
+
{
|
1919
|
+
bdd_checkreorder();
|
1920
|
+
|
1921
|
+
if (firstReorder-- == 1)
|
1922
|
+
goto again;
|
1923
|
+
res = BDDZERO; /* avoid warning about res being uninitialized */
|
1924
|
+
}
|
1925
|
+
|
1926
|
+
checkresize();
|
1927
|
+
return res;
|
1928
|
+
}
|
1929
|
+
|
1930
|
+
|
1931
|
+
static int appquant_rec(int l, int r)
|
1932
|
+
{
|
1933
|
+
BddCacheData *entry;
|
1934
|
+
int res;
|
1935
|
+
|
1936
|
+
switch (appexop)
|
1937
|
+
{
|
1938
|
+
case bddop_and:
|
1939
|
+
if (l == 0 || r == 0)
|
1940
|
+
return 0;
|
1941
|
+
if (l == r)
|
1942
|
+
return quant_rec(l);
|
1943
|
+
if (l == 1)
|
1944
|
+
return quant_rec(r);
|
1945
|
+
if (r == 1)
|
1946
|
+
return quant_rec(l);
|
1947
|
+
break;
|
1948
|
+
case bddop_or:
|
1949
|
+
if (l == 1 || r == 1)
|
1950
|
+
return 1;
|
1951
|
+
if (l == r)
|
1952
|
+
return quant_rec(l);
|
1953
|
+
if (l == 0)
|
1954
|
+
return quant_rec(r);
|
1955
|
+
if (r == 0)
|
1956
|
+
return quant_rec(l);
|
1957
|
+
break;
|
1958
|
+
case bddop_xor:
|
1959
|
+
if (l == r)
|
1960
|
+
return 0;
|
1961
|
+
if (l == 0)
|
1962
|
+
return quant_rec(r);
|
1963
|
+
if (r == 0)
|
1964
|
+
return quant_rec(l);
|
1965
|
+
break;
|
1966
|
+
case bddop_nand:
|
1967
|
+
if (l == 0 || r == 0)
|
1968
|
+
return 1;
|
1969
|
+
break;
|
1970
|
+
case bddop_nor:
|
1971
|
+
if (l == 1 || r == 1)
|
1972
|
+
return 0;
|
1973
|
+
break;
|
1974
|
+
}
|
1975
|
+
|
1976
|
+
if (ISCONST(l) && ISCONST(r))
|
1977
|
+
res = oprres[appexop][(l<<1) | r];
|
1978
|
+
else
|
1979
|
+
if (LEVEL(l) > quantlast && LEVEL(r) > quantlast)
|
1980
|
+
{
|
1981
|
+
int oldop = applyop;
|
1982
|
+
applyop = appexop;
|
1983
|
+
res = apply_rec(l,r);
|
1984
|
+
applyop = oldop;
|
1985
|
+
}
|
1986
|
+
else
|
1987
|
+
{
|
1988
|
+
entry = BddCache_lookup(&appexcache, APPEXHASH(l,r,appexop));
|
1989
|
+
if (entry->a == l && entry->b == r && entry->c == appexid)
|
1990
|
+
{
|
1991
|
+
#ifdef CACHESTATS
|
1992
|
+
bddcachestats.opHit++;
|
1993
|
+
#endif
|
1994
|
+
return entry->r.res;
|
1995
|
+
}
|
1996
|
+
#ifdef CACHESTATS
|
1997
|
+
bddcachestats.opMiss++;
|
1998
|
+
#endif
|
1999
|
+
|
2000
|
+
if (LEVEL(l) == LEVEL(r))
|
2001
|
+
{
|
2002
|
+
PUSHREF( appquant_rec(LOW(l), LOW(r)) );
|
2003
|
+
PUSHREF( appquant_rec(HIGH(l), HIGH(r)) );
|
2004
|
+
if (INVARSET(LEVEL(l)))
|
2005
|
+
res = apply_rec(READREF(2), READREF(1));
|
2006
|
+
else
|
2007
|
+
res = bdd_makenode(LEVEL(l), READREF(2), READREF(1));
|
2008
|
+
}
|
2009
|
+
else
|
2010
|
+
if (LEVEL(l) < LEVEL(r))
|
2011
|
+
{
|
2012
|
+
PUSHREF( appquant_rec(LOW(l), r) );
|
2013
|
+
PUSHREF( appquant_rec(HIGH(l), r) );
|
2014
|
+
if (INVARSET(LEVEL(l)))
|
2015
|
+
res = apply_rec(READREF(2), READREF(1));
|
2016
|
+
else
|
2017
|
+
res = bdd_makenode(LEVEL(l), READREF(2), READREF(1));
|
2018
|
+
}
|
2019
|
+
else
|
2020
|
+
{
|
2021
|
+
PUSHREF( appquant_rec(l, LOW(r)) );
|
2022
|
+
PUSHREF( appquant_rec(l, HIGH(r)) );
|
2023
|
+
if (INVARSET(LEVEL(r)))
|
2024
|
+
res = apply_rec(READREF(2), READREF(1));
|
2025
|
+
else
|
2026
|
+
res = bdd_makenode(LEVEL(r), READREF(2), READREF(1));
|
2027
|
+
}
|
2028
|
+
|
2029
|
+
POPREF(2);
|
2030
|
+
|
2031
|
+
entry->a = l;
|
2032
|
+
entry->b = r;
|
2033
|
+
entry->c = appexid;
|
2034
|
+
entry->r.res = res;
|
2035
|
+
}
|
2036
|
+
|
2037
|
+
return res;
|
2038
|
+
}
|
2039
|
+
|
2040
|
+
|
2041
|
+
/*************************************************************************
|
2042
|
+
Informational functions
|
2043
|
+
*************************************************************************/
|
2044
|
+
|
2045
|
+
/*=== SUPPORT ==========================================================*/
|
2046
|
+
|
2047
|
+
/*
|
2048
|
+
NAME {* bdd\_support *}
|
2049
|
+
SECTION {* info *}
|
2050
|
+
SHORT {* returns the variable support of a BDD *}
|
2051
|
+
PROTO {* BDD bdd_support(BDD r) *}
|
2052
|
+
DESCR {* Finds all the variables that {\tt r} depends on. That is
|
2053
|
+
the support of {\tt r}. *}
|
2054
|
+
ALSO {* bdd\_makeset *}
|
2055
|
+
RETURN {* A BDD variable set. *}
|
2056
|
+
*/
|
2057
|
+
BDD bdd_support(BDD r)
|
2058
|
+
{
|
2059
|
+
static int supportSize = 0;
|
2060
|
+
int n;
|
2061
|
+
int res=1;
|
2062
|
+
|
2063
|
+
CHECKa(r, bddfalse);
|
2064
|
+
|
2065
|
+
if (r < 2)
|
2066
|
+
return bddfalse;
|
2067
|
+
|
2068
|
+
/* On-demand allocation of support set */
|
2069
|
+
if (supportSize < bddvarnum)
|
2070
|
+
{
|
2071
|
+
if ((supportSet=(int*)malloc(bddvarnum*sizeof(int))) == NULL)
|
2072
|
+
{
|
2073
|
+
bdd_error(BDD_MEMORY);
|
2074
|
+
return bddfalse;
|
2075
|
+
}
|
2076
|
+
memset(supportSet, 0, bddvarnum*sizeof(int));
|
2077
|
+
supportSize = bddvarnum;
|
2078
|
+
supportID = 0;
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
/* Update global variables used to speed up bdd_support()
|
2082
|
+
* - instead of always memsetting support to zero, we use
|
2083
|
+
* a change counter.
|
2084
|
+
* - and instead of reading the whole array afterwards, we just
|
2085
|
+
* look from 'min' to 'max' used BDD variables.
|
2086
|
+
*/
|
2087
|
+
if (supportID == 0x0FFFFFFF)
|
2088
|
+
{
|
2089
|
+
/* We probably don't get here -- but let's just be sure */
|
2090
|
+
memset(supportSet, 0, bddvarnum*sizeof(int));
|
2091
|
+
supportID = 0;
|
2092
|
+
}
|
2093
|
+
++supportID;
|
2094
|
+
supportMin = LEVEL(r);
|
2095
|
+
supportMax = supportMin;
|
2096
|
+
|
2097
|
+
support_rec(r, supportSet);
|
2098
|
+
bdd_unmark(r);
|
2099
|
+
|
2100
|
+
bdd_disable_reorder();
|
2101
|
+
|
2102
|
+
for (n=supportMax ; n>=supportMin ; --n)
|
2103
|
+
if (supportSet[n] == supportID)
|
2104
|
+
{
|
2105
|
+
register BDD tmp;
|
2106
|
+
bdd_addref(res);
|
2107
|
+
tmp = bdd_makenode(n, 0, res);
|
2108
|
+
bdd_delref(res);
|
2109
|
+
res = tmp;
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
bdd_enable_reorder();
|
2113
|
+
|
2114
|
+
return res;
|
2115
|
+
}
|
2116
|
+
|
2117
|
+
|
2118
|
+
static void support_rec(int r, int* support)
|
2119
|
+
{
|
2120
|
+
BddNode *node;
|
2121
|
+
|
2122
|
+
if (r < 2)
|
2123
|
+
return;
|
2124
|
+
|
2125
|
+
node = &bddnodes[r];
|
2126
|
+
if (LEVELp(node) & MARKON || LOWp(node) == -1)
|
2127
|
+
return;
|
2128
|
+
|
2129
|
+
support[LEVELp(node)] = supportID;
|
2130
|
+
|
2131
|
+
if (LEVELp(node) > supportMax)
|
2132
|
+
supportMax = LEVELp(node);
|
2133
|
+
|
2134
|
+
LEVELp(node) |= MARKON;
|
2135
|
+
|
2136
|
+
support_rec(LOWp(node), support);
|
2137
|
+
support_rec(HIGHp(node), support);
|
2138
|
+
}
|
2139
|
+
|
2140
|
+
|
2141
|
+
/*=== ONE SATISFYING VARIABLE ASSIGNMENT ===============================*/
|
2142
|
+
|
2143
|
+
/*
|
2144
|
+
NAME {* bdd\_satone *}
|
2145
|
+
SECTION {* operator *}
|
2146
|
+
SHORT {* finds one satisfying variable assignment *}
|
2147
|
+
PROTO {* BDD bdd_satone(BDD r) *}
|
2148
|
+
DESCR {* Finds a BDD with at most one variable at each level. This BDD
|
2149
|
+
implies {\tt r} and is not false unless {\tt r} is
|
2150
|
+
false. *}
|
2151
|
+
ALSO {* bdd\_allsat bdd\_satoneset, bdd\_fullsatone, bdd\_satcount, bdd\_satcountln *}
|
2152
|
+
RETURN {* The result of the operation. *}
|
2153
|
+
*/
|
2154
|
+
BDD bdd_satone(BDD r)
|
2155
|
+
{
|
2156
|
+
BDD res;
|
2157
|
+
|
2158
|
+
CHECKa(r, bddfalse);
|
2159
|
+
if (r < 2)
|
2160
|
+
return r;
|
2161
|
+
|
2162
|
+
bdd_disable_reorder();
|
2163
|
+
|
2164
|
+
INITREF;
|
2165
|
+
res = satone_rec(r);
|
2166
|
+
|
2167
|
+
bdd_enable_reorder();
|
2168
|
+
|
2169
|
+
checkresize();
|
2170
|
+
return res;
|
2171
|
+
}
|
2172
|
+
|
2173
|
+
|
2174
|
+
static BDD satone_rec(BDD r)
|
2175
|
+
{
|
2176
|
+
if (ISCONST(r))
|
2177
|
+
return r;
|
2178
|
+
|
2179
|
+
if (ISZERO(LOW(r)))
|
2180
|
+
{
|
2181
|
+
BDD res = satone_rec(HIGH(r));
|
2182
|
+
return PUSHREF( bdd_makenode(LEVEL(r), BDDZERO, res) );
|
2183
|
+
}
|
2184
|
+
else
|
2185
|
+
{
|
2186
|
+
BDD res = satone_rec(LOW(r));
|
2187
|
+
return PUSHREF( bdd_makenode(LEVEL(r), res, BDDZERO) );
|
2188
|
+
}
|
2189
|
+
}
|
2190
|
+
|
2191
|
+
|
2192
|
+
/*
|
2193
|
+
NAME {* bdd\_satoneset *}
|
2194
|
+
SECTION {* operator *}
|
2195
|
+
SHORT {* finds one satisfying variable assignment *}
|
2196
|
+
PROTO {* BDD bdd_satoneset(BDD r, BDD var, BDD pol) *}
|
2197
|
+
DESCR {* Finds a minterm in {\tt r}. The {\tt var} argument is a
|
2198
|
+
variable set that defines a set of variables that {\em must} be
|
2199
|
+
mentioned in the result. The polarity of these variables in
|
2200
|
+
result---in case they are undefined in {\tt r}---are defined
|
2201
|
+
by the {\tt pol} parameter. If {\tt pol} is the false BDD then
|
2202
|
+
the variables will be in negative form, and otherwise they will
|
2203
|
+
be in positive form. *}
|
2204
|
+
ALSO {* bdd\_allsat bdd\_satone, bdd\_fullsatone, bdd\_satcount, bdd\_satcountln *}
|
2205
|
+
RETURN {* The result of the operation. *}
|
2206
|
+
*/
|
2207
|
+
BDD bdd_satoneset(BDD r, BDD var, BDD pol)
|
2208
|
+
{
|
2209
|
+
BDD res;
|
2210
|
+
|
2211
|
+
CHECKa(r, bddfalse);
|
2212
|
+
if (ISZERO(r))
|
2213
|
+
return r;
|
2214
|
+
if (!ISCONST(pol))
|
2215
|
+
{
|
2216
|
+
bdd_error(BDD_ILLBDD);
|
2217
|
+
return bddfalse;
|
2218
|
+
}
|
2219
|
+
|
2220
|
+
bdd_disable_reorder();
|
2221
|
+
|
2222
|
+
INITREF;
|
2223
|
+
satPolarity = pol;
|
2224
|
+
res = satoneset_rec(r, var);
|
2225
|
+
|
2226
|
+
bdd_enable_reorder();
|
2227
|
+
|
2228
|
+
checkresize();
|
2229
|
+
return res;
|
2230
|
+
}
|
2231
|
+
|
2232
|
+
|
2233
|
+
static BDD satoneset_rec(BDD r, BDD var)
|
2234
|
+
{
|
2235
|
+
if (ISCONST(r) && ISCONST(var))
|
2236
|
+
return r;
|
2237
|
+
|
2238
|
+
if (LEVEL(r) < LEVEL(var))
|
2239
|
+
{
|
2240
|
+
if (ISZERO(LOW(r)))
|
2241
|
+
{
|
2242
|
+
BDD res = satoneset_rec(HIGH(r), var);
|
2243
|
+
return PUSHREF( bdd_makenode(LEVEL(r), BDDZERO, res) );
|
2244
|
+
}
|
2245
|
+
else
|
2246
|
+
{
|
2247
|
+
BDD res = satoneset_rec(LOW(r), var);
|
2248
|
+
return PUSHREF( bdd_makenode(LEVEL(r), res, BDDZERO) );
|
2249
|
+
}
|
2250
|
+
}
|
2251
|
+
else if (LEVEL(var) < LEVEL(r))
|
2252
|
+
{
|
2253
|
+
BDD res = satoneset_rec(r, HIGH(var));
|
2254
|
+
if (satPolarity == BDDONE)
|
2255
|
+
return PUSHREF( bdd_makenode(LEVEL(var), BDDZERO, res) );
|
2256
|
+
else
|
2257
|
+
return PUSHREF( bdd_makenode(LEVEL(var), res, BDDZERO) );
|
2258
|
+
}
|
2259
|
+
else /* LEVEL(r) == LEVEL(var) */
|
2260
|
+
{
|
2261
|
+
if (ISZERO(LOW(r)))
|
2262
|
+
{
|
2263
|
+
BDD res = satoneset_rec(HIGH(r), HIGH(var));
|
2264
|
+
return PUSHREF( bdd_makenode(LEVEL(r), BDDZERO, res) );
|
2265
|
+
}
|
2266
|
+
else
|
2267
|
+
{
|
2268
|
+
BDD res = satoneset_rec(LOW(r), HIGH(var));
|
2269
|
+
return PUSHREF( bdd_makenode(LEVEL(r), res, BDDZERO) );
|
2270
|
+
}
|
2271
|
+
}
|
2272
|
+
|
2273
|
+
}
|
2274
|
+
|
2275
|
+
|
2276
|
+
/*=== EXACTLY ONE SATISFYING VARIABLE ASSIGNMENT =======================*/
|
2277
|
+
|
2278
|
+
/*
|
2279
|
+
NAME {* bdd\_fullsatone *}
|
2280
|
+
SECTION {* operator *}
|
2281
|
+
SHORT {* finds one satisfying variable assignment *}
|
2282
|
+
PROTO {* BDD bdd_fullsatone(BDD r) *}
|
2283
|
+
DESCR {* Finds a BDD with exactly one variable at all levels. This BDD
|
2284
|
+
implies {\tt r} and is not false unless {\tt r} is
|
2285
|
+
false. *}
|
2286
|
+
ALSO {* bdd\_allsat bdd\_satone, bdd\_satoneset, bdd\_satcount, bdd\_satcountln *}
|
2287
|
+
RETURN {* The result of the operation. *}
|
2288
|
+
*/
|
2289
|
+
BDD bdd_fullsatone(BDD r)
|
2290
|
+
{
|
2291
|
+
BDD res;
|
2292
|
+
int v;
|
2293
|
+
|
2294
|
+
CHECKa(r, bddfalse);
|
2295
|
+
if (r == 0)
|
2296
|
+
return 0;
|
2297
|
+
|
2298
|
+
bdd_disable_reorder();
|
2299
|
+
|
2300
|
+
INITREF;
|
2301
|
+
res = fullsatone_rec(r);
|
2302
|
+
|
2303
|
+
for (v=LEVEL(r)-1 ; v>=0 ; v--)
|
2304
|
+
{
|
2305
|
+
res = PUSHREF( bdd_makenode(v, res, 0) );
|
2306
|
+
}
|
2307
|
+
|
2308
|
+
bdd_enable_reorder();
|
2309
|
+
|
2310
|
+
checkresize();
|
2311
|
+
return res;
|
2312
|
+
}
|
2313
|
+
|
2314
|
+
|
2315
|
+
static int fullsatone_rec(int r)
|
2316
|
+
{
|
2317
|
+
if (r < 2)
|
2318
|
+
return r;
|
2319
|
+
|
2320
|
+
if (LOW(r) != 0)
|
2321
|
+
{
|
2322
|
+
int res = fullsatone_rec(LOW(r));
|
2323
|
+
int v;
|
2324
|
+
|
2325
|
+
for (v=LEVEL(LOW(r))-1 ; v>LEVEL(r) ; v--)
|
2326
|
+
{
|
2327
|
+
res = PUSHREF( bdd_makenode(v, res, 0) );
|
2328
|
+
}
|
2329
|
+
|
2330
|
+
return PUSHREF( bdd_makenode(LEVEL(r), res, 0) );
|
2331
|
+
}
|
2332
|
+
else
|
2333
|
+
{
|
2334
|
+
int res = fullsatone_rec(HIGH(r));
|
2335
|
+
int v;
|
2336
|
+
|
2337
|
+
for (v=LEVEL(HIGH(r))-1 ; v>LEVEL(r) ; v--)
|
2338
|
+
{
|
2339
|
+
res = PUSHREF( bdd_makenode(v, res, 0) );
|
2340
|
+
}
|
2341
|
+
|
2342
|
+
return PUSHREF( bdd_makenode(LEVEL(r), 0, res) );
|
2343
|
+
}
|
2344
|
+
}
|
2345
|
+
|
2346
|
+
|
2347
|
+
/*=== ALL SATISFYING VARIABLE ASSIGNMENTS ==============================*/
|
2348
|
+
|
2349
|
+
/*
|
2350
|
+
NAME {* bdd\_allsat *}
|
2351
|
+
SECTION {* operator *}
|
2352
|
+
SHORT {* finds all satisfying variable assignments *}
|
2353
|
+
PROTO {* BDD bdd_satone(BDD r, bddallsathandler handler) *}
|
2354
|
+
DESCR {* Iterates through all legal variable assignments (those
|
2355
|
+
that make the BDD come true) for the bdd {\tt r} and
|
2356
|
+
calls the callback handler {\tt handler} for each of them.
|
2357
|
+
The array passed to {\tt handler} contains one entry for
|
2358
|
+
each of the globaly defined variables. Each entry is either
|
2359
|
+
0 if the variable is false, 1 if it is true, and -1 if it
|
2360
|
+
is a don't care.
|
2361
|
+
|
2362
|
+
The following is an example of a callback handler that
|
2363
|
+
prints 'X' for don't cares, '0' for zero, and '1' for one:
|
2364
|
+
\begin{verbatim}
|
2365
|
+
void allsatPrintHandler(char* varset, int size)
|
2366
|
+
{
|
2367
|
+
for (int v=0; v<size ; ++v)
|
2368
|
+
{
|
2369
|
+
cout << (varset[v] < 0 ? 'X' : (char)('0' + varset[v]));
|
2370
|
+
}
|
2371
|
+
cout << endl;
|
2372
|
+
}
|
2373
|
+
\end{verbatim}
|
2374
|
+
|
2375
|
+
\noindent
|
2376
|
+
The handler can be used like this:
|
2377
|
+
{\tt bdd\_allsat(r, allsatPrintHandler); } *}
|
2378
|
+
|
2379
|
+
ALSO {* bdd\_satone bdd\_satoneset, bdd\_fullsatone, bdd\_satcount, bdd\_satcountln *}
|
2380
|
+
*/
|
2381
|
+
void bdd_allsat(BDD r, bddallsathandler handler)
|
2382
|
+
{
|
2383
|
+
int v;
|
2384
|
+
|
2385
|
+
CHECKn(r);
|
2386
|
+
|
2387
|
+
if ((allsatProfile=(char*)malloc(bddvarnum)) == NULL)
|
2388
|
+
{
|
2389
|
+
bdd_error(BDD_MEMORY);
|
2390
|
+
return;
|
2391
|
+
}
|
2392
|
+
|
2393
|
+
for (v=LEVEL(r)-1 ; v>=0 ; --v)
|
2394
|
+
allsatProfile[bddlevel2var[v]] = -1;
|
2395
|
+
|
2396
|
+
allsatHandler = handler;
|
2397
|
+
INITREF;
|
2398
|
+
|
2399
|
+
allsat_rec(r);
|
2400
|
+
|
2401
|
+
free(allsatProfile);
|
2402
|
+
}
|
2403
|
+
|
2404
|
+
|
2405
|
+
static void allsat_rec(BDD r)
|
2406
|
+
{
|
2407
|
+
if (ISONE(r))
|
2408
|
+
{
|
2409
|
+
allsatHandler(allsatProfile, bddvarnum);
|
2410
|
+
return;
|
2411
|
+
}
|
2412
|
+
|
2413
|
+
if (ISZERO(r))
|
2414
|
+
return;
|
2415
|
+
|
2416
|
+
if (!ISZERO(LOW(r)))
|
2417
|
+
{
|
2418
|
+
int v;
|
2419
|
+
|
2420
|
+
allsatProfile[bddlevel2var[LEVEL(r)]] = 0;
|
2421
|
+
|
2422
|
+
for (v=LEVEL(LOW(r))-1 ; v>LEVEL(r) ; --v)
|
2423
|
+
{
|
2424
|
+
allsatProfile[bddlevel2var[v]] = -1;
|
2425
|
+
}
|
2426
|
+
|
2427
|
+
allsat_rec(LOW(r));
|
2428
|
+
}
|
2429
|
+
|
2430
|
+
if (!ISZERO(HIGH(r)))
|
2431
|
+
{
|
2432
|
+
int v;
|
2433
|
+
|
2434
|
+
allsatProfile[bddlevel2var[LEVEL(r)]] = 1;
|
2435
|
+
|
2436
|
+
for (v=LEVEL(HIGH(r))-1 ; v>LEVEL(r) ; --v)
|
2437
|
+
{
|
2438
|
+
allsatProfile[bddlevel2var[v]] = -1;
|
2439
|
+
}
|
2440
|
+
|
2441
|
+
allsat_rec(HIGH(r));
|
2442
|
+
}
|
2443
|
+
}
|
2444
|
+
|
2445
|
+
|
2446
|
+
/*=== COUNT NUMBER OF SATISFYING ASSIGNMENT ============================*/
|
2447
|
+
|
2448
|
+
/*
|
2449
|
+
NAME {* bdd\_satcount *}
|
2450
|
+
EXTRA {* bdd\_setcountset *}
|
2451
|
+
SECTION {* info *}
|
2452
|
+
SHORT {* calculates the number of satisfying variable assignments *}
|
2453
|
+
PROTO {* double bdd_satcount(BDD r)
|
2454
|
+
double bdd_satcountset(BDD r, BDD varset) *}
|
2455
|
+
DESCR {* Calculates how many possible variable assignments there exists
|
2456
|
+
such that {\tt r} is satisfied (true). All defined
|
2457
|
+
variables are considered in the first version. In the
|
2458
|
+
second version, only the variables in the variable
|
2459
|
+
set {\tt varset} are considered. This makes the function a
|
2460
|
+
{\em lot} slower. *}
|
2461
|
+
ALSO {* bdd\_satone, bdd\_fullsatone, bdd\_satcountln *}
|
2462
|
+
RETURN {* The number of possible assignments. *}
|
2463
|
+
*/
|
2464
|
+
double bdd_satcount(BDD r)
|
2465
|
+
{
|
2466
|
+
double size=1;
|
2467
|
+
|
2468
|
+
CHECKa(r, 0.0);
|
2469
|
+
|
2470
|
+
miscid = CACHEID_SATCOU;
|
2471
|
+
size = pow(2.0, (double)LEVEL(r));
|
2472
|
+
|
2473
|
+
return size * satcount_rec(r);
|
2474
|
+
}
|
2475
|
+
|
2476
|
+
|
2477
|
+
double bdd_satcountset(BDD r, BDD varset)
|
2478
|
+
{
|
2479
|
+
double unused = bddvarnum;
|
2480
|
+
BDD n;
|
2481
|
+
|
2482
|
+
if (ISCONST(varset) || ISZERO(r)) /* empty set */
|
2483
|
+
return 0.0;
|
2484
|
+
|
2485
|
+
for (n=varset ; !ISCONST(n) ; n=HIGH(n))
|
2486
|
+
unused--;
|
2487
|
+
|
2488
|
+
unused = bdd_satcount(r) / pow(2.0,unused);
|
2489
|
+
|
2490
|
+
return unused >= 1.0 ? unused : 1.0;
|
2491
|
+
}
|
2492
|
+
|
2493
|
+
|
2494
|
+
static double satcount_rec(int root)
|
2495
|
+
{
|
2496
|
+
BddCacheData *entry;
|
2497
|
+
BddNode *node;
|
2498
|
+
double size, s;
|
2499
|
+
|
2500
|
+
if (root < 2)
|
2501
|
+
return root;
|
2502
|
+
|
2503
|
+
entry = BddCache_lookup(&misccache, SATCOUHASH(root));
|
2504
|
+
if (entry->a == root && entry->c == miscid)
|
2505
|
+
return entry->r.dres;
|
2506
|
+
|
2507
|
+
node = &bddnodes[root];
|
2508
|
+
size = 0;
|
2509
|
+
s = 1;
|
2510
|
+
|
2511
|
+
s *= pow(2.0, (float)(LEVEL(LOWp(node)) - LEVELp(node) - 1));
|
2512
|
+
size += s * satcount_rec(LOWp(node));
|
2513
|
+
|
2514
|
+
s = 1;
|
2515
|
+
s *= pow(2.0, (float)(LEVEL(HIGHp(node)) - LEVELp(node) - 1));
|
2516
|
+
size += s * satcount_rec(HIGHp(node));
|
2517
|
+
|
2518
|
+
entry->a = root;
|
2519
|
+
entry->c = miscid;
|
2520
|
+
entry->r.dres = size;
|
2521
|
+
|
2522
|
+
return size;
|
2523
|
+
}
|
2524
|
+
|
2525
|
+
|
2526
|
+
/*
|
2527
|
+
NAME {* bdd\_satcountln *}
|
2528
|
+
EXTRA {* bdd\_setcountlnset *}
|
2529
|
+
SECTION {* info *}
|
2530
|
+
SHORT {* calculates the log. number of satisfying variable assignments *}
|
2531
|
+
PROTO {* double bdd_satcountln(BDD r)
|
2532
|
+
double bdd_satcountlnset(BDD r, BDD varset)*}
|
2533
|
+
DESCR {* Calculates how many possible variable assignments there
|
2534
|
+
exists such that {\tt r} is satisfied (true) and returns
|
2535
|
+
the logarithm of this. The result is calculated in such a
|
2536
|
+
manner that it is practically impossible to get an
|
2537
|
+
overflow, which is very possible for {\tt bdd\_satcount} if
|
2538
|
+
the number of defined variables is too large. All defined
|
2539
|
+
variables are considered in the first version. In the
|
2540
|
+
second version, only the variables in the variable
|
2541
|
+
set {\tt varset} are considered. This makes the function
|
2542
|
+
a {\em lot} slower! *}
|
2543
|
+
ALSO {* bdd\_satone, bdd\_fullsatone, bdd\_satcount *}
|
2544
|
+
RETURN {* The logarithm of the number of possible assignments. *} */
|
2545
|
+
double bdd_satcountln(BDD r)
|
2546
|
+
{
|
2547
|
+
double size;
|
2548
|
+
|
2549
|
+
CHECKa(r, 0.0);
|
2550
|
+
|
2551
|
+
miscid = CACHEID_SATCOULN;
|
2552
|
+
size = satcountln_rec(r);
|
2553
|
+
|
2554
|
+
if (size >= 0.0)
|
2555
|
+
size += LEVEL(r);
|
2556
|
+
|
2557
|
+
return size;
|
2558
|
+
}
|
2559
|
+
|
2560
|
+
|
2561
|
+
double bdd_satcountlnset(BDD r, BDD varset)
|
2562
|
+
{
|
2563
|
+
double unused = bddvarnum;
|
2564
|
+
BDD n;
|
2565
|
+
|
2566
|
+
if (ISCONST(varset)) /* empty set */
|
2567
|
+
return 0.0;
|
2568
|
+
|
2569
|
+
for (n=varset ; !ISCONST(n) ; n=HIGH(n))
|
2570
|
+
unused--;
|
2571
|
+
|
2572
|
+
unused = bdd_satcountln(r) - unused;
|
2573
|
+
|
2574
|
+
return unused >= 0.0 ? unused : 0.0;
|
2575
|
+
}
|
2576
|
+
|
2577
|
+
|
2578
|
+
static double satcountln_rec(int root)
|
2579
|
+
{
|
2580
|
+
BddCacheData *entry;
|
2581
|
+
BddNode *node;
|
2582
|
+
double size, s1,s2;
|
2583
|
+
|
2584
|
+
if (root == 0)
|
2585
|
+
return -1.0;
|
2586
|
+
if (root == 1)
|
2587
|
+
return 0.0;
|
2588
|
+
|
2589
|
+
entry = BddCache_lookup(&misccache, SATCOUHASH(root));
|
2590
|
+
if (entry->a == root && entry->c == miscid)
|
2591
|
+
return entry->r.dres;
|
2592
|
+
|
2593
|
+
node = &bddnodes[root];
|
2594
|
+
|
2595
|
+
s1 = satcountln_rec(LOWp(node));
|
2596
|
+
if (s1 >= 0.0)
|
2597
|
+
s1 += LEVEL(LOWp(node)) - LEVELp(node) - 1;
|
2598
|
+
|
2599
|
+
s2 = satcountln_rec(HIGHp(node));
|
2600
|
+
if (s2 >= 0.0)
|
2601
|
+
s2 += LEVEL(HIGHp(node)) - LEVELp(node) - 1;
|
2602
|
+
|
2603
|
+
if (s1 < 0.0)
|
2604
|
+
size = s2;
|
2605
|
+
else if (s2 < 0.0)
|
2606
|
+
size = s1;
|
2607
|
+
else if (s1 < s2)
|
2608
|
+
size = s2 + log1p(pow(2.0,s1-s2)) / M_LN2;
|
2609
|
+
else
|
2610
|
+
size = s1 + log1p(pow(2.0,s2-s1)) / M_LN2;
|
2611
|
+
|
2612
|
+
entry->a = root;
|
2613
|
+
entry->c = miscid;
|
2614
|
+
entry->r.dres = size;
|
2615
|
+
|
2616
|
+
return size;
|
2617
|
+
}
|
2618
|
+
|
2619
|
+
|
2620
|
+
/*=== COUNT NUMBER OF ALLOCATED NODES ==================================*/
|
2621
|
+
|
2622
|
+
/*
|
2623
|
+
NAME {* bdd\_nodecount *}
|
2624
|
+
SECTION {* info *}
|
2625
|
+
SHORT {* counts the number of nodes used for a BDD *}
|
2626
|
+
PROTO {* int bdd_nodecount(BDD r) *}
|
2627
|
+
DESCR {* Traverses the BDD and counts all distinct nodes that are used
|
2628
|
+
for the BDD. *}
|
2629
|
+
RETURN {* The number of nodes. *}
|
2630
|
+
ALSO {* bdd\_pathcount, bdd\_satcount, bdd\_anodecount *}
|
2631
|
+
*/
|
2632
|
+
int bdd_nodecount(BDD r)
|
2633
|
+
{
|
2634
|
+
int num=0;
|
2635
|
+
|
2636
|
+
CHECK(r);
|
2637
|
+
|
2638
|
+
bdd_markcount(r, &num);
|
2639
|
+
bdd_unmark(r);
|
2640
|
+
|
2641
|
+
return num;
|
2642
|
+
}
|
2643
|
+
|
2644
|
+
|
2645
|
+
/*
|
2646
|
+
NAME {* bdd\_anodecount *}
|
2647
|
+
SECTION {* info *}
|
2648
|
+
SHORT {* counts the number of shared nodes in an array of BDDs *}
|
2649
|
+
PROTO {* int bdd_anodecount(BDD *r, int num) *}
|
2650
|
+
DESCR {* Traverses all of the BDDs in {\tt r} and counts all distinct nodes
|
2651
|
+
that are used in the BDDs--if a node is used in more than one
|
2652
|
+
BDD then it only counts once. The {\tt num} parameter holds the
|
2653
|
+
size of the array. *}
|
2654
|
+
RETURN {* The number of nodes *}
|
2655
|
+
ALSO {* bdd\_nodecount *}
|
2656
|
+
*/
|
2657
|
+
int bdd_anodecount(BDD *r, int num)
|
2658
|
+
{
|
2659
|
+
int n;
|
2660
|
+
int cou=0;
|
2661
|
+
|
2662
|
+
for (n=0 ; n<num ; n++)
|
2663
|
+
bdd_markcount(r[n], &cou);
|
2664
|
+
|
2665
|
+
for (n=0 ; n<num ; n++)
|
2666
|
+
bdd_unmark(r[n]);
|
2667
|
+
|
2668
|
+
return cou;
|
2669
|
+
}
|
2670
|
+
|
2671
|
+
|
2672
|
+
/*=== NODE PROFILE =====================================================*/
|
2673
|
+
|
2674
|
+
/*
|
2675
|
+
NAME {* bdd\_varprofile *}
|
2676
|
+
SECTION {* info *}
|
2677
|
+
SHORT {* returns a variable profile *}
|
2678
|
+
PROTO {* int *bdd_varprofile(BDD r) *}
|
2679
|
+
DESCR {* Counts the number of times each variable occurs in the
|
2680
|
+
bdd {\tt r}. The result is stored and returned in an integer array
|
2681
|
+
where the i'th position stores the number of times the i'th
|
2682
|
+
variable occured in the BDD. It is the users responsibility to
|
2683
|
+
free the array again using a call to {\tt free}. *}
|
2684
|
+
RETURN {* A pointer to an integer array with the profile or NULL if an
|
2685
|
+
error occured. *}
|
2686
|
+
*/
|
2687
|
+
int *bdd_varprofile(BDD r)
|
2688
|
+
{
|
2689
|
+
CHECKa(r, NULL);
|
2690
|
+
|
2691
|
+
if ((varprofile=(int*)malloc(sizeof(int)*bddvarnum)) == NULL)
|
2692
|
+
{
|
2693
|
+
bdd_error(BDD_MEMORY);
|
2694
|
+
return NULL;
|
2695
|
+
}
|
2696
|
+
|
2697
|
+
memset(varprofile, 0, sizeof(int)*bddvarnum);
|
2698
|
+
varprofile_rec(r);
|
2699
|
+
bdd_unmark(r);
|
2700
|
+
return varprofile;
|
2701
|
+
}
|
2702
|
+
|
2703
|
+
|
2704
|
+
static void varprofile_rec(int r)
|
2705
|
+
{
|
2706
|
+
BddNode *node;
|
2707
|
+
|
2708
|
+
if (r < 2)
|
2709
|
+
return;
|
2710
|
+
|
2711
|
+
node = &bddnodes[r];
|
2712
|
+
if (LEVELp(node) & MARKON)
|
2713
|
+
return;
|
2714
|
+
|
2715
|
+
varprofile[bddlevel2var[LEVELp(node)]]++;
|
2716
|
+
LEVELp(node) |= MARKON;
|
2717
|
+
|
2718
|
+
varprofile_rec(LOWp(node));
|
2719
|
+
varprofile_rec(HIGHp(node));
|
2720
|
+
}
|
2721
|
+
|
2722
|
+
|
2723
|
+
/*=== COUNT NUMBER OF PATHS ============================================*/
|
2724
|
+
|
2725
|
+
/*
|
2726
|
+
NAME {* bdd\_pathcount *}
|
2727
|
+
SECTION {* info *}
|
2728
|
+
SHORT {* count the number of paths leading to the true terminal *}
|
2729
|
+
PROTO {* double bdd_pathcount(BDD r) *}
|
2730
|
+
DESCR {* Counts the number of paths from the root node {\tt r}
|
2731
|
+
leading to the terminal true node. *}
|
2732
|
+
RETURN {* The number of paths *}
|
2733
|
+
ALSO {* bdd\_nodecount, bdd\_satcount *}
|
2734
|
+
*/
|
2735
|
+
double bdd_pathcount(BDD r)
|
2736
|
+
{
|
2737
|
+
CHECKa(r, 0.0);
|
2738
|
+
|
2739
|
+
miscid = CACHEID_PATHCOU;
|
2740
|
+
|
2741
|
+
return bdd_pathcount_rec(r);
|
2742
|
+
}
|
2743
|
+
|
2744
|
+
|
2745
|
+
static double bdd_pathcount_rec(BDD r)
|
2746
|
+
{
|
2747
|
+
BddCacheData *entry;
|
2748
|
+
double size;
|
2749
|
+
|
2750
|
+
if (ISZERO(r))
|
2751
|
+
return 0.0;
|
2752
|
+
if (ISONE(r))
|
2753
|
+
return 1.0;
|
2754
|
+
|
2755
|
+
entry = BddCache_lookup(&misccache, PATHCOUHASH(r));
|
2756
|
+
if (entry->a == r && entry->c == miscid)
|
2757
|
+
return entry->r.dres;
|
2758
|
+
|
2759
|
+
size = bdd_pathcount_rec(LOW(r)) + bdd_pathcount_rec(HIGH(r));
|
2760
|
+
|
2761
|
+
entry->a = r;
|
2762
|
+
entry->c = miscid;
|
2763
|
+
entry->r.dres = size;
|
2764
|
+
|
2765
|
+
return size;
|
2766
|
+
}
|
2767
|
+
|
2768
|
+
|
2769
|
+
/*************************************************************************
|
2770
|
+
Other internal functions
|
2771
|
+
*************************************************************************/
|
2772
|
+
|
2773
|
+
static int varset2vartable(BDD r)
|
2774
|
+
{
|
2775
|
+
BDD n;
|
2776
|
+
|
2777
|
+
if (r < 2)
|
2778
|
+
return bdd_error(BDD_VARSET);
|
2779
|
+
|
2780
|
+
quantvarsetID++;
|
2781
|
+
|
2782
|
+
if (quantvarsetID == INT_MAX)
|
2783
|
+
{
|
2784
|
+
memset(quantvarset, 0, sizeof(int)*bddvarnum);
|
2785
|
+
quantvarsetID = 1;
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
/* printf(" %d == %d ? %d", r, bddvarnum, (r== bddvarnum)); */
|
2789
|
+
/* if (r == bddvarnum) { */
|
2790
|
+
/* printf("get more vars\n"); */
|
2791
|
+
/* bdd_extvarnum(10); */
|
2792
|
+
/* memset(quantvarset, 0, sizeof(int)*bddvarnum); */
|
2793
|
+
/* quantvarsetID = 1; */
|
2794
|
+
/* } */
|
2795
|
+
|
2796
|
+
/* printf(" size varset = %d , size varnum = %d", (sizeof(quantvarset)), bddvarnum); */
|
2797
|
+
/* assert(sizeof(quantvarset) > sizeof(int) * bddvarnum); */
|
2798
|
+
/* printf(" not more than %d\n",bddvarnum); */
|
2799
|
+
/* printf(" ID = %d\n",quantvarsetID); */
|
2800
|
+
|
2801
|
+
for (n=r ; n > 1 ; n=HIGH(n))
|
2802
|
+
{
|
2803
|
+
/* printf(" accessing: %d -- %d\n",n, LEVEL(n)); */
|
2804
|
+
quantvarset[LEVEL(n)] = quantvarsetID;
|
2805
|
+
quantlast = LEVEL(n);
|
2806
|
+
}
|
2807
|
+
|
2808
|
+
return 0;
|
2809
|
+
}
|
2810
|
+
|
2811
|
+
|
2812
|
+
static int varset2svartable(BDD r)
|
2813
|
+
{
|
2814
|
+
BDD n;
|
2815
|
+
|
2816
|
+
if (r < 2)
|
2817
|
+
return bdd_error(BDD_VARSET);
|
2818
|
+
|
2819
|
+
quantvarsetID++;
|
2820
|
+
|
2821
|
+
if (quantvarsetID == INT_MAX/2)
|
2822
|
+
{
|
2823
|
+
memset(quantvarset, 0, sizeof(int)*bddvarnum);
|
2824
|
+
quantvarsetID = 1;
|
2825
|
+
}
|
2826
|
+
|
2827
|
+
for (n=r ; !ISCONST(n) ; )
|
2828
|
+
{
|
2829
|
+
if (ISZERO(LOW(n)))
|
2830
|
+
{
|
2831
|
+
quantvarset[LEVEL(n)] = quantvarsetID;
|
2832
|
+
n = HIGH(n);
|
2833
|
+
}
|
2834
|
+
else
|
2835
|
+
{
|
2836
|
+
quantvarset[LEVEL(n)] = -quantvarsetID;
|
2837
|
+
n = LOW(n);
|
2838
|
+
}
|
2839
|
+
quantlast = LEVEL(n);
|
2840
|
+
}
|
2841
|
+
|
2842
|
+
return 0;
|
2843
|
+
}
|
2844
|
+
|
2845
|
+
|
2846
|
+
/* EOF */
|
2847
|
+
|
2848
|
+
// STATISTICS: buddy-any
|