Skip to content

Commit

Permalink
Merge pull request #3 from incaseoftrouble/int-sized-keys
Browse files Browse the repository at this point in the history
Version 0.6: Rework
  • Loading branch information
incaseoftrouble authored Jun 12, 2023
2 parents 63703d4 + 5614255 commit d6abc4f
Show file tree
Hide file tree
Showing 58 changed files with 9,316 additions and 10,994 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ language: java
sudo: false

jdk:
- openjdk8
- openjdk10
- openjdk11
- openjdk12
- openjdk17
- oraclejdk11

branches:
Expand Down
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# 0.x

## 0.6 (2023-06-12)

* Major rewrite and simplification of the internal structure, overall ~1.5-2x runtime improvements
* Switched to a dumber, much simpler hash function, which seems to be much faster in practice (another ~2x improvement on several benchmarks)
* Breaking change: True and False node are now negative (in preparation for MTBDDs, where all leafs will be negative)
* Breaking change: Changed some method names (removed `get...` prefix)
* Added several benchmarks and optimized some default values based on that
* Deleted several caches which were close to useless
* Fixed a performance bug in the iterative implementation of `support()`
* Removed a runtime dependency that accidentally slipped in
* Add an implementation of `BddSet` and automatic reference management
* Add spotless for formatting

## 0.5

### 0.5.2 (2020-07-08)
Expand All @@ -12,7 +25,7 @@

### 0.5.0 (2019-08-06)

* Added an (mostly) iterative implementation of bdds to alleviate stack overflow problems for deep structures
* Added a (mostly) iterative implementation of bdds to alleviate stack overflow problems for deep structures
* Added set views on bdd nodes
* Bump gradle and dependency versions
* Small improvements
Expand Down
55 changes: 39 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,43 @@

