JavaBDD is a Java library for manipulating BDDs (Binary Decision Diagrams). Binary decision diagrams are widely used in model checking, formal verification, optimizing circuit diagrams, etc. For an excellent overview of the BDD data structure, see this set of lecture notes by Henrik Reif Andersen.
The JavaBDD API is based on that of the popular BuDDy package, a BDD package written in C by Jørn Lind-Nielsen. However, JavaBDD's API is designed to be object-oriented. The ugly C function interface and reference counting schemes have been hidden underneath a uniform, object-oriented interface.
JavaBDD includes a 100% Java implementation. It can also interface with two popular BDD libraries written in C via a JNI interface: BuDDy and CUDD.
JavaBDD is designed for high performance applications, so it also exposes many of the lower level options of the BDD library, like cache sizes and advanced variable reordering.
The latest version is 0.6.
It is easiest to download one of the pre-built binaries. If you want to build it yourself with the interface to BuDDy and/or CUDD, you will also need the BuDDy (and/or CUDD) source code, available from the BuDDy homepage (and/or the CUDD homepage).
Grab the JavaBDD source code from CVS. To build JavaBDD on Windows, you will need cygwin or mingw installed. The Makefile assumes that you have the BuDDy source code in buddy22/src. It will automatically identify the path to the JDK, as long as you have it installed in the default location (C:/j2sdk* on Windows, /usr/java/j2sdk* on Linux). Finally, do a "make" and everything should work. Other make targets are "examples", "javadoc", "jar", and "test".
CUDD uses the Makefile.cudd makefile. To build, do a "make -f Makefile.cudd". The CUDD makefile contains the same targets as the normal BuDDy makefile.
If you manage to successfully compile JavaBDD for another system, please contribute your Makefile and/or any source patches.
Download the binary archive for your system and extract the files. It you want to use the native BuDDy library, put the "buddy.dll" (on Windows) or "libbuddy.so" (on Unix) somewhere in your library path, or in the directory you will execute from. (JavaBDD will automatically search the current directory for the native library, so there is no need to specify the current directory in the "java.library.path" system property.) Add the JavaBDD jar file to your Java class path if you want to compile and/or run with JavaBDD.
The JavaBDD jar file contains a simple example that solves an NxN queens problem. You can run this example by simply typing:
java -jar javabdd_0.6.jar N
where N is the size of the board (e.g. 8).
Here are the timings of solving the 12x12 NQueens problem on my home machine (2.4GHz P4, WinXP, Sun JDK 1.4.2). This test simply does simple logic operations. It primarily tests the speed of node creation and BDD garbage collection. The command line I used to test was:
java -ms320m -mx320m -Dbdd=package -jar javabdd_0.6.jar N
Package | Time | Peak Memory Usage |
buddy | 74s | 150mb |
cudd | 127s | 171mb |
java -server | 158s | 320mb |
java -client | 171s | 295mb |
Don't make any assumptions from these results about the relative efficiency of C and Java. The Java source code is a direct translation of the C source code, and therefore there are many, many inefficiencies that would not be present if it had been implemented from scratch in Java. At best, you could use this information as an example of the type of performance you will see if you directly translate a performance library written in C into Java.
Version 0.6 - October 31, 2003
Version 0.5 - August 4, 2003
Version 0.4 - June 18, 2003
Version 0.3 - February 21, 2003
Version 0.2 - February 1, 2003
Version 0.1 - January 30, 2003
Send your reactions to joewhaley at sourceforge.net.
For technical issues, you can use the tools on the Sourceforge Project summary page.
Copyright notice for JavaBDD:
Copyright (C) 2003 John Whaley (jwhaley at alum.mit.edu)
This library is free software; you can redistribute it
and/or
modify it under the terms of the GNU Library General
Public
License as published by the Free Software Foundation;
either
version 2 of the License, or (at your option) any later
version.
This library is distributed in the hope that it will be
useful,
but WITHOUT ANY WARRANTY; without even the implied
warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library
General Public
License along with this library; if not, write to the
Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
Copyright notice for BuDDy:
========================================================================== *** BuDDy *** Binary Decision Diagrams Library Package v2.2 -------------------------------------------------------------------------- Copyright (C) 1996-2002 by Jorn Lind-Nielsen All rights reserved Permission is hereby granted, without written agreement and without license or royalty fees, to use, reproduce, prepare derivative works, distribute, and display this software and its documentation for any purpose, provided that (1) the above copyright notice and the following two paragraphs appear in all copies of the source code and (2) redistributions, including without limitation binaries, reproduce these notices in the supporting documentation. Substantial modifications to this software may be copyrighted by their authors and need not follow the licensing terms described here, provided that the new terms are clearly indicated in all files where they apply. IN NO EVENT SHALL JORN LIND-NIELSEN, OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. JORN LIND-NIELSEN SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.