Browse Source

Additional checks in explicit MDP model checker: don't allow policy iteration methods to be use when 'known' values are passed in (from Joachim Klein).

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@9157 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 11 years ago
parent
commit
0a5e0b6203
  1. 18
      prism/src/explicit/MDPModelChecker.java

18
prism/src/explicit/MDPModelChecker.java

@ -208,7 +208,8 @@ public class MDPModelChecker extends ProbModelChecker
* @param min Min or max probabilities (true=min, false=max) * @param min Min or max probabilities (true=min, false=max)
* @param init Optionally, an initial solution vector (may be overwritten) * @param init Optionally, an initial solution vector (may be overwritten)
* @param known Optionally, a set of states for which the exact answer is known * @param known Optionally, a set of states for which the exact answer is known
* Note: if 'known' is specified (i.e. is non-null, 'init' must also be given and is used for the exact values.
* Note: if 'known' is specified (i.e. is non-null, 'init' must also be given and is used for the exact values).
* Also, 'known' values cannot be passed for some solution methods, e.g. policy iteration.
*/ */
public ModelCheckerResult computeReachProbs(MDP mdp, BitSet remain, BitSet target, boolean min, double init[], BitSet known) throws PrismException public ModelCheckerResult computeReachProbs(MDP mdp, BitSet remain, BitSet target, boolean min, double init[], BitSet known) throws PrismException
{ {
@ -233,6 +234,11 @@ public class MDPModelChecker extends ProbModelChecker
if (!min) if (!min)
throw new PrismException("Value iteration from above only works for minimum probabilities"); throw new PrismException("Value iteration from above only works for minimum probabilities");
} }
if (mdpSolnMethod == MDPSolnMethod.POLICY_ITERATION || mdpSolnMethod == MDPSolnMethod.MODIFIED_POLICY_ITERATION) {
if (known != null) {
throw new PrismException("Policy iteration methods cannot be passed 'known' values for some states");
}
}
// Start probabilistic reachability // Start probabilistic reachability
timer = System.currentTimeMillis(); timer = System.currentTimeMillis();
@ -1127,7 +1133,8 @@ public class MDPModelChecker extends ProbModelChecker
* @param min Min or max rewards (true=min, false=max) * @param min Min or max rewards (true=min, false=max)
* @param init Optionally, an initial solution vector (may be overwritten) * @param init Optionally, an initial solution vector (may be overwritten)
* @param known Optionally, a set of states for which the exact answer is known * @param known Optionally, a set of states for which the exact answer is known
* Note: if 'known' is specified (i.e. is non-null, 'init' must also be given and is used for the exact values.
* Note: if 'known' is specified (i.e. is non-null, 'init' must also be given and is used for the exact values).
* Also, 'known' values cannot be passed for some solution methods, e.g. policy iteration.
*/ */
public ModelCheckerResult computeReachRewards(MDP mdp, MDPRewards mdpRewards, BitSet target, boolean min, double init[], BitSet known) public ModelCheckerResult computeReachRewards(MDP mdp, MDPRewards mdpRewards, BitSet target, boolean min, double init[], BitSet known)
throws PrismException throws PrismException
@ -1146,6 +1153,13 @@ public class MDPModelChecker extends ProbModelChecker
mainLog.printWarning("Switching to MDP solution method \"" + mdpSolnMethod.fullName() + "\""); mainLog.printWarning("Switching to MDP solution method \"" + mdpSolnMethod.fullName() + "\"");
} }
// Check for some unsupported combinations
if (mdpSolnMethod == MDPSolnMethod.POLICY_ITERATION) {
if (known != null) {
throw new PrismException("Policy iteration methods cannot be passed 'known' values for some states");
}
}
// Start expected reachability // Start expected reachability
timer = System.currentTimeMillis(); timer = System.currentTimeMillis();
mainLog.println("\nStarting expected reachability (" + (min ? "min" : "max") + ")..."); mainLog.println("\nStarting expected reachability (" + (min ? "min" : "max") + ")...");

Loading…
Cancel
Save