[![Build Status](https://travis-ci.org/incaseoftrouble/jbdd.svg?branch=master)](https://travis-ci.org/incaseoftrouble/jbdd)

JBDD (Java Binary Decision Diagrams) is (yet another) native implementation of BDDs in Java.
It is inspired by [JDD](https://bitbucket.org/vahidi/jdd/wiki/Home), but more or less rewritten from scratch, since JDD contained some bugs and was missing features like, for example, substitution.
The design goals are simplicity, reasonable performance and no dependencies.
JBDD (Java Binary Decision Diagrams) is (yet another) native implementation of (Reduced Ordered) BDDs in Java.
It is loosely inspired by [JDD](https://bitbucket.org/vahidi/jdd/wiki/Home), but completely rewritten from scratch, since JDD contained some bugs and was missing features like, for example, substitution.
The design goals are simplicity, performance, and no dependencies.

This also implies that some more fancy BDD features and variants (like variable reordering or z-BDDs) are missing here, too.
## Performance

Internally, JBDD does not use any objects, only primitive arrays, and uses manual memory management.
JBDD also provides an object-oriented interface with automatic reference management through weak references (instead of `finalize()`, which has a hefty performance penalty).
The overhead incurred by the object-oriented interface largely depends on the number of referenced objects, but was hardly measurable in several synthetic benchmarks.

Compared to other libraries, JBDD beats most Java implementations and even is on-par or faster than established, C-based libraries such as BuDDy.
(Measured on several synthetic benchmarks.)

## Features

Some more fancy BDD features and variants are missing.
Most notably, these are ZDDs, MTBDDs, and variable reordering.
They might get added over time, but if you require such features, consider using optimized implementations like [CUDD](http://vlsi.colorado.edu/~fabio/), [BuDDy](http://buddy.sourceforge.net/manual/main.html) or [Sylvan](http://fmt.cs.utwente.nl/tools/sylvan/) instead.

## Usage

You can either build the jar using gradle (see below) or fetch it from maven central:

<dependency>
<groupId>de.tum.in</groupId>
<artifactId>jbdd</artifactId>
<version>0.3.2</version>
</dependency>
```xml
<dependency>
<groupId>de.tum.in</groupId>
<artifactId>jbdd</artifactId>
<version>0.6.0</version>
</dependency>
```

and for gradle:

```kotlin
// https://mvnrepository.com/artifact/de.tum.in/jbdd
implementation("de.tum.in:jbdd:0.6.0")
```

## Building

Expand All @@ -32,11 +53,13 @@ Or, if you are on windows,

## Referencing

If you use JBDD for your experiments, I would appreciate a BibTeX citation akin to the following.
If you use JBDD for your experiments, I would appreciate a citation akin to the following.

@misc{jbdd,
author = {Tobias Meggendorfer},
title = {{JBDD}: A Java {BDD} Library},
howpublished = "\url{https://github.com/incaseoftrouble/jbdd}",
year = 2017
}
```
@misc{jbdd,
author = {Tobias Meggendorfer},
title = {{JBDD}: A Java {BDD} Library},
howpublished = "\url{https://github.com/incaseoftrouble/jbdd}",
year = 2017
}
```
107 changes: 0 additions & 107 deletions build.gradle

This file was deleted.

151 changes: 151 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
plugins {
`java-library`

pmd
idea

`maven-publish`
signing

// https://plugins.gradle.org/plugin/io.github.gradle-nexus.publish-plugin
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
// https://plugins.gradle.org/plugin/com.diffplug.spotless
id("com.diffplug.spotless") version "6.19.0"
// https://plugins.gradle.org/plugin/me.champeau.jmh
id("me.champeau.jmh") version "0.7.1"
}

group = "de.tum.in"
version = "0.6.0"

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

withSourcesJar()
withJavadocJar()
}

var defaultEncoding = "UTF-8"

tasks.withType<JavaCompile> { options.encoding = defaultEncoding }

tasks.withType<Javadoc> {
options.encoding = defaultEncoding
options {
this as StandardJavadocDocletOptions
addBooleanOption("Xdoclint:all,-missing", true)
}
}

tasks.withType<Test> { systemProperty("file.encoding", "UTF-8") }

idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}

repositories { mavenCentral() }

spotless {
java { palantirJavaFormat() }
kotlinGradle { ktfmt() }
}

jmh {
includeTests.set(true)
}

dependencies {
compileOnly("com.google.code.findbugs:jsr305:3.0.2")

// https://mvnrepository.com/artifact/com.google.guava/guava
testImplementation("com.google.guava:guava:31.1-jre")
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest
testImplementation("org.hamcrest:hamcrest:2.2")
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.3")

// https://mvnrepository.com/artifact/org.immutables/value
compileOnly("org.immutables:value:2.9.3:annotations")
annotationProcessor("org.immutables:value:2.9.3")

jmhAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:1.36")
}

tasks.test {
useJUnitPlatform()
minHeapSize = "2g"
maxHeapSize = "16g"
}

// PMD
// https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.Pmd.html

pmd {
toolVersion = "6.55.0" // https://pmd.github.io/
reportsDir = file("${project.buildDir}/reports/pmd")
ruleSetFiles = files("${project.rootDir}/config/pmd-rules.xml")
ruleSets = listOf() // We specify all rules in rules.xml
isConsoleOutput = false
isIgnoreFailures = false
}

tasks.withType<Pmd> {
reports {
xml.required.set(false)
html.required.set(true)
}
}

// Deployment - run with -Prelease clean publishToSonatype closeAndReleaseSonatypeStagingRepository
// Authentication: sonatypeUsername+sonatypePassword in ~/.gradle/gradle.properties
if (project.hasProperty("release")) {
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(project.components["java"])

signing {
useGpgCmd()
sign(publishing.publications)
}

pom {
name.set("JBDD")
description.set("Pure Java implementation of (Binary) Decision Diagrams")
url.set("https://github.com/incaseoftrouble/jbdd")

licenses {
license {
name.set("The GNU General Public License, Version 3")
url.set("https://www.gnu.org/licenses/gpl.txt")
}
}

developers {
developer {
id.set("incaseoftrouble")
name.set("Tobias Meggendorfer")
email.set("[email protected]")
url.set("https://github.com/incaseoftrouble")
timezone.set("Europe/Berlin")
}
}

scm {
connection.set("scm:git:https://github.com/incaseoftrouble/jbdd.git")
developerConnection.set("scm:git:[email protected]:incaseoftrouble/jbdd.git")
url.set("https://github.com/incaseoftrouble/jbdd")
}
}
}
}
}

nexusPublishing { repositories.sonatype() }
}
14 changes: 0 additions & 14 deletions config/checkstyle-main-suppression.xml

This file was deleted.

Loading

0 comments on commit d6abc4f

Please sign in to comment.