[Javabdd-devel] Retrieving a set from a BDD
Brought to you by:
joewhaley
From: Wassim M. <wm...@au...> - 2007-11-28 08:11:35
|
Dear All, My goal is to achieve the following: 1) Create a number of sets of ?items? 2) Maintain them in a BDD for compression purposes, i.e., insert a =20 given set then retrieve/delete it using some unique identifier (UID) =20 that is associated with it Below is the sample code that I started with. It seems that I am =20 properly creating the two sets (itemsSet1, itemsSet2) and inserting =20 them in the pool of sets (poolOfSets). But I am not able to properly =20 retrieve them from poolOfSets: the last two statements return two =20 nodes each, and not the two sets that were originally inserted. BDDFactory B; B =3D BDDFactory.init(1000, 1000); B.setVarNum(500); // pool of items BDD [] items =3D new BDD[100]; for (int i =3D 0; i < 100; i++) { =09items[i] =3D B.ithVar(i); } // set1 BDD itemsSet1 =3D B.zero(); itemsSet1.orWith(items[0].id()); itemsSet1.orWith(items[1].id()); itemsSet1.orWith(items[2].id()); itemsSet1.orWith(items[3].id()); int var1 =3D itemsSet1.var(); // assuming that this is the UID for set1 // set2 BDD itemsSet2 =3D B.zero(); itemsSet2.orWith(items[10].id()); itemsSet2.orWith(items[11].id()); itemsSet2.orWith(items[2].id()); itemsSet2.orWith(items[3].id()); int var2 =3D itemsSet2.var();// assuming that this is the UID for set2 // pool of sets BDD poolOfSets; poolOfSets =3D B.one(); poolOfSets.andWith(itemsSet1.id()); poolOfSets.andWith(itemsSet2.id()); // ?later?in a different context? retrieve set1 and set2 BDD set1 =3D B.ithVar(var1); // this contains a single node only =20 (expecting itemsSet1) BDD set2 =3D B.ithVar(var2); // this contains a single node only =20 (expecting itemsSet2) I appreciate your help and any links to relevant tutorials or documentation. Thanks, Wes ---------------------------------------------------------------- |