Browse Source

imported patch min-max-min-max-2.patch

tud-infrastructure-2018-10-12
Joachim Klein 7 years ago
parent
commit
8de542e234
  1. 2
      prism/src/parser/ast/ExpressionProb.java
  2. 2
      prism/src/parser/ast/RelOp.java
  3. 4
      prism/src/parser/visitor/CheckValid.java
  4. 2
      prism/src/prism/MultiObjModelChecker.java
  5. 2
      prism/src/prism/NondetModelChecker.java
  6. 2
      prism/src/prism/OpRelOpBound.java

2
prism/src/parser/ast/ExpressionProb.java

@ -123,7 +123,7 @@ public class ExpressionProb extends ExpressionQuant
{ {
if (getBound() != null) if (getBound() != null)
return "Result"; return "Result";
else if (getRelOp() == RelOp.EQ) {
else if (getRelOp() == RelOp.COMPUTE_VALUES) {
if (minMax != null) { if (minMax != null) {
if (minMax.isMin()) { if (minMax.isMin()) {
return "Minimum probability"; return "Minimum probability";

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

@ -71,7 +71,7 @@ public enum RelOp
return (keepStrictness ? GEQ : GT); return (keepStrictness ? GEQ : GT);
} }
}, },
EQ("=") {
COMPUTE_VALUES("=") {
@Override @Override
public RelOp negate(boolean keepStrictness) throws PrismLangException public RelOp negate(boolean keepStrictness) throws PrismLangException
{ {

4
prism/src/parser/visitor/CheckValid.java

@ -99,13 +99,13 @@ public class CheckValid extends ASTTraverse
public void visitPost(ExpressionProb e) throws PrismLangException public void visitPost(ExpressionProb e) throws PrismLangException
{ {
if (modelType.nondeterministic() && e.getRelOp() == RelOp.EQ && e.getMinMax() == null)
if (modelType.nondeterministic() && e.getRelOp() == RelOp.COMPUTE_VALUES && e.getMinMax() == null)
throw new PrismLangException("Can't use \"P=?\" for nondeterministic models; use \"Pmin=?\" or \"Pmax=?\""); throw new PrismLangException("Can't use \"P=?\" for nondeterministic models; use \"Pmin=?\" or \"Pmax=?\"");
} }
public void visitPost(ExpressionReward e) throws PrismLangException public void visitPost(ExpressionReward e) throws PrismLangException
{ {
if (modelType.nondeterministic() && e.getRelOp() == RelOp.EQ && e.getMinMax() == null)
if (modelType.nondeterministic() && e.getRelOp() == RelOp.COMPUTE_VALUES && e.getMinMax() == null)
throw new PrismLangException("Can't use \"R=?\" for nondeterministic models; use \"Rmin=?\" or \"Rmax=?\""); throw new PrismLangException("Can't use \"R=?\" for nondeterministic models; use \"Rmin=?\" or \"Rmax=?\"");
if (e.getRewardStructIndexDiv() != null) if (e.getRewardStructIndexDiv() != null)
throw new PrismLangException("No support for ratio reward objectives yet"); throw new PrismLangException("No support for ratio reward objectives yet");

2
prism/src/prism/MultiObjModelChecker.java

@ -272,7 +272,7 @@ public class MultiObjModelChecker extends PrismComponent
opsAndBounds.getProbStepBound(i), i); opsAndBounds.getProbStepBound(i), i);
} }
} }
tmpOpsAndBounds.add(new OpRelOpBound("R", MinMax.max(), RelOp.EQ, -1.0), Operator.R_MAX, -1.0, -1, opsAndBounds.probSize());
tmpOpsAndBounds.add(new OpRelOpBound("R", MinMax.max(), RelOp.COMPUTE_VALUES, -1.0), Operator.R_MAX, -1.0, -1, opsAndBounds.probSize());
ArrayList<JDDNode> tmprewards = new ArrayList<JDDNode>(1); ArrayList<JDDNode> tmprewards = new ArrayList<JDDNode>(1);
tmprewards.add(rtarget); tmprewards.add(rtarget);

2
prism/src/prism/NondetModelChecker.java

@ -838,7 +838,7 @@ public class NondetModelChecker extends NonProbModelChecker
throw new PrismException("Multi-objective properties can not use strict inequalities on P/R operators"); throw new PrismException("Multi-objective properties can not use strict inequalities on P/R operators");
} }
Operator op = null; Operator op = null;
if (relOp == RelOp.EQ) {
if (relOp == RelOp.COMPUTE_VALUES) {
if (exprQuant.getMinMax() != null) { if (exprQuant.getMinMax() != null) {
if (exprQuant.getMinMax().isMax()) { if (exprQuant.getMinMax().isMax()) {
op = (exprProb != null) ? Operator.P_MAX : Operator.R_MAX; op = (exprProb != null) ? Operator.P_MAX : Operator.R_MAX;

2
prism/src/prism/OpRelOpBound.java

@ -103,7 +103,7 @@ public class OpRelOpBound
throw new PrismLangException("Don't know how to model check " + getTypeOfOperator() + " properties for " + modelType + "s"); throw new PrismLangException("Don't know how to model check " + getTypeOfOperator() + " properties for " + modelType + "s");
} }
if (isNumeric()) { if (isNumeric()) {
if (relOp == RelOp.EQ) {
if (relOp == RelOp.COMPUTE_VALUES) {
throw new PrismLangException("Can't use \"" + op + "=?\" for nondeterministic models; use e.g. \"" + op + "min=?\" or \"" + op + "max=?\""); throw new PrismLangException("Can't use \"" + op + "=?\" for nondeterministic models; use e.g. \"" + op + "min=?\" or \"" + op + "max=?\"");
} }
} else { } else {

Loading…
Cancel
Save