protected StateValues checkProbBoundedUntil(Model model, ExpressionTemporal expr, boolean min)
      throws PrismException {
    double uTime;
    BitSet b1, b2;
    StateValues probs = null;
    ModelCheckerResult res = null;

    // get info from bounded until
    uTime = expr.getUpperBound().evaluateDouble(constantValues);
    if (uTime < 0 || (uTime == 0 && expr.upperBoundIsStrict())) {
      String bound = (expr.upperBoundIsStrict() ? "<" : "<=") + uTime;
      throw new PrismException("Invalid upper bound " + bound + " in time-bounded until formula");
    }

    // model check operands first
    b1 = checkExpression(model, expr.getOperand1()).getBitSet();
    b2 = checkExpression(model, expr.getOperand2()).getBitSet();

    // compute probabilities

    // a trivial case: "U<=0"
    if (uTime == 0) {
      // prob is 1 in b2 states, 0 otherwise
      probs = StateValues.createFromBitSetAsDoubles(b2, model);
    } else {
      res = computeBoundedUntilProbs((CTMDP) model, b1, b2, uTime, min);
      probs = StateValues.createFromDoubleArray(res.soln, model);
    }

    return probs;
  }
  /** Compute probabilities for an (unbounded) until operator. */
  protected StateValues checkProbUntil(
      Model model, ExpressionTemporal expr, boolean min1, boolean min2) throws PrismException {
    BitSet b1, b2;
    StateValues probs = null;
    ModelCheckerResult res = null;

    // model check operands first
    b1 = checkExpression(model, expr.getOperand1()).getBitSet();
    b2 = checkExpression(model, expr.getOperand2()).getBitSet();

    // print out some info about num states
    // mainLog.print("\nb1 = " + JDD.GetNumMintermsString(b1,
    // allDDRowVars.n()));
    // mainLog.print(" states, b2 = " + JDD.GetNumMintermsString(b2,
    // allDDRowVars.n()) + " states\n");

    res = computeUntilProbs((STPG) model, b1, b2, min1, min2);
    probs = StateValues.createFromDoubleArray(res.soln, model);

    return probs;
  }
  /** Compute probabilities for a bounded until operator. */
  protected StateValues checkProbBoundedUntil(
      Model model, ExpressionTemporal expr, boolean min1, boolean min2) throws PrismException {
    int time;
    BitSet b1, b2;
    StateValues probs = null;
    ModelCheckerResult res = null;

    // get info from bounded until
    time = expr.getUpperBound().evaluateInt(constantValues);
    if (expr.upperBoundIsStrict()) time--;
    if (time < 0) {
      String bound = expr.upperBoundIsStrict() ? "<" + (time + 1) : "<=" + time;
      throw new PrismException("Invalid bound " + bound + " in bounded until formula");
    }

    // model check operands first
    b1 = checkExpression(model, expr.getOperand1()).getBitSet();
    b2 = checkExpression(model, expr.getOperand2()).getBitSet();

    // print out some info about num states
    // mainLog.print("\nb1 = " + JDD.GetNumMintermsString(b1,
    // allDDRowVars.n()));
    // mainLog.print(" states, b2 = " + JDD.GetNumMintermsString(b2,
    // allDDRowVars.n()) + " states\n");

    // Compute probabilities

    // a trivial case: "U<=0"
    if (time == 0) {
      // prob is 1 in b2 states, 0 otherwise
      probs = StateValues.createFromBitSetAsDoubles(b2, model);
    } else {
      res = computeBoundedUntilProbs((STPG) model, b1, b2, time, min1, min2);
      probs = StateValues.createFromDoubleArray(res.soln, model);
    }

    return probs;
  }