Browse Source

Change meaning of isLowerBound() in RelOp and fix calls to it accordingly (to address a problem caused elsewhere in prism-games).

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@8623 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 12 years ago
parent
commit
8cc49309b8
  1. 4
      prism/src/explicit/ProbModelChecker.java
  2. 6
      prism/src/param/ParamModelChecker.java
  3. 52
      prism/src/parser/ast/RelOp.java
  4. 4
      prism/src/prism/NondetModelChecker.java
  5. 5
      prism/src/pta/PTAModelChecker.java

4
prism/src/explicit/ProbModelChecker.java

@ -479,7 +479,7 @@ public class ProbModelChecker extends NonProbModelChecker
if (p < 0 || p > 1) if (p < 0 || p > 1)
throw new PrismException("Invalid probability bound " + p + " in P operator"); throw new PrismException("Invalid probability bound " + p + " in P operator");
} }
min = relOp.isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// Compute probabilities // Compute probabilities
switch (modelType) { switch (modelType) {
@ -546,7 +546,7 @@ public class ProbModelChecker extends NonProbModelChecker
if (r < 0) if (r < 0)
throw new PrismException("Invalid reward bound " + r + " in R[] formula"); throw new PrismException("Invalid reward bound " + r + " in R[] formula");
} }
min = relOp.isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// Get reward info // Get reward info
if (modulesFile == null) if (modulesFile == null)

6
prism/src/param/ParamModelChecker.java

@ -873,7 +873,7 @@ final public class ParamModelChecker extends PrismComponent
if (p.compareTo(0) == -1 || p.compareTo(1) == 1) if (p.compareTo(0) == -1 || p.compareTo(1) == 1)
throw new PrismException("Invalid probability bound " + p + " in P operator"); throw new PrismException("Invalid probability bound " + p + " in P operator");
} }
min = relOp.isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// Compute probabilities // Compute probabilities
if (!expr.getExpression().isSimplePathFormula()) { if (!expr.getExpression().isSimplePathFormula()) {
@ -977,7 +977,7 @@ final public class ParamModelChecker extends PrismComponent
if (r.compareTo(0) == -1) if (r.compareTo(0) == -1)
throw new PrismException("Invalid reward bound " + r + " in R[] formula"); throw new PrismException("Invalid reward bound " + r + " in R[] formula");
} }
min = relOp.isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// Get reward info // Get reward info
if (modulesFile == null) if (modulesFile == null)
@ -1130,7 +1130,7 @@ final public class ParamModelChecker extends PrismComponent
if (p.compareTo(0) == -1 || p.compareTo(1) == 1) if (p.compareTo(0) == -1 || p.compareTo(1) == 1)
throw new PrismException("Invalid probability bound " + p + " in P operator"); throw new PrismException("Invalid probability bound " + p + " in P operator");
} }
min = relOp.isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// Compute probabilities // Compute probabilities
probs = checkProbSteadyState(model, expr.getExpression(), min, needStates); probs = checkProbSteadyState(model, expr.getExpression(), min, needStates);

52
prism/src/parser/ast/RelOp.java

@ -31,14 +31,29 @@ public enum RelOp {
} }
/** /**
* Returns true if this corresponds to a lower bound (e.g. >, >=, min=).
* Returns true if this corresponds to a lower bound (i.e. >, >=).
* NB: "min=?" does not return true for this.
*/ */
public boolean isLowerBound() public boolean isLowerBound()
{ {
switch (this) { switch (this) {
case GT: case GT:
case GEQ: case GEQ:
case MIN:
return true;
default:
return false;
}
}
/**
* Returns true if this corresponds to an upper bound (i.e. <, <=).
* NB: "max=?" does not return true for this.
*/
public boolean isUpperBound()
{
switch (this) {
case LT:
case LEQ:
return true; return true;
default: default:
return false; return false;
@ -60,13 +75,38 @@ public enum RelOp {
} }
/** /**
* Returns true if this corresponds to an upper bound (e.g. <, <=, max=).
* Returns true if this is numerical (e.g. min=?, max=?).
*/ */
public boolean isUpperBound()
public boolean isNumerical()
{
switch (this) {
case MIN:
case MAX:
return true;
default:
return false;
}
}
/**
* Returns true if this corresponds to minimum (min=?).
*/
public boolean isMin()
{
switch (this) {
case MIN:
return true;
default:
return false;
}
}
/**
* Returns true if this corresponds to maximum (max=?).
*/
public boolean isMax()
{ {
switch (this) { switch (this) {
case LT:
case LEQ:
case MAX: case MAX:
return true; return true;
default: default:

4
prism/src/prism/NondetModelChecker.java

@ -170,7 +170,7 @@ public class NondetModelChecker extends NonProbModelChecker
if (p < 0 || p > 1) if (p < 0 || p > 1)
throw new PrismException("Invalid probability bound " + p + " in P operator"); throw new PrismException("Invalid probability bound " + p + " in P operator");
} }
min = relOp.isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// Check for trivial (i.e. stupid) cases // Check for trivial (i.e. stupid) cases
if (pb != null) { if (pb != null) {
@ -235,7 +235,7 @@ public class NondetModelChecker extends NonProbModelChecker
if (r < 0) if (r < 0)
throw new PrismException("Invalid reward bound " + r + " in R operator"); throw new PrismException("Invalid reward bound " + r + " in R operator");
} }
min = relOp.isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// get reward info // get reward info
if (model.getNumRewardStructs() == 0) if (model.getNumRewardStructs() == 0)

5
prism/src/pta/PTAModelChecker.java

@ -190,10 +190,11 @@ public class PTAModelChecker extends PrismComponent
double prob; double prob;
// Check whether Pmin=? or Pmax=? (only two cases allowed) // Check whether Pmin=? or Pmax=? (only two cases allowed)
if (expr.getProb() != null) {
RelOp relOp = expr.getRelOp();
if (!relOp.isNumerical()) {
throw new PrismException("PTA model checking currently only supports Pmin=? and Pmax=? properties (try the digital clocks engine instead)"); throw new PrismException("PTA model checking currently only supports Pmin=? and Pmax=? properties (try the digital clocks engine instead)");
} }
min = expr.getRelOp().isLowerBound();
min = relOp.isLowerBound() || relOp.isMin();
// Check this is a F path property (only case allowed at the moment) // Check this is a F path property (only case allowed at the moment)
if (!(expr.getExpression() instanceof ExpressionTemporal)) if (!(expr.getExpression() instanceof ExpressionTemporal))

Loading…
Cancel
Save