The PRISM Language /

Example 2

We now introduce a second example, which is a model of an N-place queue of jobs and a server which removes jobs from the queue and processes them. The PRISM code can be found below.

// Example 2
// N-place queue + server

ctmc

const int N = 10;
const double mu = 1/10;
const double lambda = 1/2;
const double gamma = 1/3;

module queue
     q : [0..N];

     [] q<N -> mu:(q'=q+1);
     [] q=N -> mu:(q'=q);
     [serve] q>0 -> lambda:(q'=q-1);
endmodule

module server
     s : [0..1];

     [serve] s=0 -> 1:(s'=1);
     [] s=1 -> gamma:(s'=0);
endmodule

The PRISM Language: Example 2

As can be seen from the start of the file, the model is a continuous-time Markov chain (CTMC). One of the main differences, therefore, is that transitions of modules are labelled with (positive-valued) rates, rather than probabilities. The notation used in commands, however, to associate rates to transitions is identical to that used to assign probabilities in DTMCs and MDPs:

rate_1:update_1 + rate_2:update_2 + ...

Example 2 also introduces a number of other PRISM language concepts: constants, action labels and synchronisation. These are described in the following sections.

PRISM Manual

The PRISM Language

[ View all ]