Exemple #1
0
  @Test
  public void testOverlapDomain() {
    BDDFactory factory = BDDFactory.init("cudd", 10000, 10000);
    BDDDomain[] doms = factory.extDomain(new long[] {8, 8});
    Assert.assertEquals(8, doms[0].size().longValue());
    Assert.assertEquals(8, doms[1].size().longValue());

    BDD bdd = doms[0].ithVar(5);
    Assert.assertEquals(5, bdd.scanVar(doms[0]).intValue());

    doms[0] = factory.overlapDomain(doms[0], doms[1]);
    Assert.assertEquals(64, doms[0].size().longValue());

    // Corrupted
    Assert.assertEquals(5, bdd.scanVar(doms[0]).intValue());
  }
Exemple #2
0
  static Set<Integer> setOf(BDD bdd, BDDDomain dom) {
    if (bdd == null) return null;

    Set<Integer> set = new HashSet<Integer>();
    if (bdd.isZero()) return set;

    BDDIterator itr = bdd.iterator(dom.set());
    while (itr.hasNext()) {
      BDD a = itr.nextBDD();
      set.add(a.scanVar(dom).intValue());
      a.free();
    }
    return set;
  }
Exemple #3
0
  /** Bug in JavaBDD. The method varRange does not work correctly. */
  @Test
  public void testVarRange() {
    BDDFactory factory = BDDFactory.init("cudd", 10000, 10000);
    BDDDomain[] doms = factory.extDomain(new long[] {8});

    BDD bdd = doms[0].varRange(2, 5);
    System.out.println(bdd.toStringWithDomains());

    HashSet<Integer> set = new HashSet<Integer>(Arrays.asList(2, 3, 4, 5));
    BDDIterator itr = bdd.iterator(doms[0].var);
    while (itr.hasNext()) {
      BDD tmp = itr.nextBDD();
      Assert.assertTrue(set.contains(tmp.scanVar(doms[0]).longValue()));
    }
    bdd.free();
    factory.done();
  }