You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1637 lines
59 KiB

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  2. <!--Converted with LaTeX2HTML 2008 (1.71)
  3. original version by: Nikos Drakos, CBLU, University of Leeds
  4. * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
  5. * with significant contributions from:
  6. Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
  7. <HTML>
  8. <HEAD>
  9. <TITLE>User's Manual</TITLE>
  10. <META NAME="description" CONTENT="User's Manual">
  11. <META NAME="keywords" CONTENT="cuddIntro">
  12. <META NAME="resource-type" CONTENT="document">
  13. <META NAME="distribution" CONTENT="global">
  14. <META NAME="Generator" CONTENT="LaTeX2HTML v2008">
  15. <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
  16. <LINK REL="STYLESHEET" HREF="cuddIntro.css">
  17. <LINK REL="next" HREF="node4.html">
  18. <LINK REL="previous" HREF="node2.html">
  19. <LINK REL="up" HREF="cuddIntro.html">
  20. <LINK REL="next" HREF="node4.html">
  21. </HEAD>
  22. <BODY >
  23. <!--Navigation Panel-->
  24. <A NAME="tex2html112"
  25. HREF="node4.html">
  26. <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
  27. SRC="icons/next.png"></A>
  28. <A NAME="tex2html108"
  29. HREF="cuddIntro.html">
  30. <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
  31. SRC="icons/up.png"></A>
  32. <A NAME="tex2html102"
  33. HREF="node2.html">
  34. <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
  35. SRC="icons/prev.png"></A>
  36. <A NAME="tex2html110"
  37. HREF="node8.html">
  38. <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
  39. SRC="icons/index.png"></A>
  40. <BR>
  41. <B> Next:</B> <A NAME="tex2html113"
  42. HREF="node4.html">Programmer's Manual</A>
  43. <B> Up:</B> <A NAME="tex2html109"
  44. HREF="cuddIntro.html">CUDD: CU Decision Diagram</A>
  45. <B> Previous:</B> <A NAME="tex2html103"
  46. HREF="node2.html">How to Get CUDD</A>
  47. &nbsp; <B> <A NAME="tex2html111"
  48. HREF="node8.html">Index</A></B>
  49. <BR>
  50. <BR>
  51. <!--End of Navigation Panel-->
  52. <!--Table of Child-Links-->
  53. <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
  54. <UL>
  55. <LI><A NAME="tex2html114"
  56. HREF="node3.html#SECTION00031000000000000000">Compiling and Linking</A>
  57. <LI><A NAME="tex2html115"
  58. HREF="node3.html#SECTION00032000000000000000">Basic Data Structures</A>
  59. <UL>
  60. <LI><A NAME="tex2html116"
  61. HREF="node3.html#SECTION00032100000000000000">Nodes</A>
  62. <LI><A NAME="tex2html117"
  63. HREF="node3.html#SECTION00032200000000000000">The Manager</A>
  64. <LI><A NAME="tex2html118"
  65. HREF="node3.html#SECTION00032300000000000000">Cache</A>
  66. </UL>
  67. <BR>
  68. <LI><A NAME="tex2html119"
  69. HREF="node3.html#SECTION00033000000000000000">Initializing and Shutting Down a DdManager</A>
  70. <LI><A NAME="tex2html120"
  71. HREF="node3.html#SECTION00034000000000000000">Setting Parameters</A>
  72. <LI><A NAME="tex2html121"
  73. HREF="node3.html#SECTION00035000000000000000">Constant Functions</A>
  74. <UL>
  75. <LI><A NAME="tex2html122"
  76. HREF="node3.html#SECTION00035100000000000000">One, Logic Zero, and Arithmetic Zero</A>
  77. <LI><A NAME="tex2html123"
  78. HREF="node3.html#SECTION00035200000000000000">Predefined Constants</A>
  79. <LI><A NAME="tex2html124"
  80. HREF="node3.html#SECTION00035300000000000000">Background</A>
  81. <LI><A NAME="tex2html125"
  82. HREF="node3.html#SECTION00035400000000000000">New Constants</A>
  83. </UL>
  84. <BR>
  85. <LI><A NAME="tex2html126"
  86. HREF="node3.html#SECTION00036000000000000000">Creating Variables</A>
  87. <UL>
  88. <LI><A NAME="tex2html127"
  89. HREF="node3.html#SECTION00036100000000000000">New BDD and ADD Variables</A>
  90. <LI><A NAME="tex2html128"
  91. HREF="node3.html#SECTION00036200000000000000">New ZDD Variables</A>
  92. </UL>
  93. <BR>
  94. <LI><A NAME="tex2html129"
  95. HREF="node3.html#SECTION00037000000000000000">Basic BDD Manipulation</A>
  96. <LI><A NAME="tex2html130"
  97. HREF="node3.html#SECTION00038000000000000000">Basic ADD Manipulation</A>
  98. <LI><A NAME="tex2html131"
  99. HREF="node3.html#SECTION00039000000000000000">Basic ZDD Manipulation</A>
  100. <LI><A NAME="tex2html132"
  101. HREF="node3.html#SECTION000310000000000000000">Converting ADDs to BDDs and Vice Versa</A>
  102. <LI><A NAME="tex2html133"
  103. HREF="node3.html#SECTION000311000000000000000">Converting BDDs to ZDDs and Vice Versa</A>
  104. <LI><A NAME="tex2html134"
  105. HREF="node3.html#SECTION000312000000000000000">Variable Reordering for BDDs and ADDs</A>
  106. <LI><A NAME="tex2html135"
  107. HREF="node3.html#SECTION000313000000000000000">Grouping Variables</A>
  108. <LI><A NAME="tex2html136"
  109. HREF="node3.html#SECTION000314000000000000000">Variable Reordering for ZDDs</A>
  110. <LI><A NAME="tex2html137"
  111. HREF="node3.html#SECTION000315000000000000000">Keeping Consistent Variable Orders for BDDs and ZDDs</A>
  112. <LI><A NAME="tex2html138"
  113. HREF="node3.html#SECTION000316000000000000000">Hooks</A>
  114. <LI><A NAME="tex2html139"
  115. HREF="node3.html#SECTION000317000000000000000">Timeouts and Limits</A>
  116. <LI><A NAME="tex2html140"
  117. HREF="node3.html#SECTION000318000000000000000">The SIS/VIS Interface</A>
  118. <UL>
  119. <LI><A NAME="tex2html141"
  120. HREF="node3.html#SECTION000318100000000000000">Using the CUDD Package in SIS</A>
  121. </UL>
  122. <BR>
  123. <LI><A NAME="tex2html142"
  124. HREF="node3.html#SECTION000319000000000000000">Writing Decision Diagrams to a File</A>
  125. <LI><A NAME="tex2html143"
  126. HREF="node3.html#SECTION000320000000000000000">Saving and Restoring BDDs</A>
  127. </UL>
  128. <!--End of Table of Child-Links-->
  129. <HR>
  130. <H1><A NAME="SECTION00030000000000000000"></A>
  131. <A NAME="sec:user"></A>
  132. <BR>
  133. User's Manual
  134. </H1>
  135. <P>
  136. This section describes the use of the CUDD package as a black box.
  137. <P>
  138. <H2><A NAME="SECTION00031000000000000000"></A>
  139. <A NAME="sec:compileExt"></A><A NAME="79"></A>
  140. <BR>
  141. Compiling and Linking
  142. </H2>
  143. <P>
  144. To build an application that uses the CUDD package, you should add
  145. <PRE>
  146. #include "util.h"
  147. #include "cudd.h"
  148. </PRE>
  149. <A NAME="82"></A>
  150. to your source files, and should link
  151. <code>libcudd.a</code><A NAME="83"></A>,
  152. <code>libmtr.a</code><A NAME="84"></A>,
  153. <code>libst.a</code><A NAME="85"></A>, and
  154. <code>libutil.a</code><A NAME="86"></A> to your executable. (All these
  155. libraries are part of the distribution.) Some
  156. platforms require specific compiler and linker flags. Refer to the
  157. <TT>Makefile<A NAME="87"></A></TT> in the top level directory of the
  158. distribution.
  159. <P>
  160. Keep in mind that whatever flags affect the size of data
  161. structures--for instance the flags used to use 64-bit pointers where
  162. available--must be specified when compiling both CUDD and the files
  163. that include its header files.
  164. <P>
  165. <H2><A NAME="SECTION00032000000000000000"></A>
  166. <A NAME="sec:struct"></A>
  167. <BR>
  168. Basic Data Structures
  169. </H2>
  170. <P>
  171. <H3><A NAME="SECTION00032100000000000000"></A>
  172. <A NAME="sec:nodes"></A>
  173. <BR>
  174. Nodes
  175. </H3>
  176. <P>
  177. BDDs, ADDs, and ZDDs are made of DdNode's. A DdNode<A NAME="92"></A>
  178. (node<A NAME="93"></A> for short) is a structure with several fields. Those
  179. that are of interest to the application that uses the CUDD package as
  180. a black box are the variable index<A NAME="94"></A>, the
  181. reference<A NAME="95"></A> count, and the value. The
  182. remaining fields are pointers that connect nodes among themselves and
  183. that are used to implement the unique<A NAME="96"></A> table. (See
  184. Section&nbsp;<A HREF="#sec:manager">3.2.2</A>.)
  185. <P>
  186. The <I>index</I> field holds the name of the variable that labels the
  187. node. The index of a variable is a permanent attribute that reflects
  188. the order<A NAME="99"></A> of creation. Index 0 corresponds to
  189. the variable created first. On a machine with 32-bit pointers, the
  190. maximum number of variables is the largest value that can be stored in
  191. an unsigned short integer minus 1. The largest index is reserved for
  192. the constant<A NAME="100"></A> nodes. When 64-bit pointers are
  193. used, the maximum number of variables is the largest value that can be
  194. stored in an unsigned integer minus 1.
  195. <P>
  196. When variables are reordered to reduce the size of the decision
  197. diagrams, the variables may shift in the order, but they retain their
  198. indices. The package keeps track of the variable
  199. permutation<A NAME="101"></A> (and its inverse). The
  200. application is not affected by variable reordering<A NAME="102"></A>,
  201. except in the following cases.
  202. <UL>
  203. <LI>If the application uses generators<A NAME="104"></A>
  204. (<I>Cudd_ForeachCube</I> <A NAME="1108"></A> and
  205. <I>Cudd_ForeachNode</I><A NAME="1110"></A>) and reordering is
  206. enabled, then it must take care not to call any operation that may
  207. create new nodes (and hence possibly trigger reordering). This is
  208. because the cubes (i.e., paths) and nodes of a diagram change as a
  209. result of reordering.
  210. </LI>
  211. <LI>If the application uses
  212. <I>Cudd_bddConstrain</I><A NAME="1112"></A> and reordering
  213. takes place, then the property of <I>Cudd_bddConstrain</I> of
  214. being an image restrictor is lost.
  215. </LI>
  216. </UL>
  217. <P>
  218. The CUDD package relies on garbage<A NAME="113"></A>
  219. collection to reclaim the memory used by diagrams that are no longer
  220. in use. The scheme employed for garbage collection is based on keeping
  221. a reference<A NAME="114"></A> count for each node. The
  222. references that are counted are both the internal references
  223. (references from other nodes) and external references (typically
  224. references from the calling environment). When an application creates
  225. a new BDD<A NAME="115"></A>, ADD<A NAME="116"></A>, or ZDD<A NAME="117"></A>, it must
  226. increase its reference count explicitly, through a call to
  227. <I>Cudd_Ref</I><A NAME="1114"></A>. Similarly, when a diagram is no
  228. longer needed, the application must call
  229. <I>Cudd_RecursiveDeref</I><A NAME="1116"></A> (for BDDs and
  230. ADDs) or <I>Cudd_RecursiveDerefZdd</I><A NAME="1118"></A>
  231. (for ZDDs) to ``recycle<A NAME="124"></A>'' the nodes of the
  232. diagram.
  233. <P>
  234. Terminal<A NAME="125"></A> nodes carry a value. This is especially
  235. important for ADDs. By default, the value is a double<A NAME="126"></A>.
  236. To change to something different (e.g., an integer), the
  237. package must be modified and recompiled. Support for this process is
  238. currently very rudimentary.
  239. <P>
  240. <H3><A NAME="SECTION00032200000000000000"></A>
  241. <A NAME="128"></A><A NAME="sec:manager"></A>
  242. <BR>
  243. The Manager
  244. </H3>
  245. <P>
  246. All nodes used in BDDs, ADDs, and ZDDs are kept in special
  247. hash<A NAME="130"></A> tables called the
  248. <I>unique<A NAME="131"></A> tables</I>. Specifically, BDDs and ADDs
  249. share the same unique table, whereas ZDDs have their own table. As
  250. the name implies, the main purpose of the unique table is to guarantee
  251. that each node is unique; that is, there is no other node labeled by
  252. the same variable and with the same children. This uniqueness
  253. property makes decision diagrams canonical<A NAME="132"></A>. The
  254. unique<A NAME="133"></A> tables and some auxiliary data structures
  255. make up the DdManager<A NAME="134"></A> (manager<A NAME="135"></A> for
  256. short). Though the application that uses only the exported functions
  257. needs not be concerned with most details of the manager, it has to
  258. deal with the manager in the following sense. The application must
  259. initialize the manager by calling an appropriate function. (See
  260. Section&nbsp;<A HREF="#sec:init">3.3</A>.) Subsequently, it must pass a pointer to the
  261. manager to all the functions that operate on decision diagrams.
  262. <P>
  263. With the exception of a few statistical counters<A NAME="137"></A>, there are no global<A NAME="138"></A> variables in
  264. the CUDD package. Therefore, it is quite possible to have multiple
  265. managers simultaneously active in the same application.<A NAME="tex2html3"
  266. HREF="footnode.html#foot139"><SUP>1</SUP></A> It is the pointers to
  267. the managers that tell the functions on what data they should operate.
  268. <P>
  269. <H3><A NAME="SECTION00032300000000000000"></A>
  270. <A NAME="141"></A><A NAME="sec:memoize"></A>
  271. <BR>
  272. Cache
  273. </H3>
  274. <P>
  275. Efficient recursive manipulation of decision diagrams requires the use
  276. of a table to store computed results. This table<A NAME="143"></A>
  277. is called here the <I>cache<A NAME="144"></A></I> because it is
  278. effectively handled like a cache of variable but limited capacity. The
  279. CUDD package starts by default with a small cache, and increases its
  280. size until either no further benefit is achieved, or a limit size is
  281. reached. The user can influence this policy by choosing initial and
  282. limit values for the cache size.
  283. <P>
  284. Too small a cache will cause frequent overwriting of useful results.
  285. Too large a cache will cause overhead, because the whole cache is
  286. scanned every time garbage<A NAME="145"></A> collection takes
  287. place. The optimal parameters depend on the specific application. The
  288. default parameters work reasonably well for a large spectrum of
  289. applications.
  290. <P>
  291. The cache<A NAME="146"></A> of the CUDD package is used by most recursive
  292. functions of the package, and can be used by user-supplied functions
  293. as well. (See Section&nbsp;<A HREF="node4.html#sec:cache">4.4</A>.)
  294. <P>
  295. <H2><A NAME="SECTION00033000000000000000"></A>
  296. <A NAME="149"></A><A NAME="sec:init"></A>
  297. <BR>
  298. Initializing and Shutting Down a DdManager
  299. </H2>
  300. <P>
  301. To use the functions in the CUDD package, one has first to initialize
  302. the package itself by calling <I>Cudd_Init</I><A NAME="1120"></A>.
  303. This function takes four parameters:
  304. <UL>
  305. <LI>numVars<A NAME="154"></A>: It is the initial number of variables
  306. for BDDs and ADDs. If the total number of variables needed by the
  307. application is known, then it is slightly more efficient to create a
  308. manager with that number of variables. If the number is unknown, it
  309. can be set to 0, or to any other lower bound on the number of
  310. variables. Requesting more variables than are actually needed is
  311. not incorrect, but is not efficient.
  312. </LI>
  313. <LI>numVarsZ<A NAME="155"></A>: It is the initial number of variables
  314. for ZDDs. See Sections&nbsp;<A HREF="#sec:basicZDD">3.9</A> and&nbsp;<A HREF="#sec:convertZ">3.11</A> for
  315. a discussion of the value of this argument.
  316. </LI>
  317. <LI>numSlots<A NAME="158"></A>: Determines the initial size of each
  318. subtable<A NAME="159"></A> of the unique<A NAME="160"></A> table.
  319. There is a subtable for each variable. The size of each subtable is
  320. dynamically adjusted to reflect the number of nodes. It is normally
  321. O.K. to use the default value for this parameter, which is
  322. CUDD_UNIQUE_SLOTS<A NAME="161"></A>.
  323. </LI>
  324. <LI>cacheSize<A NAME="162"></A>: It is the initial size (number of
  325. entries) of the cache<A NAME="163"></A>. Its default value is
  326. CUDD_CACHE_SLOTS<A NAME="164"></A>.
  327. </LI>
  328. <LI>maxMemory<A NAME="165"></A>: It is the target value for the
  329. maximum memory occupation (in bytes). The package uses this value to
  330. decide two parameters.
  331. <UL>
  332. <LI>the maximum size to which the cache will grow, regardless of
  333. the hit rate or the size of the unique<A NAME="167"></A> table.
  334. </LI>
  335. <LI>the maximum size to which growth of the unique table will be
  336. preferred to garbage collection.
  337. </LI>
  338. </UL>
  339. If maxMemory is set to 0, CUDD tries to guess a good value based on
  340. the available memory.
  341. </LI>
  342. </UL>
  343. A typical call to <I>Cudd_Init</I><A NAME="1122"></A> may look
  344. like this:
  345. <PRE>
  346. manager = Cudd_Init(0,0,CUDD_UNIQUE_SLOTS,CUDD_CACHE_SLOTS,0);
  347. </PRE>
  348. To reclaim all the memory associated with a manager, an application
  349. must call <I>Cudd_Quit</I><A NAME="1124"></A>. This is normally
  350. done before exiting.
  351. <P>
  352. <H2><A NAME="SECTION00034000000000000000"></A>
  353. <A NAME="sec:params"></A>
  354. <BR>
  355. Setting Parameters
  356. </H2>
  357. <P>
  358. The package provides several functions to set the parameters that
  359. control various functions. For instance, the package has an automatic
  360. way of determining whether a larger unique<A NAME="178"></A> table
  361. would make the application run faster. In that case, the package
  362. enters a ``fast growth<A NAME="179"></A>'' mode in which resizing of
  363. the unique subtables is favored over garbage<A NAME="180"></A>
  364. collection. When the unique table reaches a given size, however, the
  365. package returns to the normal ``slow growth'' mode, even though the
  366. conditions that caused the transition to fast growth still prevail.
  367. The limit size for fast growth<A NAME="181"></A> can be read by
  368. <I>Cudd_ReadLooseUpTo</I><A NAME="1126"></A> and changed by
  369. <I>Cudd_SetLooseUpTo</I><A NAME="1128"></A>. Similar pairs of
  370. functions exist for several other parameters. See also
  371. Section&nbsp;<A HREF="node4.html#sec:stats">4.8</A>.
  372. <P>
  373. <H2><A NAME="SECTION00035000000000000000"></A>
  374. <A NAME="188"></A><A NAME="sec:const"></A>
  375. <BR>
  376. Constant Functions
  377. </H2>
  378. <P>
  379. The CUDD Package defines several constant functions. These functions
  380. are created when the manager<A NAME="190"></A> is initialized, and are accessible
  381. through the manager itself.
  382. <P>
  383. <H3><A NAME="SECTION00035100000000000000"></A>
  384. <A NAME="192"></A><A NAME="193"></A><A NAME="sec:zero"></A>
  385. <BR>
  386. One, Logic Zero, and Arithmetic Zero
  387. </H3>
  388. <P>
  389. The constant<A NAME="195"></A> 1 (returned by
  390. <I>Cudd_ReadOne</I><A NAME="1130"></A>) is common to BDDs, ADDs, and
  391. ZDDs. However, its meaning is different for ADDs and BDDs, on the one
  392. hand, and ZDDs, on the other hand. The diagram consisting of the
  393. constant 1 node only represents the constant 1 function for ADDs and
  394. BDDs. For ZDDs, its meaning depends on the number of variables: It is
  395. the conjunction of the complements of all variables. Conversely, the
  396. representation of the constant 1 function depends on the number of
  397. variables. The constant 1 function of <IMG
  398. WIDTH="15" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  399. SRC="img4.png"
  400. ALT="$n$"> variables is returned by
  401. <I>Cudd_ReadZddOne</I><A NAME="1132"></A>.
  402. <P>
  403. The constant 0 is common to ADDs and ZDDs, but not to BDDs. The
  404. BDD<A NAME="200"></A> logic 0 is <B>not</B> associated with the constant 0
  405. function: It is obtained by complementation
  406. (<I>Cudd_Not</I><A NAME="1134"></A>) of the constant 1. (It is also
  407. returned by <I>Cudd_ReadLogicZero</I><A NAME="1136"></A>.)
  408. All other constants are specific to ADDs.
  409. <P>
  410. <H3><A NAME="SECTION00035200000000000000"></A>
  411. <A NAME="sec:predef-const"></A>
  412. <BR>
  413. Predefined Constants
  414. </H3>
  415. <P>
  416. Besides 0 (returned by <I>Cudd_ReadZero</I><A NAME="1138"></A>)
  417. and 1, the following constant<A NAME="210"></A> functions are
  418. created at initialization time.
  419. <OL>
  420. <LI>PlusInfinity<A NAME="212"></A> and
  421. MinusInfinity<A NAME="213"></A>: On computers implementing the
  422. IEEE<A NAME="214"></A> standard 754 for
  423. floating-point<A NAME="215"></A> arithmetic, these two constants
  424. are set to the signed infinities<A NAME="216"></A>. On the DEC
  425. Alphas<A NAME="217"></A>, the option <code>-ieee_with_no_inexact</code> or
  426. <code>-ieee_with_inexact</code> must be passed to the DEC compiler to get
  427. support of the IEEE standard. (The compiler still produces a
  428. warning, but it can be ignored.) Compiling<A NAME="218"></A> with
  429. those options may cause substantial performance degradation on the
  430. Evolution IV CPUs. (Especially if the application does use the
  431. infinities.) The problem is reportedly solved in the Evolution V
  432. CPUs. If <TT>gcc<A NAME="219"></A></TT> is used to compile CUDD on the
  433. Alphas, the symbol <TT>HAVE_IEEE_754<A NAME="220"></A></TT>
  434. must be undefined. (See the Makefile<A NAME="221"></A> for the
  435. details.) The values of these constants are returned by
  436. <I>Cudd_ReadPlusInfinity</I><A NAME="1140"></A> and
  437. <I>Cudd_ReadMinusInfinity</I><A NAME="1142"></A>.
  438. </LI>
  439. <LI>Epsilon<A NAME="226"></A>: This constant, initially set to
  440. <IMG
  441. WIDTH="47" HEIGHT="18" ALIGN="BOTTOM" BORDER="0"
  442. SRC="img5.png"
  443. ALT="$10^{-12}$">, is used in comparing floating point values for equality.
  444. Its value is returned by
  445. <I>Cudd_ReadEpsilon</I><A NAME="1144"></A>, and it can be
  446. modified by calling <I>Cudd_SetEpsilon</I><A NAME="1146"></A>.
  447. Unlike the other constants, it does not correspond to a node.
  448. </LI>
  449. </OL>
  450. <P>
  451. <H3><A NAME="SECTION00035300000000000000"></A>
  452. <A NAME="234"></A><A NAME="sec:background"></A>
  453. <BR>
  454. Background
  455. </H3>
  456. <P>
  457. The background value is a constant<A NAME="236"></A> typically used
  458. to represent non-existing arcs in graphs. Consider a shortest path
  459. problem. Two nodes that are not connected by an arc can be regarded as
  460. being joined by an arc<A NAME="237"></A> of infinite length. In
  461. shortest path problems, it is therefore convenient to set the
  462. background value to PlusInfinity<A NAME="238"></A>. In network flow
  463. problems, on the other hand, two nodes not connected by an arc can be
  464. regarded as joined by an arc<A NAME="239"></A> of 0 capacity.
  465. For these problems, therefore, it is more convenient to set the
  466. background value to 0. In general, when representing
  467. sparse<A NAME="240"></A> matrices, the background value is the value that
  468. is assumed implicitly.
  469. <P>
  470. At initialization, the background value is set to 0. It can be read
  471. with <I>Cudd_ReadBackground</I><A NAME="1148"></A>, and
  472. modified with <I>Cudd_SetBackground</I>. The background value
  473. affects procedures that read sparse matrices/graphs
  474. (<I>Cudd_addRead</I><A NAME="1150"></A> and
  475. <I>Cudd_addHarwell</I><A NAME="1152"></A>), procedures that print
  476. out sum-of-product<A NAME="248"></A> expressions for
  477. ADDs (<I>Cudd_PrintMinterm</I><A NAME="1154"></A>), generators
  478. of cubes (<I>Cudd_ForeachCube</I><A NAME="1156"></A>), and
  479. procedures that count minterms<A NAME="253"></A>
  480. (<I>Cudd_CountMinterm</I><A NAME="1158"></A>).
  481. <P>
  482. <H3><A NAME="SECTION00035400000000000000"></A>
  483. <A NAME="sec:newconst"></A>
  484. <BR>
  485. New Constants
  486. </H3>
  487. <P>
  488. New constant<A NAME="258"></A> can be created by calling
  489. <I>Cudd_addConst</I><A NAME="1160"></A>. This function will
  490. retrieve the ADD<A NAME="261"></A> for the desired constant, if it already
  491. exist, or it will create a new one. Obviously, new constants should
  492. only be used when manipulating ADDs.
  493. <P>
  494. <H2><A NAME="SECTION00036000000000000000"></A>
  495. <A NAME="sec:newvar"></A>
  496. <BR>
  497. Creating Variables
  498. </H2>
  499. <P>
  500. Decision diagrams are typically created by combining simpler decision
  501. diagrams. The simplest decision diagrams, of course, cannot be
  502. created in that way. Constant functions have been discussed in
  503. Section&nbsp;<A HREF="#sec:const">3.5</A>. In this section we discuss the simple
  504. variable functions, also known as <I>projection<A NAME="265"></A> functions</I>.
  505. <P>
  506. <H3><A NAME="SECTION00036100000000000000"></A>
  507. <A NAME="sec:BDDADDvar"></A>
  508. <BR>
  509. New BDD and ADD Variables
  510. </H3>
  511. <P>
  512. The projection<A NAME="268"></A> functions are distinct for
  513. BDDs and ADDs. A projection function for BDDs consists of an internal
  514. node with both outgoing arcs pointing to the constant 1. The
  515. <I>else</I> arc<A NAME="270"></A> is complemented.
  516. <P>
  517. An ADD projection function, on the other hand, has the <I>else</I>
  518. pointer directed to the arithmetic<A NAME="272"></A> zero
  519. function. One should never mix the two types of variables. BDD
  520. variables should be used when manipulating BDDs, and ADD variables
  521. should be used when manipulating ADDs. Three functions are provided
  522. to create BDD variables:
  523. <UL>
  524. <LI><I>Cudd_bddIthVar</I><A NAME="1162"></A>: Returns
  525. the projection<A NAME="276"></A> function with index <IMG
  526. WIDTH="10" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  527. SRC="img6.png"
  528. ALT="$i$">.
  529. If the function does not exist, it is created.
  530. </LI>
  531. <LI><I>Cudd_bddNewVar</I><A NAME="1164"></A>: Returns a
  532. new projection<A NAME="279"></A> function, whose index is
  533. the largest index in use at the time of the call, plus 1.
  534. </LI>
  535. <LI><I>Cudd_bddNewVarAtLevel</I><A NAME="1166"></A>:
  536. Similar to <I>Cudd_bddNewVar</I><A NAME="1168"></A>. In
  537. addition it allows to specify the position in the variable
  538. order<A NAME="284"></A> at which the new variable should be
  539. inserted. In contrast, <I>Cudd_bddNewVar</I><A NAME="1170"></A>
  540. adds the new variable at the end of the order.
  541. </LI>
  542. </UL>
  543. The analogous functions for ADDs are
  544. <I>Cudd_addIthVar</I><A NAME="1172"></A>,
  545. <I>Cudd_addNewVar</I><A NAME="1174"></A>, and
  546. <I>Cudd_addNewVarAtLevel</I><A NAME="1176"></A>.
  547. <P>
  548. <H3><A NAME="SECTION00036200000000000000"></A>
  549. <A NAME="295"></A><A NAME="sec:ZDDvars"></A>
  550. <BR>
  551. New ZDD Variables
  552. </H3>
  553. <P>
  554. Unlike the projection functions of BDDs and ADDs, the
  555. projection<A NAME="297"></A> functions of ZDDs have diagrams
  556. with <IMG
  557. WIDTH="45" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
  558. SRC="img7.png"
  559. ALT="$n+1$"> nodes, where <IMG
  560. WIDTH="15" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  561. SRC="img4.png"
  562. ALT="$n$"> is the number of variables. Therefore the
  563. ZDDs of the projection functions change when new variables are added.
  564. This will be discussed in Section&nbsp;<A HREF="#sec:basicZDD">3.9</A>. Here we assume
  565. that the number of variables is fixed. The ZDD of the <IMG
  566. WIDTH="10" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  567. SRC="img6.png"
  568. ALT="$i$">-th
  569. projection function is returned by
  570. <I>Cudd_zddIthVar</I><A NAME="1178"></A>.
  571. <P>
  572. <H2><A NAME="SECTION00037000000000000000"></A>
  573. <A NAME="302"></A><A NAME="sec:basicBDD"></A>
  574. <BR>
  575. Basic BDD Manipulation
  576. </H2>
  577. <P>
  578. Common manipulations of BDDs can be accomplished by calling
  579. <I>Cudd_bddIte</I>. This function takes three BDDs, <IMG
  580. WIDTH="15" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
  581. SRC="img8.png"
  582. ALT="$f$">, <IMG
  583. WIDTH="13" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
  584. SRC="img9.png"
  585. ALT="$g$">, and
  586. <IMG
  587. WIDTH="14" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  588. SRC="img10.png"
  589. ALT="$h$">, as arguments and computes <!-- MATH
  590. $f\cdot g + f'\cdot h$
  591. -->
  592. <IMG
  593. WIDTH="95" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
  594. SRC="img11.png"
  595. ALT="$f\cdot g + f'\cdot h$">. Like all the
  596. functions that create new BDDs or ADDs, <I>Cudd_bddIte</I><A NAME="1180"></A> returns a result that must be
  597. explicitly referenced by the caller. <I>Cudd_bddIte</I> can be used
  598. to implement all two-argument boolean functions. However, the package
  599. also provides <I>Cudd_bddAnd</I><A NAME="1182"></A> as well as the
  600. other two-operand boolean functions, which are slightly more efficient
  601. when a two-operand function is called for. The following fragment of
  602. code illustrates how to build the BDD for the function <!-- MATH
  603. $f =
  604. x_0'x_1'x_2'x_3'$
  605. -->
  606. <IMG
  607. WIDTH="108" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
  608. SRC="img12.png"
  609. ALT="$f =
  610. x_0'x_1'x_2'x_3'$">.
  611. <PRE>
  612. DdManager *manager;
  613. DdNode *f, *var, *tmp;
  614. int i;
  615. ...
  616. f = Cudd_ReadOne(manager);
  617. Cudd_Ref(f);
  618. for (i = 3; i &gt;= 0; i--) {
  619. var = Cudd_bddIthVar(manager,i);
  620. tmp = Cudd_bddAnd(manager,Cudd_Not(var),f);
  621. Cudd_Ref(tmp);
  622. Cudd_RecursiveDeref(manager,f);
  623. f = tmp;
  624. }
  625. </PRE>
  626. This example illustrates the following points:
  627. <UL>
  628. <LI>Intermediate results must be ``referenced'' and
  629. ``dereferenced.'' However, <TT>var</TT> is a
  630. projection<A NAME="314"></A> function, and its
  631. reference<A NAME="315"></A> count is always greater than
  632. 0. Therefore, there is no call to <I>Cudd_Ref</I><A NAME="1184"></A>.
  633. </LI>
  634. <LI>The new <TT>f</TT> must be assigned to a temporary variable
  635. (<TT>tmp</TT> in this example). If the result of
  636. <I>Cudd_bddAnd</I><A NAME="1186"></A> were assigned directly to
  637. <TT>f</TT>, the old <TT>f</TT> would be lost, and there would be no
  638. way to free its nodes.
  639. </LI>
  640. <LI>The statement <TT>f = tmp</TT> has the same effect as:
  641. <PRE>
  642. f = tmp;
  643. Cudd_Ref(f);
  644. Cudd_RecursiveDeref(manager,tmp);
  645. </PRE>
  646. but is more efficient. The reference<A NAME="327"></A> is
  647. ``passed'' from <TT>tmp</TT> to <TT>f</TT>, and <TT>tmp</TT> is now
  648. ready to be reutilized.
  649. </LI>
  650. <LI>It is normally more efficient to build BDDs ``bottom-up.'' This
  651. is why the loop goes from 3 to 0. Notice, however, that after
  652. variable reordering, higher index does not necessarily mean ``closer
  653. to the bottom.'' Of course, in this simple example, efficiency is
  654. not a concern.
  655. </LI>
  656. <LI>Had we wanted to conjoin the variables in a bottom-up fashion
  657. even after reordering, we should have used
  658. <I>Cudd_ReadInvPerm</I><A NAME="1188"></A>. One has to be
  659. careful, though, to fix the order of conjunction before entering the
  660. loop. Otherwise, if reordering takes place, it is possible to use
  661. one variable twice and skip another variable.
  662. </LI>
  663. </UL>
  664. <P>
  665. <H2><A NAME="SECTION00038000000000000000"></A>
  666. <A NAME="335"></A><A NAME="sec:basicADD"></A>
  667. <BR>
  668. Basic ADD Manipulation
  669. </H2>
  670. <P>
  671. The most common way to manipulate ADDs is via
  672. <I>Cudd_addApply</I><A NAME="1190"></A>. This function can apply a
  673. wide variety of operators to a pair of ADDs. Among the available
  674. operators are addition, multiplication, division, minimum, maximum,
  675. and boolean operators that work on ADDs whose leaves are restricted to
  676. 0 and 1 (0-1 ADDs).
  677. <P>
  678. The following fragment of code illustrates how to build the ADD for
  679. the function <!-- MATH
  680. $f = 5x_0x_1x_2x_3$
  681. -->
  682. <IMG
  683. WIDTH="117" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
  684. SRC="img13.png"
  685. ALT="$f = 5x_0x_1x_2x_3$">.
  686. <PRE>
  687. DdManager *manager;
  688. DdNode *f, *var, *tmp;
  689. int i;
  690. ...
  691. f = Cudd_addConst(manager,5);
  692. Cudd_Ref(f);
  693. for (i = 3; i &gt;= 0; i--) {
  694. var = Cudd_addIthVar(manager,i);
  695. Cudd_Ref(var);
  696. tmp = Cudd_addApply(manager,Cudd_addTimes,var,f);
  697. Cudd_Ref(tmp);
  698. Cudd_RecursiveDeref(manager,f);
  699. Cudd_RecursiveDeref(manager,var);
  700. f = tmp;
  701. }
  702. </PRE>
  703. This example, contrasted to the example of BDD manipulation,
  704. illustrates the following points:
  705. <UL>
  706. <LI>The ADD projection<A NAME="342"></A> function are not
  707. maintained by the manager. It is therefore necessary to
  708. reference<A NAME="343"></A> and
  709. dereference<A NAME="344"></A> them.
  710. </LI>
  711. <LI>The product of two ADDs is computed by calling
  712. <I>Cudd_addApply</I><A NAME="1192"></A> with
  713. <I>Cudd_addTimes</I><A NAME="1194"></A> as parameter. There is
  714. no ``apply'' function for BDDs, because
  715. <I>Cudd_bddAnd</I><A NAME="1196"></A> and
  716. <I>Cudd_bddXor</I><A NAME="1198"></A> plus complementation are
  717. sufficient to implement all two-argument boolean functions.
  718. </LI>
  719. </UL>
  720. <P>
  721. <H2><A NAME="SECTION00039000000000000000"></A>
  722. <A NAME="355"></A><A NAME="sec:basicZDD"></A>
  723. <BR>
  724. Basic ZDD Manipulation
  725. </H2>
  726. <P>
  727. ZDDs are often generated by converting<A NAME="357"></A>
  728. existing BDDs. (See Section&nbsp;<A HREF="#sec:convertZ">3.11</A>.) However, it is also
  729. possible to build ZDDs by applying boolean operators to other ZDDs,
  730. starting from constants and projection<A NAME="359"></A>
  731. functions. The following fragment of code illustrates how to build
  732. the ZDD for the function <!-- MATH
  733. $f = x_0'+x_1'+x_2'+x_3'$
  734. -->
  735. <IMG
  736. WIDTH="172" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
  737. SRC="img14.png"
  738. ALT="$f = x_0'+x_1'+x_2'+x_3'$">. We assume that the
  739. four variables already exist in the manager when the ZDD for <IMG
  740. WIDTH="15" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
  741. SRC="img8.png"
  742. ALT="$f$"> is
  743. built. Note the use of De Morgan's law.
  744. <PRE>
  745. DdManager *manager;
  746. DdNode *f, *var, *tmp;
  747. int i;
  748. manager = Cudd_Init(0,4,CUDD_UNIQUE_SLOTS,
  749. CUDD_CACHE_SLOTS,0);
  750. ...
  751. tmp = Cudd_ReadZddOne(manager,0);
  752. Cudd_Ref(tmp);
  753. for (i = 3; i &gt;= 0; i--) {
  754. var = Cudd_zddIthVar(manager,i);
  755. Cudd_Ref(var);
  756. f = Cudd_zddIntersect(manager,var,tmp);
  757. Cudd_Ref(f);
  758. Cudd_RecursiveDerefZdd(manager,tmp);
  759. Cudd_RecursiveDerefZdd(manager,var);
  760. tmp = f;
  761. }
  762. f = Cudd_zddDiff(manager,Cudd_ReadZddOne(manager,0),tmp);
  763. Cudd_Ref(f);
  764. Cudd_RecursiveDerefZdd(manager,tmp);
  765. </PRE>
  766. This example illustrates the following points:
  767. <UL>
  768. <LI>The projection<A NAME="363"></A> functions are
  769. referenced, because they are not maintained by the manager.
  770. </LI>
  771. <LI>Complementation is obtained by subtracting from the constant 1
  772. function.
  773. </LI>
  774. <LI>The result of <I>Cudd_ReadZddOne</I><A NAME="1200"></A>
  775. does not require referencing.
  776. </LI>
  777. </UL>
  778. CUDD provides functions for the manipulation of
  779. covers<A NAME="367"></A> represented by ZDDs. For instance,
  780. <I>Cudd_zddIsop</I><A NAME="1202"></A> builds a ZDD representing an
  781. irredundant<A NAME="370"></A> sum of products for the
  782. incompletely specified function defined by the two BDDs <IMG
  783. WIDTH="16" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  784. SRC="img15.png"
  785. ALT="$L$"> and <IMG
  786. WIDTH="18" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  787. SRC="img16.png"
  788. ALT="$U$">.
  789. <I>Cudd_zddWeakDiv</I><A NAME="1204"></A> performs the weak
  790. division of two covers given as ZDDs. These functions expect the two
  791. ZDD variables corresponding to the two literals of the function
  792. variable to be adjacent. One has to create variable groups (see
  793. Section&nbsp;<A HREF="#sec:reordZ">3.14</A>) for reordering<A NAME="374"></A> of
  794. the ZDD variables to work. BDD automatic reordering is safe even
  795. without groups: If realignment of ZDD and ADD/BDD variables is
  796. requested (see Section&nbsp;<A HREF="#sec:consist">3.15</A>) groups will be kept
  797. adjacent.
  798. <P>
  799. <H2><A NAME="SECTION000310000000000000000"></A>
  800. <A NAME="377"></A>
  801. <A NAME="378"></A><A NAME="sec:convert"></A>
  802. <BR>
  803. Converting ADDs to BDDs and Vice Versa
  804. </H2>
  805. <P>
  806. Several procedures are provided to convert ADDs to BDDs, according to
  807. different criteria.
  808. (<I>Cudd_addBddPattern</I><A NAME="1206"></A>,
  809. <I>Cudd_addBddInterval</I><A NAME="1208"></A>, and
  810. <I>Cudd_addBddThreshold</I><A NAME="1210"></A>.) The
  811. conversion from BDDs to ADDs
  812. (<I>Cudd_BddToAdd</I><A NAME="1212"></A>) is based on the simple
  813. principle of mapping the logical 0<A NAME="388"></A> and 1 on the
  814. arithmetic<A NAME="389"></A> 0 and 1. It is also possible to
  815. convert an ADD with integer values (more precisely, floating point
  816. numbers with 0 fractional part) to an array of BDDs by repeatedly
  817. calling <I>Cudd_addIthBit</I><A NAME="1214"></A>.
  818. <P>
  819. <H2><A NAME="SECTION000311000000000000000"></A>
  820. <A NAME="393"></A>
  821. <A NAME="394"></A><A NAME="sec:convertZ"></A>
  822. <BR>
  823. Converting BDDs to ZDDs and Vice Versa
  824. </H2>
  825. <P>
  826. Many applications first build a set of BDDs and then derive ZDDs from
  827. the BDDs. These applications should create the manager with 0
  828. ZDD<A NAME="396"></A> variables and create the BDDs. Then they should call
  829. <I>Cudd_zddVarsFromBddVars</I><A NAME="1216"></A> to
  830. create the necessary ZDD variables--whose number is likely to be
  831. known once the BDDs are available. This approach eliminates the
  832. difficulties that arise when the number of ZDD variables changes while
  833. ZDDs are being built.
  834. <P>
  835. The simplest conversion from BDDs to ZDDs is a simple change of
  836. representation, which preserves the functions. Simply put, given a BDD
  837. for <IMG
  838. WIDTH="15" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
  839. SRC="img8.png"
  840. ALT="$f$">, a ZDD for <IMG
  841. WIDTH="15" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
  842. SRC="img8.png"
  843. ALT="$f$"> is requested. In this case the correspondence
  844. between the BDD variables and ZDD variables is one-to-one. Hence,
  845. <I>Cudd_zddVarsFromBddVars</I> should be called with the
  846. <I>multiplicity</I> parameter equal to 1. The conversion proper can
  847. then be performed by calling
  848. <I>Cudd_zddPortFromBdd</I><A NAME="1218"></A>. The inverse
  849. transformation is performed by
  850. <I>Cudd_zddPortToBdd</I><A NAME="1220"></A>.
  851. <P>
  852. ZDDs are quite often used for the representation of
  853. <I>covers</I><A NAME="406"></A>. This is normally done by
  854. associating two ZDD variables to each variable of the function. (And
  855. hence, typically, to each BDD variable.) One ZDD variable is
  856. associated with the positive literal of the BDD variable, while the
  857. other ZDD variable is associated with the negative literal. A call to
  858. <I>Cudd_zddVarsFromBddVars</I><A NAME="1222"></A> with
  859. <I>multiplicity</I> equal to 2 will associate to BDD variable <IMG
  860. WIDTH="10" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  861. SRC="img6.png"
  862. ALT="$i$"> the
  863. two ZDD variables <IMG
  864. WIDTH="19" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
  865. SRC="img17.png"
  866. ALT="$2i$"> and <IMG
  867. WIDTH="49" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
  868. SRC="img18.png"
  869. ALT="$2i+1$">.
  870. <P>
  871. If a BDD variable group tree exists when
  872. <I>Cudd_zddVarsFromBddVars</I> is called (see
  873. Section&nbsp;<A HREF="#sec:group">3.13</A>) the function generates a ZDD variable group
  874. tree consistent to it. In any case, all the ZDD variables derived
  875. from the same BDD variable are clustered into a group.
  876. <P>
  877. If the ZDD for <IMG
  878. WIDTH="15" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
  879. SRC="img8.png"
  880. ALT="$f$"> is created and later a new ZDD variable is added to
  881. the manager, the function represented by the existing ZDD changes.
  882. Suppose, for instance, that two variables are initially created, and
  883. that the ZDD for <IMG
  884. WIDTH="94" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
  885. SRC="img19.png"
  886. ALT="$f = x_0 + x_1$"> is built. If a third variable is
  887. added, say <IMG
  888. WIDTH="22" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
  889. SRC="img20.png"
  890. ALT="$x_2$">, then the ZDD represents <!-- MATH
  891. $g = (x_0 + x_1) x_2'$
  892. -->
  893. <IMG
  894. WIDTH="124" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
  895. SRC="img21.png"
  896. ALT="$g = (x_0 + x_1) x_2'$">
  897. instead. This change in function obviously applies regardless of what
  898. use is made of the ZDD. However, if the ZDD is used to represent a
  899. cover<A NAME="412"></A>, the cover itself is not changed by the
  900. addition of new variable. (What changes is the
  901. characteristic<A NAME="413"></A> function of the cover.)
  902. <P>
  903. <H2><A NAME="SECTION000312000000000000000"></A>
  904. <A NAME="415"></A><A NAME="sec:reorder"></A>
  905. <BR>
  906. Variable Reordering for BDDs and ADDs
  907. </H2>
  908. <P>
  909. The CUDD package provides a rich set of
  910. dynamic<A NAME="417"></A> reordering algorithms. Some of them
  911. are slight variations of existing techniques
  912. [<A
  913. HREF="node7.html#Rudell93">16</A>,<A
  914. HREF="node7.html#Drechs95">6</A>,<A
  915. HREF="node7.html#Bollig95">2</A>,<A
  916. HREF="node7.html#Ishiur91">10</A>,<A
  917. HREF="node7.html#Plessi93">15</A>,<A
  918. HREF="node7.html#Jeong93">11</A>]; some
  919. others have been developed specifically for this package
  920. [<A
  921. HREF="node7.html#Panda94">14</A>,<A
  922. HREF="node7.html#Panda95b">13</A>].
  923. <P>
  924. Reordering affects a unique<A NAME="420"></A> table. This means that
  925. BDDs and ADDs, which share the same unique table are simultaneously
  926. reordered. ZDDs, on the other hand, are reordered separately. In the
  927. following we discuss the reordering of BDDs and ADDs. Reordering for
  928. ZDDs is the subject of Section&nbsp;<A HREF="#sec:reordZ">3.14</A>.
  929. <P>
  930. Reordering of the variables can be invoked directly by the application
  931. by calling <I>Cudd_ReduceHeap</I><A NAME="1224"></A>. Or it can
  932. be automatically triggered by the package when the number of nodes has
  933. reached a given threshold<A NAME="424"></A>. (The threshold
  934. is initialized and automatically adjusted after each reordering by the
  935. package.) To enable automatic dynamic reordering (also called
  936. <I>asynchronous<A NAME="425"></A></I> dynamic reordering
  937. in this document) the application must call
  938. <I>Cudd_AutodynEnable</I><A NAME="1226"></A>. Automatic
  939. dynamic reordering can subsequently be disabled by calling
  940. <I>Cudd_AutodynDisable</I><A NAME="1228"></A>.
  941. <P>
  942. All reordering methods are available in both the case of direct call
  943. to <I>Cudd_ReduceHeap</I><A NAME="1230"></A> and the case of
  944. automatic invocation. For many methods, the reordering procedure is
  945. iterated until no further improvement is obtained. We call these
  946. methods the <I>converging<A NAME="432"></A></I> methods.
  947. When constraints are imposed on the relative position of variables
  948. (see Section&nbsp;<A HREF="#sec:group">3.13</A>) the reordering methods apply inside the
  949. groups. The groups<A NAME="434"></A> themselves are reordered
  950. by sifting<A NAME="435"></A>. Each method is identified by a
  951. constant of the enumerated type
  952. <I>Cudd_ReorderingType<A NAME="436"></A></I>
  953. defined in <I>cudd.h<A NAME="437"></A></I> (the external
  954. header<A NAME="438"></A> file of the CUDD package):
  955. <P>
  956. <DL>
  957. <DT><STRONG>CUDD_REORDER_NONE<A NAME="440"></A>:</STRONG></DT>
  958. <DD>This method
  959. causes no reordering.
  960. </DD>
  961. <DT><STRONG>CUDD_REORDER_SAME<A NAME="441"></A>:</STRONG></DT>
  962. <DD>If passed to
  963. <I>Cudd_AutodynEnable</I><A NAME="1232"></A>, this
  964. method leaves the current method for automatic reordering unchanged.
  965. If passed to <I>Cudd_ReduceHeap</I><A NAME="1234"></A>,
  966. this method causes the current method for automatic reordering to be
  967. used.
  968. </DD>
  969. <DT><STRONG>CUDD_REORDER_RANDOM<A NAME="446"></A>:</STRONG></DT>
  970. <DD>Pairs of
  971. variables are randomly chosen, and swapped in the order. The swap is
  972. performed by a series of swaps of adjacent variables. The best order
  973. among those obtained by the series of swaps is retained. The number
  974. of pairs chosen for swapping<A NAME="447"></A> equals the
  975. number of variables in the diagram.
  976. </DD>
  977. <DT><STRONG>CUDD_REORDER_RANDOM_PIVOT<A NAME="448"></A>:</STRONG></DT>
  978. <DD>Same as CUDD_REORDER_RANDOM, but the two variables are chosen so
  979. that the first is above the variable with the largest number of
  980. nodes, and the second is below that variable. In case there are
  981. several variables tied for the maximum number of nodes, the one
  982. closest to the root is used.
  983. </DD>
  984. <DT><STRONG>CUDD_REORDER_SIFT<A NAME="449"></A>:</STRONG></DT>
  985. <DD>This method is
  986. an implementation of Rudell's sifting<A NAME="450"></A>
  987. algorithm [<A
  988. HREF="node7.html#Rudell93">16</A>]. A simplified description of sifting is as
  989. follows: Each variable is considered in turn. A variable is moved up
  990. and down in the order so that it takes all possible positions. The
  991. best position is identified and the variable is returned to that
  992. position.
  993. <P>
  994. In reality, things are a bit more complicated. For instance, there
  995. is a limit on the number of variables that will be sifted. This
  996. limit can be read with
  997. <I>Cudd_ReadSiftMaxVar</I><A NAME="1236"></A> and set with
  998. <I>Cudd_SetSiftMaxVar</I><A NAME="1238"></A>. In addition,
  999. if the diagram grows too much while moving a variable up or down,
  1000. that movement is terminated before the variable has reached one end
  1001. of the order. The maximum ratio by which the diagram is allowed to
  1002. grow while a variable is being sifted can be read with
  1003. <I>Cudd_ReadMaxGrowth</I><A NAME="1240"></A> and set with
  1004. <I>Cudd_SetMaxGrowth</I><A NAME="1242"></A>.
  1005. </DD>
  1006. <DT><STRONG>CUDD_REORDER_SIFT_CONVERGE<A NAME="460"></A>:</STRONG></DT>
  1007. <DD>This is the converging<A NAME="461"></A> variant of
  1008. CUDD_REORDER_SIFT.
  1009. </DD>
  1010. <DT><STRONG>CUDD_REORDER_SYMM_SIFT<A NAME="462"></A>:</STRONG></DT>
  1011. <DD>This method is an implementation of
  1012. symmetric<A NAME="463"></A> sifting [<A
  1013. HREF="node7.html#Panda94">14</A>]. It is
  1014. similar to sifting, with one addition: Variables that become
  1015. adjacent during sifting are tested for symmetry<A NAME="465"></A>. If
  1016. they are symmetric, they are linked in a group. Sifting then
  1017. continues with a group being moved, instead of a single variable.
  1018. After symmetric sifting has been run,
  1019. <I>Cudd_SymmProfile</I><A NAME="1244"></A> can be called to
  1020. report on the symmetry groups found. (Both positive and negative
  1021. symmetries are reported.)
  1022. </DD>
  1023. <DT><STRONG>CUDD_REORDER_SYMM_SIFT_CONV<A NAME="468"></A>:</STRONG></DT>
  1024. <DD>This is the converging<A NAME="469"></A> variant of
  1025. CUDD_REORDER_SYMM_SIFT.
  1026. </DD>
  1027. <DT><STRONG>CUDD_REORDER_GROUP_SIFT<A NAME="470"></A>:</STRONG></DT>
  1028. <DD>This method is an implementation of group<A NAME="471"></A>
  1029. sifting [<A
  1030. HREF="node7.html#Panda95b">13</A>]. It is similar to symmetric sifting, but
  1031. aggregation<A NAME="473"></A> is not restricted to symmetric
  1032. variables.
  1033. </DD>
  1034. <DT><STRONG>CUDD_REORDER_GROUP_SIFT_CONV<A NAME="474"></A>:</STRONG></DT>
  1035. <DD>This method repeats until convergence the combination of
  1036. CUDD_REORDER_GROUP_SIFT and CUDD_REORDER_WINDOW4.
  1037. </DD>
  1038. <DT><STRONG>CUDD_REORDER_WINDOW2<A NAME="475"></A>:</STRONG></DT>
  1039. <DD>This
  1040. method implements the window<A NAME="476"></A> permutation
  1041. approach of Fujita [<A
  1042. HREF="node7.html#Fujita91b">8</A>] and Ishiura [<A
  1043. HREF="node7.html#Ishiur91">10</A>].
  1044. The size of the window is 2.
  1045. </DD>
  1046. <DT><STRONG>CUDD_REORDER_WINDOW3<A NAME="479"></A>:</STRONG></DT>
  1047. <DD>Similar
  1048. to CUDD_REORDER_WINDOW2, but with a window of size 3.
  1049. </DD>
  1050. <DT><STRONG>CUDD_REORDER_WINDOW4<A NAME="480"></A>:</STRONG></DT>
  1051. <DD>Similar
  1052. to CUDD_REORDER_WINDOW2, but with a window of size 4.
  1053. </DD>
  1054. <DT><STRONG>CUDD_REORDER_WINDOW2_CONV<A NAME="481"></A>:</STRONG></DT>
  1055. <DD>This is the converging<A NAME="482"></A> variant of
  1056. CUDD_REORDER_WINDOW2.
  1057. </DD>
  1058. <DT><STRONG>CUDD_REORDER_WINDOW3_CONV<A NAME="483"></A>:</STRONG></DT>
  1059. <DD>This is the converging variant of CUDD_REORDER_WINDOW3.
  1060. </DD>
  1061. <DT><STRONG>CUDD_REORDER_WINDOW4_CONV<A NAME="484"></A>:</STRONG></DT>
  1062. <DD>This is the converging variant of CUDD_REORDER_WINDOW4.
  1063. </DD>
  1064. <DT><STRONG>CUDD_REORDER_ANNEALING<A NAME="485"></A>:</STRONG></DT>
  1065. <DD>This
  1066. method is an implementation of simulated
  1067. annealing<A NAME="486"></A> for variable
  1068. ordering, vaguely resemblant of the algorithm of [<A
  1069. HREF="node7.html#Bollig95">2</A>].
  1070. This method is potentially very slow.
  1071. </DD>
  1072. <DT><STRONG>CUDD_REORDER_GENETIC:<A NAME="488"></A></STRONG></DT>
  1073. <DD>This
  1074. method is an implementation of a genetic<A NAME="489"></A>
  1075. algorithm for variable ordering, inspired by the work of Drechsler
  1076. [<A
  1077. HREF="node7.html#Drechs95">6</A>]. This method is potentially very slow.
  1078. </DD>
  1079. <DT><STRONG>CUDD_REORDER_EXACT<A NAME="491"></A>:</STRONG></DT>
  1080. <DD>This method
  1081. implements a dynamic programming approach to
  1082. exact<A NAME="492"></A> reordering
  1083. [<A
  1084. HREF="node7.html#Held62">9</A>,<A
  1085. HREF="node7.html#Friedman90">7</A>,<A
  1086. HREF="node7.html#Ishiur91">10</A>], with improvements described in
  1087. [<A
  1088. HREF="node7.html#Jeong93">11</A>]. It only stores one BDD at the time. Therefore, it is
  1089. relatively efficient in terms of memory. Compared to other
  1090. reordering strategies, it is very slow, and is not recommended for
  1091. more than 16 variables.
  1092. </DD>
  1093. </DL>
  1094. So far we have described methods whereby the package selects an order
  1095. automatically. A given order of the variables can also be imposed by
  1096. calling <I>Cudd_ShuffleHeap</I><A NAME="1246"></A>.
  1097. <P>
  1098. <H2><A NAME="SECTION000313000000000000000"></A>
  1099. <A NAME="499"></A><A NAME="sec:group"></A>
  1100. <BR>
  1101. Grouping Variables
  1102. </H2>
  1103. <P>
  1104. CUDD allows the application to specify constraints on the positions of
  1105. group of variables. It is possible to request that a group of
  1106. contiguous variables be kept contiguous by the reordering procedures.
  1107. It is also possible to request that the relative order of some groups
  1108. of variables be left unchanged. The constraints on the order are
  1109. specified by means of a tree<A NAME="501"></A>, which is created in
  1110. one of two ways:
  1111. <UL>
  1112. <LI>By calling <I>Cudd_MakeTreeNode</I><A NAME="1248"></A>.
  1113. </LI>
  1114. <LI>By calling the functions of the MTR<A NAME="505"></A> library
  1115. (part of the distribution), and by registering the result with the
  1116. manager using <I>Cudd_SetTree</I><A NAME="1250"></A>. The current
  1117. tree registered with the manager can be read with
  1118. <I>Cudd_ReadTree</I><A NAME="1252"></A>.
  1119. </LI>
  1120. </UL>
  1121. <P>
  1122. Each node in the tree represents a range of variables. The lower bound
  1123. of the range is given by the <I>low</I> field of the node, and the
  1124. size of the group is given by the <I>size</I> field of the
  1125. node.<A NAME="tex2html4"
  1126. HREF="footnode.html#foot1083"><SUP>2</SUP></A> The variables
  1127. in each range are kept contiguous. Furthermore, if a node is marked
  1128. with the MTR_FIXED<A NAME="515"></A> flag, then the relative order of
  1129. the variable ranges associated to its children is not changed. As an
  1130. example, suppose the initial variable order is:
  1131. <PRE>
  1132. x0, y0, z0, x1, y1, z1, ... , x9, y9, z9.
  1133. </PRE>
  1134. Suppose we want to keep each group of three variables with the same
  1135. index (e.g., <code>x3, y3, z3</code>) contiguous, while allowing the package
  1136. to change the order of the groups. We can accomplish this with the
  1137. following code:
  1138. <PRE>
  1139. for (i = 0; i &lt; 10; i++) {
  1140. (void) Cudd_MakeTreeNode(manager,i*3,3,MTR_DEFAULT);
  1141. }
  1142. </PRE>
  1143. If we want to keep the order within each group of variables
  1144. fixed (i.e., <code>x</code> before <code>y</code> before <code>z</code>) we need to
  1145. change MTR_DEFAULT<A NAME="520"></A> into MTR_FIXED.
  1146. <P>
  1147. The <I>low</I> parameter passed to
  1148. <I>Cudd_MakeTreeNode</I><A NAME="1254"></A> is the index of a
  1149. variable (as opposed to its level or position in the order). The
  1150. group tree<A NAME="524"></A> can be created at any time. The
  1151. result obviously depends on the variable order in effect at creation
  1152. time.
  1153. <P>
  1154. It is possible to create a variable group tree also before the
  1155. variables themselves are created. The package assumes in this case
  1156. that the index of the variables not yet in existence will equal their
  1157. position in the order when they are created. Therefore, applications
  1158. that rely on
  1159. <I>Cudd_bddNewVarAtLevel</I><A NAME="1256"></A> or
  1160. <I>Cudd_addNewVarAtLevel</I><A NAME="1258"></A> to create
  1161. new variables have to create the variables before they group them.
  1162. <P>
  1163. The reordering procedure will skip all groups whose variables are not
  1164. yet in existence. For groups that are only partially in existence, the
  1165. reordering procedure will try to reorder the variables already
  1166. instantiated, without violating the adjacency constraints.
  1167. <P>
  1168. <H2><A NAME="SECTION000314000000000000000"></A>
  1169. <A NAME="530"></A><A NAME="sec:reordZ"></A>
  1170. <BR>
  1171. Variable Reordering for ZDDs
  1172. </H2>
  1173. <P>
  1174. Reordering of ZDDs is done in much the same way as the reordering of
  1175. BDDs and ADDs. The functions corresponding to <I>Cudd_ReduceHeap</I>
  1176. and <I>Cudd_ShuffleHeap</I> are
  1177. <I>Cudd_zddReduceHeap</I><A NAME="1260"></A> and
  1178. <I>Cudd_zddShuffleHeap</I><A NAME="1262"></A>. To enable
  1179. dynamic<A NAME="538"></A> reordering, the application must
  1180. call <I>Cudd_AutodynEnableZdd</I><A NAME="1264"></A>, and
  1181. to disable dynamic reordering, it must call
  1182. <I>Cudd_AutodynDisableZdd</I><A NAME="1266"></A>. In the
  1183. current implementation, however, the choice of reordering methods for
  1184. ZDDs is more limited. Specifically, these methods are available:
  1185. <P>
  1186. <DL>
  1187. <DT><STRONG>CUDD_REORDER_NONE<A NAME="544"></A>;</STRONG></DT>
  1188. <DD>
  1189. </DD>
  1190. <DT><STRONG>CUDD_REORDER_SAME<A NAME="545"></A>;</STRONG></DT>
  1191. <DD>
  1192. </DD>
  1193. <DT><STRONG>CUDD_REORDER_RANDOM<A NAME="546"></A>;</STRONG></DT>
  1194. <DD>
  1195. </DD>
  1196. <DT><STRONG>CUDD_REORDER_RANDOM_PIVOT<A NAME="547"></A>;</STRONG></DT>
  1197. <DD>
  1198. </DD>
  1199. <DT><STRONG>CUDD_REORDER_SIFT<A NAME="548"></A>;</STRONG></DT>
  1200. <DD>
  1201. </DD>
  1202. <DT><STRONG>CUDD_REORDER_SIFT_CONVERGE<A NAME="549"></A>;</STRONG></DT>
  1203. <DD>
  1204. </DD>
  1205. <DT><STRONG>CUDD_REORDER_SYMM_SIFT<A NAME="550"></A>;</STRONG></DT>
  1206. <DD>
  1207. </DD>
  1208. <DT><STRONG>CUDD_REORDER_SYMM_SIFT_CONV<A NAME="551"></A>.</STRONG></DT>
  1209. <DD>
  1210. </DD>
  1211. </DL>
  1212. <P>
  1213. To create ZDD variable groups, the application calls
  1214. <I>Cudd_MakeZddTreeNode</I><A NAME="1268"></A>.
  1215. <P>
  1216. <H2><A NAME="SECTION000315000000000000000"></A>
  1217. <A NAME="sec:consist"></A>
  1218. <BR>
  1219. Keeping Consistent Variable Orders for BDDs and ZDDs
  1220. </H2>
  1221. <P>
  1222. Several applications that manipulate both BDDs and ZDDs benefit from
  1223. keeping a fixed correspondence between the order of the BDD variables
  1224. and the order of the ZDD variables. If each BDD variable corresponds
  1225. to a group of ZDD variables, then it is often desirable that the
  1226. groups of ZDD variables be in the same order as the corresponding BDD
  1227. variables. CUDD allows the ZDD order to track the BDD order and vice
  1228. versa. To have the ZDD order track the BDD order, the application
  1229. calls <I>Cudd_zddRealignEnable</I><A NAME="1270"></A>. The
  1230. effect of this call can be reversed by calling
  1231. <I>Cudd_zddRealignDisable</I><A NAME="1272"></A>. When
  1232. ZDD realignment is in effect, automatic reordering of ZDDs should be
  1233. disabled.
  1234. <P>
  1235. <H2><A NAME="SECTION000316000000000000000"></A>
  1236. <A NAME="562"></A><A NAME="sec:hooks"></A>
  1237. <BR>
  1238. Hooks
  1239. </H2>
  1240. <P>
  1241. Hooks in CUDD are lists of application-specified functions to be run on
  1242. certain occasions. Each hook is identified by a constant of the
  1243. enumerated type <I>Cudd_HookType</I><A NAME="1274"></A>. In Version
  1244. 2.5.0 hooks are defined for these occasions:
  1245. <UL>
  1246. <LI>before garbage collection (CUDD_PRE_GC_HOOK);
  1247. </LI>
  1248. <LI>after garbage collection (CUDD_POST_GC_HOOK);
  1249. </LI>
  1250. <LI>before variable reordering (CUDD_PRE_REORDERING_HOOK);
  1251. </LI>
  1252. <LI>after variable reordering (CUDD_POST_REORDERING_HOOK).
  1253. </LI>
  1254. </UL>
  1255. The current implementation of hooks is experimental. A function added
  1256. to a hook receives a pointer to the manager, a pointer to a constant
  1257. string, and a pointer to void as arguments; it must return 1 if
  1258. successful; 0 otherwise. The second argument is one of ``DD,''
  1259. ``BDD,'' and ``ZDD.'' This allows the hook functions to tell the type
  1260. of diagram for which reordering or garbage collection takes place. The
  1261. third argument varies depending on the hook. The hook functions called
  1262. before or after garbage collection<A NAME="568"></A> do
  1263. not use it. The hook functions called before
  1264. reordering<A NAME="569"></A> are passed, in addition to the
  1265. pointer to the manager, also the method used for reordering. The hook
  1266. functions called after reordering are passed the start time. To add a
  1267. function to a hook, one uses <I>Cudd_AddHook</I><A NAME="1276"></A>.
  1268. The function of a given hook
  1269. are called in the order in which they were added to the hook. For
  1270. sample hook functions, one may look at
  1271. <I>Cudd_StdPreReordHook</I><A NAME="1278"></A> and
  1272. <I>Cudd_StdPostReordHook</I><A NAME="1280"></A>.
  1273. <P>
  1274. <H2><A NAME="SECTION000317000000000000000"></A>
  1275. <A NAME="577"></A><A NAME="sec:timeouts"></A>
  1276. <BR>
  1277. Timeouts and Limits
  1278. </H2>
  1279. <P>
  1280. It is possible to set a time limit for a manger with
  1281. <I>Cudd_SetTimeLimit</I><A NAME="1282"></A>. Once set, the
  1282. time available to the manager can be modified through other API
  1283. functions. CUDD checks for expiration periodically. When time has
  1284. expired, it returns NULL from the call in progress, but it leaves the
  1285. manager in a consistent state. The invoking application must be
  1286. designed to handle the NULL values returned.
  1287. <P>
  1288. When reordering, if a timout is approaching, CUDD will quit reordering
  1289. to give the application a chance to finish some computation.
  1290. <P>
  1291. It is also possible to invoke some functions that return NULL if they
  1292. cannot complete without creating more than a set number of nodes.
  1293. See, for instance, <I>Cudd_bddAndLimit</I><A NAME="1284"></A>.
  1294. <P>
  1295. <H2><A NAME="SECTION000318000000000000000"></A>
  1296. <A NAME="584"></A><A NAME="585"></A><A NAME="sec:sis-vis"></A>
  1297. <BR>
  1298. The SIS/VIS Interface
  1299. </H2>
  1300. <P>
  1301. The CUDD package contains interface functions that emulate the
  1302. behavior of the original BDD package used in SIS [<A
  1303. HREF="node7.html#Sentov92">17</A>] and
  1304. in the newer
  1305. <A NAME="tex2html5"
  1306. HREF="http://vlsi.Colorado.EDU/~vis/">VIS</A>
  1307. [<A
  1308. HREF="node7.html#VIS">4</A>]. How to build VIS with CUDD is described
  1309. in the installation documents of VIS. (Version 1.1 and later.)
  1310. <P>
  1311. <H3><A NAME="SECTION000318100000000000000"></A>
  1312. <A NAME="592"></A><A NAME="sec:sis"></A>
  1313. <BR>
  1314. Using the CUDD Package in SIS
  1315. </H3>
  1316. <P>
  1317. This section describes how to build SIS with the CUDD package. Let
  1318. <TT>SISDIR<A NAME="594"></A></TT> designate the root of the directory
  1319. hierarchy where the sources for SIS reside. Let
  1320. <TT>CUDDDIR<A NAME="595"></A></TT> be the root of the directory hierarchy
  1321. where the distribution of the CUDD package resides. To build SIS with
  1322. the CUDD package, follow these steps.
  1323. <OL>
  1324. <LI>Create directories <TT>SISDIR/sis/cudd</TT> and
  1325. <TT>SISDIR/sis/mtr</TT>.
  1326. </LI>
  1327. <LI>Copy all files from <TT>CUDDDIR/cudd</TT> and
  1328. <TT>CUDDDIR/sis</TT> to <TT>SISDIR/sis/cudd</TT> and all files from
  1329. <TT>CUDDDIR/mtr</TT> to <TT>SISDIR/sis/mtr</TT>.
  1330. </LI>
  1331. <LI>Copy <TT>CUDDDIR/cudd/doc/cudd.doc</TT> to
  1332. <TT>SISDIR/sis/cudd</TT>; also copy <TT>CUDDDIR/mtr/doc/mtr.doc</TT>
  1333. to <TT>SISDIR/sis/mtr</TT>.
  1334. </LI>
  1335. <LI>In <TT>SISDIR/sis/cudd</TT> make <TT>bdd.h</TT> a symbolic link
  1336. to <TT>cuddBdd.h</TT>. (That is: <TT>ln -s cuddBdd.h bdd.h</TT>.)
  1337. </LI>
  1338. <LI>In <TT>SISDIR/sis/cudd</TT> delete <TT>Makefile</TT> and rename
  1339. <TT>Makefile.sis</TT> as <TT>Makefile</TT>. Do the same in
  1340. <TT>SISDIR/sis/mtr</TT>.
  1341. </LI>
  1342. <LI>Copy <TT>CUDDDIR/sis/st.[ch]</TT> and <TT>CUDDDIR/st/doc/st.doc</TT>
  1343. to <TT>SISDIR/sis/st</TT>. (This will overwrite the original files: You
  1344. may want to save them beforehand.)
  1345. </LI>
  1346. <LI>From <TT>CUDDDIR/util</TT> copy <TT>datalimit.c</TT> to
  1347. <TT>SISDIR/sis/util</TT>. Update <TT>util.h</TT> and
  1348. <TT>Makefile</TT> in <TT>SISDIR/sis/util</TT>. Specifically, add the
  1349. declaration <TT>EXTERN long getSoftDataLimit();</TT> to
  1350. <TT>util.h</TT> and add <TT>datalimit.c</TT> to the list of source
  1351. files (PSRC) in <TT>Makefile</TT>.
  1352. </LI>
  1353. <LI>In <TT>SISDIR/sis</TT> remove the link from <TT>bdd</TT> to
  1354. <TT>bdd_cmu</TT> or <TT>bdd_ucb</TT> (that is, <TT>rm bdd</TT>)
  1355. and make <TT>bdd</TT> a symbolic link to <TT>cudd</TT>. (That is:
  1356. <TT>ln -s cudd bdd</TT>.)
  1357. </LI>
  1358. <LI>Still in <TT>SISDIR/sis</TT>, edit <TT>Makefile</TT>, <TT>Makefile.oct</TT>, and <TT>Makefile.nooct</TT>. In all three files add
  1359. mtr to the list of directories to be made (DIRS).
  1360. </LI>
  1361. <LI>In <TT>SISDIR/sis/include</TT> make <TT>mtr.h</TT> a symbolic
  1362. link to <TT>../mtr/mtr.h</TT>.
  1363. </LI>
  1364. <LI>In <TT>SISDIR/sis/doc</TT> make <TT>cudd.doc</TT> a symbolic
  1365. link to <TT>../cudd/cudd.doc</TT> and <TT>mtr.doc</TT> a symbolic
  1366. link to <TT>../mtr/mtr.doc</TT>. (That is: <TT>ln -s
  1367. ../cudd/cudd.doc .; ln -s ../mtr/mtr.doc .</TT>.)
  1368. </LI>
  1369. <LI>From <TT>SISDIR</TT> do <TT>make clean</TT> followed by
  1370. <TT>make -i</TT>. This should create a working copy of SIS that
  1371. uses the CUDD package.
  1372. </LI>
  1373. </OL>
  1374. <P>
  1375. The replacement for the <TT>st</TT> library is because the version
  1376. shipped with the CUDD package tests for out-of-memory conditions.
  1377. Notice that the version of the <TT>st</TT> library to be used for
  1378. replacement is not the one used for the normal build, because the
  1379. latter has been modified for C++ compatibility. The above installation
  1380. procedure has been tested on SIS 1.3. SIS can be obtained via
  1381. anonymous FTP<A NAME="657"></A> from
  1382. <A NAME="tex2html6"
  1383. HREF="ftp://ic.eecs.berkeley.edu"><TT>ic.eecs.berkeley.edu</TT></A>.
  1384. To build SIS 1.3, you need <TT>sis-1.2.tar.Z</TT> and
  1385. <TT>sis-1.2.patch1.Z</TT>. When compiling on a DEC Alpha<A NAME="662"></A>, you should add the <TT>-ieee_with_no_inexact</TT> flag.
  1386. (See Section&nbsp;<A HREF="#sec:predef-const">3.5.2</A>.) Refer to the <TT>Makefile</TT>
  1387. in the top level directory of the distribution for how to compile with
  1388. 32-bit pointers.
  1389. <P>
  1390. <H2><A NAME="SECTION000319000000000000000"></A>
  1391. <A NAME="sec:dump"></A>
  1392. <BR>
  1393. Writing Decision Diagrams to a File
  1394. </H2>
  1395. <P>
  1396. The CUDD package provides several functions to write decision diagrams
  1397. to a file. <I>Cudd_DumpBlif</I><A NAME="1286"></A> writes a
  1398. file in <I>blif</I> format. It is restricted to BDDs. The diagrams
  1399. are written as a network of multiplexers, one multiplexer for each
  1400. internal node of the BDD.
  1401. <P>
  1402. <I>Cudd_DumpDot</I><A NAME="1288"></A> produces input suitable to
  1403. the graph-drawing<A NAME="673"></A> program
  1404. <A NAME="tex2html8"
  1405. HREF="http://www.research.att.com/sw/tools/graphviz"><I>dot</I></A>
  1406. written by Eleftherios Koutsofios and Stephen C. North. An example of
  1407. drawing produced by dot from the output of <I>Cudd_DumpDot</I> is
  1408. shown in Figure&nbsp;<A HREF="#fi:phase">1</A>. It is restricted to BDDs and ADDs.
  1409. <DIV ALIGN="CENTER"><A NAME="fi:phase"></A><A NAME="1089"></A>
  1410. <TABLE>
  1411. <CAPTION ALIGN="BOTTOM"><STRONG>Figure 1:</STRONG>
  1412. A BDD representing a phase constraint for the optimization of
  1413. fixed-polarity Reed-Muller forms. The label of each node is the
  1414. unique part of the node address. All nodes on the same level
  1415. correspond to the same variable, whose name is shown at the left of
  1416. the diagram. Dotted lines indicate complement<A NAME="680"></A>
  1417. arcs. Dashed lines indicate regular<A NAME="681"></A> ``else''
  1418. arcs.</CAPTION>
  1419. <TR><TD>
  1420. <DIV ALIGN="CENTER">
  1421. <IMG
  1422. WIDTH="429" HEIGHT="701" ALIGN="BOTTOM" BORDER="0"
  1423. SRC="img22.png"
  1424. ALT="\includegraphics[height=15.5cm]{phase.ps}"></DIV></TD></TR>
  1425. </TABLE>
  1426. </DIV>
  1427. <I>Cudd_zddDumpDot</I><A NAME="1290"></A> is the analog of
  1428. <I>Cudd_DumpDot</I> for ZDDs.
  1429. <P>
  1430. <I>Cudd_DumpDaVinci</I><A NAME="1292"></A> produces input
  1431. suitable to the graph-drawing<A NAME="689"></A> program
  1432. <A NAME="tex2html9"
  1433. HREF="ftp://ftp.uni-bremen.de/pub/graphics/daVinci"><I>daVinci</I></A>
  1434. developed at the University of Bremen. It is restricted to BDDs and
  1435. ADDs.
  1436. <P>
  1437. Functions are also available to produce the input format of
  1438. <I>DDcal</I> (see Section&nbsp;<A HREF="node2.html#sec:getFriends">2.2</A>) and factored forms.
  1439. <P>
  1440. <H2><A NAME="SECTION000320000000000000000"></A>
  1441. <A NAME="sec:save-restore"></A>
  1442. <BR>
  1443. Saving and Restoring BDDs
  1444. </H2>
  1445. <P>
  1446. The
  1447. <A NAME="tex2html10"
  1448. HREF="ftp://ftp.polito.it/pub/research/dddmp/"><I>dddmp</I></A>
  1449. library<A NAME="698"></A> by Gianpiero Cabodi and Stefano Quer
  1450. allows a CUDD application to save BDDs to disk in compact form for
  1451. later retrieval. See the library's own documentation for the details.
  1452. <P>
  1453. <HR>
  1454. <!--Navigation Panel-->
  1455. <A NAME="tex2html112"
  1456. HREF="node4.html">
  1457. <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
  1458. SRC="icons/next.png"></A>
  1459. <A NAME="tex2html108"
  1460. HREF="cuddIntro.html">
  1461. <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
  1462. SRC="icons/up.png"></A>
  1463. <A NAME="tex2html102"
  1464. HREF="node2.html">
  1465. <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
  1466. SRC="icons/prev.png"></A>
  1467. <A NAME="tex2html110"
  1468. HREF="node8.html">
  1469. <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
  1470. SRC="icons/index.png"></A>
  1471. <BR>
  1472. <B> Next:</B> <A NAME="tex2html113"
  1473. HREF="node4.html">Programmer's Manual</A>
  1474. <B> Up:</B> <A NAME="tex2html109"
  1475. HREF="cuddIntro.html">CUDD: CU Decision Diagram</A>
  1476. <B> Previous:</B> <A NAME="tex2html103"
  1477. HREF="node2.html">How to Get CUDD</A>
  1478. &nbsp; <B> <A NAME="tex2html111"
  1479. HREF="node8.html">Index</A></B>
  1480. <!--End of Navigation Panel-->
  1481. <ADDRESS>
  1482. Fabio Somenzi
  1483. 2012-02-04
  1484. </ADDRESS>
  1485. </BODY>
  1486. </HTML>