[Javabdd-checkins] SF.net SVN: javabdd:[481] trunk/JavaBDD/net/sf/javabdd
Brought to you by:
joewhaley
|
From: <gi...@us...> - 2011-02-18 14:37:16
|
Revision: 481
http://javabdd.svn.sourceforge.net/javabdd/?rev=481&view=rev
Author: gismo
Date: 2011-02-18 14:37:09 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
fixed BDD.simplify: It takes now a BDD instead of a BDDVarSet
fix in CUDDFactory: simplify is implemented in CUDD by the method "restrict". The JavaBDD restrict method is called cofactor in CUDD. I fixed simplify and set restrict to unimplemented. I will add the required method in cudd_jni.c shortly.
Modified Paths:
--------------
trunk/JavaBDD/net/sf/javabdd/BDD.java
trunk/JavaBDD/net/sf/javabdd/BDDFactoryIntImpl.java
trunk/JavaBDD/net/sf/javabdd/CALFactory.java
trunk/JavaBDD/net/sf/javabdd/CUDDFactory.java
trunk/JavaBDD/net/sf/javabdd/TestBDDFactory.java
trunk/JavaBDD/net/sf/javabdd/TypedBDDFactory.java
Modified: trunk/JavaBDD/net/sf/javabdd/BDD.java
===================================================================
--- trunk/JavaBDD/net/sf/javabdd/BDD.java 2010-11-16 01:29:49 UTC (rev 480)
+++ trunk/JavaBDD/net/sf/javabdd/BDD.java 2011-02-18 14:37:09 UTC (rev 481)
@@ -404,7 +404,7 @@
* @param d BDDVarSet containing the variables in the domain
* @return the result of the simplify operation
*/
- public abstract BDD simplify(BDDVarSet d);
+ public abstract BDD simplify(BDD d);
/**
* <p>Returns the variable support of this BDD. The support is all the
Modified: trunk/JavaBDD/net/sf/javabdd/BDDFactoryIntImpl.java
===================================================================
--- trunk/JavaBDD/net/sf/javabdd/BDDFactoryIntImpl.java 2010-11-16 01:29:49 UTC (rev 480)
+++ trunk/JavaBDD/net/sf/javabdd/BDDFactoryIntImpl.java 2011-02-18 14:37:09 UTC (rev 481)
@@ -179,7 +179,7 @@
public BDD satOne(BDDVarSet var, boolean pol) {
return makeBDD(satOne_impl2(v, unwrap(var), pol));
}
- public BDD simplify(BDDVarSet d) {
+ public BDD simplify(BDD d) {
return makeBDD(simplify_impl(v, unwrap(d)));
}
public BDDVarSet support() {
Modified: trunk/JavaBDD/net/sf/javabdd/CALFactory.java
===================================================================
--- trunk/JavaBDD/net/sf/javabdd/CALFactory.java 2010-11-16 01:29:49 UTC (rev 480)
+++ trunk/JavaBDD/net/sf/javabdd/CALFactory.java 2011-02-18 14:37:09 UTC (rev 481)
@@ -586,7 +586,7 @@
/* (non-Javadoc)
* @see net.sf.javabdd.BDD#simplify(net.sf.javabdd.BDDVarSet)
*/
- public BDD simplify(BDDVarSet d) {
+ public BDD simplify(BDD d) {
// TODO Implement this.
throw new UnsupportedOperationException();
}
Modified: trunk/JavaBDD/net/sf/javabdd/CUDDFactory.java
===================================================================
--- trunk/JavaBDD/net/sf/javabdd/CUDDFactory.java 2010-11-16 01:29:49 UTC (rev 480)
+++ trunk/JavaBDD/net/sf/javabdd/CUDDFactory.java 2011-02-18 14:37:09 UTC (rev 481)
@@ -617,35 +617,43 @@
* @see net.sf.javabdd.BDD#restrict(net.sf.javabdd.BDD)
*/
public BDD restrict(BDD var) {
- CUDDBDD c = (CUDDBDD) var;
- long b = restrict0(_ddnode_ptr, c._ddnode_ptr);
- return new CUDDBDD(b);
+// CUDDBDD c = (CUDDBDD) var;
+// long b = cofactor0(_ddnode_ptr, c._ddnode_ptr);
+// return new CUDDBDD(b);
+ // TODO Implement this.
+ throw new UnsupportedOperationException();
}
- private static native long restrict0(long b, long var);
/* (non-Javadoc)
* @see net.sf.javabdd.BDD#restrictWith(net.sf.javabdd.BDD)
*/
public BDD restrictWith(BDD var) {
- CUDDBDD c = (CUDDBDD) var;
- long b = restrict0(_ddnode_ptr, c._ddnode_ptr);
- addRef(b);
- delRef(_ddnode_ptr);
- if (this != c) {
- delRef(c._ddnode_ptr);
- c._ddnode_ptr = INVALID_BDD;
- }
- _ddnode_ptr = b;
- return this;
+// CUDDBDD c = (CUDDBDD) var;
+// long b = cofactor0(_ddnode_ptr, c._ddnode_ptr);
+// addRef(b);
+// delRef(_ddnode_ptr);
+// if (this != c) {
+// delRef(c._ddnode_ptr);
+// c._ddnode_ptr = INVALID_BDD;
+// }
+// _ddnode_ptr = b;
+// return this;
+ // TODO Implement this.
+ throw new UnsupportedOperationException();
}
+// private static native long cofactor0(long b, long var);
- /* (non-Javadoc)
+ /** Coudert and Mardre's restrict function. Note that this function
+ * is called restrict in CUDD, While the JavaBDD's restrict function is
+ * called cofactor in CUDD. (the generalized cofactor is constrain)
* @see net.sf.javabdd.BDD#simplify(net.sf.javabdd.BDDVarSet)
*/
- public BDD simplify(BDDVarSet d) {
- // TODO Implement this.
- throw new UnsupportedOperationException();
+ public BDD simplify(BDD d) {
+ CUDDBDD c = (CUDDBDD) d;
+ long b = restrict0(_ddnode_ptr, c._ddnode_ptr);
+ return new CUDDBDD(b);
}
+ private static native long restrict0(long b, long var);
/* (non-Javadoc)
* @see net.sf.javabdd.BDD#support()
Modified: trunk/JavaBDD/net/sf/javabdd/TestBDDFactory.java
===================================================================
--- trunk/JavaBDD/net/sf/javabdd/TestBDDFactory.java 2010-11-16 01:29:49 UTC (rev 480)
+++ trunk/JavaBDD/net/sf/javabdd/TestBDDFactory.java 2011-02-18 14:37:09 UTC (rev 481)
@@ -326,9 +326,9 @@
*
* @see net.sf.javabdd.BDD#simplify(net.sf.javabdd.BDDVarSet)
*/
- public BDD simplify(BDDVarSet d) {
- BDDVarSet c1 = ((TestBDDVarSet) d).b1;
- BDDVarSet c2 = ((TestBDDVarSet) d).b2;
+ public BDD simplify(BDD d) {
+ BDD c1 = ((TestBDD) d).b1;
+ BDD c2 = ((TestBDD) d).b2;
BDD r1 = b1.simplify(c1);
BDD r2 = b2.simplify(c2);
return new TestBDD(r1, r2);
Modified: trunk/JavaBDD/net/sf/javabdd/TypedBDDFactory.java
===================================================================
--- trunk/JavaBDD/net/sf/javabdd/TypedBDDFactory.java 2010-11-16 01:29:49 UTC (rev 480)
+++ trunk/JavaBDD/net/sf/javabdd/TypedBDDFactory.java 2011-02-18 14:37:09 UTC (rev 481)
@@ -755,8 +755,8 @@
/* (non-Javadoc)
* @see net.sf.javabdd.BDD#simplify(net.sf.javabdd.BDDVarSet)
*/
- public BDD simplify(BDDVarSet d) {
- TypedBDDVarSet bdd1 = (TypedBDDVarSet) d;
+ public BDD simplify(BDD d) {
+ TypedBDD bdd1 = (TypedBDD) d;
// TODO How does this change the domains?
Set newDom = makeSet();
newDom.addAll(dom);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|