It is also now possible to construct models in PRISM through direct specification of their transition matrix.
The format in which this information is input to the tool is exactly the same as is currently output
(see the section "Exporting The Model" and the appendix "Explicit Model Files").
Presently, this functionality is only supported in the command-line version of the tool, using the -importtrans
switch.
At the moment, PRISM makes no attempt to discern the model type from the input file.
By default it assumes that the model is an MDP.
If this is not the case, the model type can be overwritten using the -dtmc
, -ctmc
and -mdp
switches.
For example:
Please note that this method of constructing models in PRISM is typically less efficient than using the PRISM language.
This is because PRISM is (primarily) a symbolic model checker and the underlying data structures used to represent the model
function better when there is high-level structure and regularity to exploit.
This situation can be alleviated to a certain extent by importing not just a transition matrix,
but also a definition of each state of the model in terms of a set of variables.
The format of this information is again identical to PRISM's current output format, using the -exportstates
switch.
The following example shows how PRISM could be used to build, export and then re-import a model
(not a good strategy in general):
Lastly, since details about the initial state of a model is not preserved in the files output from -exportstates
and -exporttrans
, this information needs to specified separately.
If not, the default is to assume a single initial state, in which all variables take their minimum value (if -importstates
is not used, the model has a a single zero-indexed variable x
, and the initial state is x=0
).
To specify an alternative set of initial states, use the switch -importlabels
, e.g.:
where the labels file (poll2.lab
above) is in the format generated by the -exportlabels
export option of PRISM. Currently, the -importlabels
switch does not import any other label information - just the set of initial states.
In a similar style to PRISM's -exportmodel
switch, you can import several several files for a model using a single -importmodel
switch. For example, this is equivalent to the command given above:
The contents of each file is determined by its extension:
Possible file extensions are:
.sta
(reachable states),
.tra
(transition matrix),
.lab
(labels).
Use the extension .all
to import from all of these files: