Browse Source

Some tidying in explicit model construction.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@3381 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 15 years ago
parent
commit
385de74b06
  1. 16
      prism/src/explicit/ConstructModel.java

16
prism/src/explicit/ConstructModel.java

@ -3,6 +3,7 @@
// Copyright (c) 2002- // Copyright (c) 2002-
// Authors: // Authors:
// * Dave Parker <david.parker@comlab.ox.ac.uk> (University of Oxford) // * Dave Parker <david.parker@comlab.ox.ac.uk> (University of Oxford)
// * Vojtech Forejt <vojtech.forejt@cs.ox.ac.uk> (University of Oxford)
// //
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// //
@ -115,7 +116,7 @@ public class ConstructModel
Model model = null; Model model = null;
Distribution distr = null; Distribution distr = null;
// Misc // Misc
int i, j, k, nc, nt, src, dest;
int i, j, nc, nt, src, dest;
long timer, timerProgress; long timer, timerProgress;
boolean fixdl = false; boolean fixdl = false;
@ -178,6 +179,7 @@ public class ConstructModel
// Look at each outgoing choice in turn // Look at each outgoing choice in turn
nc = engine.getNumChoices(); nc = engine.getNumChoices();
for (i = 0; i < nc; i++) { for (i = 0; i < nc; i++) {
if (!justReach && (modelType == ModelType.MDP || modelType == ModelType.CTMDP)) { if (!justReach && (modelType == ModelType.MDP || modelType == ModelType.CTMDP)) {
distr = new Distribution(); distr = new Distribution();
} }
@ -190,9 +192,10 @@ public class ConstructModel
// If so, add to the explore list // If so, add to the explore list
explore.add(stateNew); explore.add(stateNew);
// And to model // And to model
if (!justReach)
if (!justReach) {
modelSimple.addState(); modelSimple.addState();
} }
}
// Get index of state in state set // Get index of state in state set
dest = states.getIndexOfLastAdd(); dest = states.getIndexOfLastAdd();
// Add transitions to model // Add transitions to model
@ -216,15 +219,20 @@ public class ConstructModel
if (!justReach) { if (!justReach) {
if (modelType == ModelType.MDP) { if (modelType == ModelType.MDP) {
if (distinguishActions) { if (distinguishActions) {
k = mdp.addActionLabelledChoice(src, distr, engine.getTransitionAction(i, 0));
mdp.addActionLabelledChoice(src, distr, engine.getTransitionAction(i, 0));
} else { } else {
k = mdp.addChoice(src, distr);
mdp.addChoice(src, distr);
} }
} else if (modelType == ModelType.CTMDP) { } else if (modelType == ModelType.CTMDP) {
if (distinguishActions) {
ctmdp.addActionLabelledChoice(src, distr, engine.getTransitionAction(i, 0));
} else {
ctmdp.addChoice(src, distr); ctmdp.addChoice(src, distr);
} }
} }
} }
}
// Print some progress info occasionally // Print some progress info occasionally
if (System.currentTimeMillis() - timerProgress > 3000) { if (System.currentTimeMillis() - timerProgress > 3000) {
mainLog.print(" " + (src + 1)); mainLog.print(" " + (src + 1));

Loading…
Cancel
Save