Re: [Javabdd-devel] Retrieving a set from a BDD
Brought to you by:
joewhaley
From: John W. <joe...@gm...> - 2007-11-28 18:11:26
|
Hi, The "var()" method just returns the variable at the top of the BDD. The "itemsSet1" and "itemsSet2" objects are the unique identifiers for the set1 and set2, respectively. -John On Nov 28, 2007 12:10 AM, Wassim Masri <wm...@au...> wrote: > 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 > given set then retrieve/delete it using some unique identifier (UID) > that is associated with it > > Below is the sample code that I started with. It seems that I am > properly creating the two sets (itemsSet1, itemsSet2) and inserting > them in the pool of sets (poolOfSets). But I am not able to properly > retrieve them from poolOfSets: the last two statements return two > nodes each, and not the two sets that were originally inserted. > > BDDFactory B; > B = BDDFactory.init(1000, 1000); > B.setVarNum(500); > > // pool of items > BDD [] items = new BDD[100]; > for (int i = 0; i < 100; i++) > { > items[i] = B.ithVar(i); > } > > // set1 > BDD itemsSet1 = B.zero(); > itemsSet1.orWith(items[0].id()); > itemsSet1.orWith(items[1].id()); > itemsSet1.orWith(items[2].id()); > itemsSet1.orWith(items[3].id()); > int var1 = itemsSet1.var(); // assuming that this is the UID for set1 > > // set2 > BDD itemsSet2 = B.zero(); > itemsSet2.orWith(items[10].id()); > itemsSet2.orWith(items[11].id()); > itemsSet2.orWith(items[2].id()); > itemsSet2.orWith(items[3].id()); > int var2 = itemsSet2.var();// assuming that this is the UID for set2 > > // pool of sets > BDD poolOfSets; > poolOfSets = B.one(); > poolOfSets.andWith(itemsSet1.id()); > poolOfSets.andWith(itemsSet2.id()); > > // ?later?in a different context? retrieve set1 and set2 > BDD set1 = B.ithVar(var1); // this contains a single node only > (expecting itemsSet1) > > BDD set2 = B.ithVar(var2); // this contains a single node only > (expecting itemsSet2) > > > I appreciate your help and any links to relevant tutorials or documentation. > > Thanks, > Wes > > > ---------------------------------------------------------------- > > |