public int image(int from) {
    int cube = manager.getBDDCubeS();
    Permutation perm = manager.getPermSp2S();

    int sum = 0;
    for (int i = 0; i < dp.getSize(); i++) {
      int tmp = manager.ref(manager.relProd(from, dp.getBDDTWave(i), cube));
      sum = manager.orTo(sum, tmp);
      manager.deref(tmp);
    }

    int next = manager.ref(manager.replace(sum, perm));
    manager.deref(sum);
    return next;
  }
  public int forward(int bdd_initial) {

    int qkk, qk = manager.ref(bdd_initial);

    do {
      qkk = qk;
      int next = image(qk);
      qk = manager.orTo(qk, next);
      manager.deref(next);
    } while (qkk != qk);

    return qk;
  }