@Test
  public void testIsPossiblySatisfiedBy_empty() throws ContradictionException, TimeoutException {
    Formula f = Formula.newInstanceforSAT(new Formula()); // emptyFormula

    assertTrue(f.getModels().isEmpty());
    // emptyFormula formula is not possibly satisfiable - not even by an emptyFormula model
    assertFalse(f.isPossiblySatisfiedBy(new Model(new int[] {})));
  }
  @Test
  public void testIsPossiblySatisfiedBy() throws ContradictionException, TimeoutException {
    Var P = new Var("P");
    Var Q = new Var("Q");
    Var R = new Var("R");
    Formula f = Formula.newInstanceforSAT((P.or(Q)).and(P.not().or(R))); // (P or Q) and (~P or R)

    // Possible assignments
    // ~P ~Q ~R
    // ~P ~Q  R
    // ~P  Q ~R (solution)
    // ~P  Q  R (solution
    //  P ~Q ~R
    //  P ~Q  R (solution)
    //  P  Q ~R
    //  P  Q  R (solution)

    BidiMap map = f.getVariableMap();
    assertTrue(map.get(1).equals("P"));
    assertTrue(map.get(2).equals("Q"));
    assertTrue(map.get(3).equals("R"));

    // The following partial models should pass
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {-1})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {1})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {-1, 2})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {1, 3})));

    // These partial models should not
    assertFalse(f.isPossiblySatisfiedBy(new Model(new int[] {-2, -3})));

    // Complete models, by definition, should satisfy (if solutions)
    assertFalse(f.isPossiblySatisfiedBy(new Model(new int[] {-1, -2, -3})));
    assertFalse(f.isPossiblySatisfiedBy(new Model(new int[] {-1, -2, 3})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {-1, 2, -3})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {-1, 2, 3})));
    assertFalse(f.isPossiblySatisfiedBy(new Model(new int[] {1, -2, -3})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {1, -2, 3})));
    assertFalse(f.isPossiblySatisfiedBy(new Model(new int[] {1, 2, -3})));
    assertTrue(f.isPossiblySatisfiedBy(new Model(new int[] {1, 2, 3})));
  }