You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

201 lines
12 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
PRISM Manual | FrequentlyAskedQuestions / PRISMModelling
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="prism, probabilistic, symbolic, model, checker, verification, birmingham, oxford, parker, norman, kwiatkowska">
<link rel="icon" href="../pub/skins/offline/images/p16.ico" type="image/x-icon">
<link rel="shortcut icon" href="../pub/skins/offline/images/p16.ico" type="image/x-icon">
<!--HTMLHeader--><style type='text/css'><!--
ul, ol, pre, dl, p { margin-top:0px; margin-bottom:0px; }
code.escaped { white-space: nowrap; }
.vspace { margin-top:1.33em; }
.indent { margin-left:40px; }
.outdent { margin-left:40px; text-indent:-40px; }
a.createlinktext { text-decoration:none; border-bottom:1px dotted gray; }
a.createlink { text-decoration:none; position:relative; top:-0.5em;
font-weight:bold; font-size:smaller; border-bottom:none; }
img { border:0px; }
.editconflict { color:green;
font-style:italic; margin-top:1.33em; margin-bottom:1.33em; }
table.markup { border:2px dotted #ccf; width:90%; }
td.markup1, td.markup2 { padding-left:10px; padding-right:10px; }
table.vert td.markup1 { border-bottom:1px solid #ccf; }
table.horiz td.markup1 { width:23em; border-right:1px solid #ccf; }
table.markup caption { text-align:left; }
div.faq p, div.faq pre { margin-left:2em; }
div.faq p.question { margin:1em 0 0.75em 0; font-weight:bold; }
div.faqtoc div.faq * { display:none; }
div.faqtoc div.faq p.question
{ display:block; font-weight:normal; margin:0.5em 0 0.5em 20px; line-height:normal; }
div.faqtoc div.faq p.question * { display:inline; }
.frame
{ border:1px solid #cccccc; padding:4px; background-color:#f9f9f9; }
.lfloat { float:left; margin-right:0.5em; }
.rfloat { float:right; margin-left:0.5em; }
a.varlink { text-decoration:none; }
.sourceblocklink {
text-align: right;
font-size: smaller;
}
.sourceblocktext {
padding: 0.5em;
border: 1px solid #808080;
color: #000000;
background-color: #f1f0ed;
}
.sourceblocktext div {
font-family: monospace;
font-size: small;
line-height: 1;
height: 1%;
}
.sourceblocktext div.head,
.sourceblocktext div.foot {
font: italic medium serif;
padding: 0.5em;
}
--></style> <meta name='robots' content='index,follow' />
<link type="text/css" rel="stylesheet" href="../pub/skins/offline/css/base.css">
<link type="text/css" rel="stylesheet" href="../pub/skins/offline/css/prism.css">
<link type="text/css" rel="stylesheet" href="../pub/skins/offline/css/prismmanual.css">
</head>
<body text="#000000" bgcolor="#ffffff">
<div id="layout-maincontainer">
<div id="layout-main">
<div id="prism-mainbox">
<!-- ============================================================================= -->
<!--PageHeaderFmt-->
<!--/PageHeaderFmt-->
<!--PageTitleFmt-->
<div id="prism-man-title">
<p><a class='wikilink' href='Main.html'>Frequently Asked Questions</a> /
</p><h1>PRISM Modelling</h1>
</div>
<!--PageText-->
<div id='wikitext'>
<p><a name='max_model_size' id='max_model_size'></a>
</p><h3>What size models can PRISM handle?</h3>
<div class='answer' >
<p>There is no definitive answer to this. Because of PRISM's symbolic implementation, using data structures based on binary decision diagrams (BDDs), its performance can be unpredictable in this respect. There are also several factors that affect performance, including the type of model and property being checked and the engine being used (PRISM has several different engines, which have varying performance).
</p>
<p class='vspace'>Having said that, using the default engine in PRISM (the �hybrid� engine), you can normally expect to be able to handle models with up to 10^7-10^8 states on a typical PC. Using the MTBDD engine, you may be able to analyse much larger models (on some of the PRISM case studies, for example, PRISM can do numerical analysis of models with as many as 10^10 or 10^11 states). The manual has more information about PRISM's <a class='urllink' href='../ConfiguringPRISM/ComputationEngines.html'>engines</a>.
</p></div>
<p class='vspace'><a name='model_size' id='model_size'></a>
</p><h3>How can I reduce the size of my model?</h3>
<div class='answer' >
<p>The size of a probabilistic model (i.e. the number of states/transitions) is critical to the efficiency of performing probabilistic model checking on it, since both the time and memory required to do so are often proportional to the model size. Unfortunately, it is very easy to create models that are extremely large. Below are a few general tips for reducing model size.
</p>
<div class='vspace'></div><ul><li>Look for variables that have unnecessarily large ranges and try to reduce them. Even if your model needs large variables, it is generally a good strategy to first get a smaller version building successfully and then scale it up afterwards.
<div class='vspace'></div></li><li>Similarly, can you (if only temporarily) reduce the number of modules/components of your model? Start with the smallest number of components possible and then add others one by one.
<div class='vspace'></div></li><li>Do you have any inter-dependencies between variables? For example, perhaps you have some variables which are simply functions of other variables of the model. Even if these are convenient for model checking, they can be replaced with <a class='wikilink' href='../ThePRISMLanguage/FormulasAndLabels.html'>formulas or labels</a>, which do not contribute to the state space.
<div class='vspace'></div></li><li>Do any variables include more detail than is necessary for the model? Perhaps this can be exploited in order to reduce the number of variables in your model.
<div class='vspace'></div></li><li>More generally, are any aspects of the model not relevant to the properties that you are interested in? If so, start with a simpler, more abstract version of the model and then add more details if possible.
</li></ul></div>
<p class='vspace'><a name='ordering' id='ordering'></a>
</p><h3>How can I choose a good variable ordering?</h3>
<div class='answer' >
<p>Because PRISM is a symbolic model checker, the amount of memory required to store the probabilistic model can vary (sometime unpredictably) according to several factors. One example is the order in which the variables of your model appear in the model file. In general, there is no definitive answer to what the best ordering is but the following heuristics are a good guide.
</p>
<div class='vspace'></div><ul><li>Variables which are closely related should appear close together
<div class='vspace'></div></li><li>Variables which are related to most or all other variables should appear near the start of the ordering
</li></ul><p class='vspace'>Variables <code>x</code> and <code>y</code> are "related" if, for example, the value of one is has an effect on how the other changes (e.g. <code>(y'=x+1)</code>) or if both appear together in an expression (e.g. a guard).
</p>
<p class='vspace'>These heuristics also apply to the ordering of <em>modules</em> within the model file.
</p>
<p class='vspace'>For technical details about variable ordering issues, see e.g. section 8 of [<a class='wikilink' href='../Main/References.html#HKN+03'>HKN+03</a>] or section 4.1.2 of [<a class='wikilink' href='../Main/References.html#Par02'>Par02</a>].
</p></div>
<p class='vspace'><a name='det_delay' id='det_delay'></a>
</p><h3>How can I add deterministic time delays to a CTMC model?</h3>
<div class='answer' >
<p>All delays in a CTMC need to be modelled as <em>exponential</em> distributions. This is what makes them efficient to analyse. If you included a transition whose delay was <em>deterministic</em>, i.e. which always occurred after exactly the same delay, the model would no longer be a CTMC.
</p>
<p class='vspace'>One solution to this, if your model require such a delay, is to approximate a deterministic delay with an <a class='urllink' href='http://en.wikipedia.org/wiki/Erlang_distribution'>Erlang distribution</a> (a special case of a phase-type distribution). See for example this PRISM model:
</p>
<div class='vspace'></div>
<div class='sourceblock ' id='sourceblock1'>
<div class='sourceblocktext'><div class="prism"><span class="prismkeyword">ctmc</span><br/>
<br/>
<span class="prismkeyword">const</span> <span class="prismkeyword">int</span> <span class="prismident">k</span>;<br/>
<span class="prismkeyword">const</span> <span class="prismkeyword">double</span> <span class="prismident">mean</span> = <span class="prismnum">10</span>;<br/>
<br/>
<span class="prismkeyword">module</span> <span class="prismident">trigger</span><br/>
<br/>
<span class="prismident">i</span> : [<span class="prismnum">1</span>..<span class="prismident">k</span>+<span class="prismnum">1</span>];<br/>
<br/>
[]&nbsp;&nbsp;&nbsp;<span class="prismident">i</span> &lt; <span class="prismident">k</span> -&gt; <span class="prismident">k</span>/<span class="prismident">mean</span> : (<span class="prismident">i</span>'=<span class="prismident">i</span>+<span class="prismnum">1</span>);<br/>
[<span class="prismident">go</span>] <span class="prismident">i</span> = <span class="prismident">k</span> -&gt; <span class="prismident">k</span>/<span class="prismident">mean</span> : (<span class="prismident">i</span>'=<span class="prismident">i</span>+<span class="prismnum">1</span>);<br/>
<br/>
<span class="prismkeyword">endmodule</span><br/>
<br/>
<span class="prismkeyword">module</span> <span class="prismident">main</span><br/>
<br/>
<span class="prismident">x</span> : [<span class="prismnum">0</span>..<span class="prismnum">1</span>];<br/>
<br/>
[<span class="prismident">go</span>] <span class="prismident">x</span>=<span class="prismnum">0</span> -&gt; (<span class="prismident">x</span>'=<span class="prismnum">1</span>);<br/>
<br/>
<span class="prismkeyword">endmodule</span><br/>
</div></div>
<div class='sourceblocklink'><a href='http://www.prismmodelchecker.org/manual/FrequentlyAskedQuestions/PRISMModelling?action=sourceblock&amp;num=1' type='text/plain'>[&#036;[Get Code]]</a></div>
</div>
<p class='vspace'>In the model, the occurrence of the the go-labelled action occurs with an Erlang distribution with mean <code>mean</code> and shape <code>k</code>. The special case of <code>k</code>=1 is just an exponential distribution. The graph below shows the probability distribution of the delay, i.e. of <code>P=? [ F&lt;=T x=1 ]</code> for different values of <code>k</code>.
</p>
<div class='vspace'></div><div class="img"><img src='../uploads/faq-erlang.jpg' alt='' title='' /></div>
<p class='vspace'>There is an obvious trade-off here between the accuracy (how close it is to modelling a deterministic time delay) and the resulting blow-up in the size of the model that you add this to. For <code>k</code>=1000, you can see that the shape is quite "deterministic" but this would increase your model size by a factor of ~1000.
</p></div>
</div>
<!--PageFooterFmt-->
<div id='prism-man-footer'>
</div>
<!--/PageFooterFmt-->
<!-- ============================================================================= -->
</div> <!-- id="prism-mainbox" -->
</div> <!-- id="layout-main" -->
</div> <!-- id="layout-maincontainer" -->
<div id="layout-leftcol">
<div id="prism-navbar2">
<h3><a class='wikilink' href='../Main/Main.html'>PRISM Manual</a></h3>
<p><strong><a class='wikilink' href='Main.html'>Frequently Asked Questions</a></strong>
</p><ul><li><a class='wikilink' href='MemoryProblems.html'>Memory Problems</a>
</li><li><a class='selflink' href='PRISMModelling.html'>PRISM Modelling</a>
</li><li><a class='wikilink' href='PRISMProperties.html'>PRISM Properties</a>
</li></ul><p>[ <a class='wikilink' href='AllOnOnePage.html'>View all</a> ]
</p>
</div> <!-- id="prism-navbar2" -->
</div> <!-- id="layout-leftcol" -->
</body>
</html>