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.
54 lines
1.4 KiB
54 lines
1.4 KiB
// polling example [IT90]
|
|
// gxn/dxp 26/01/00
|
|
|
|
stochastic
|
|
|
|
const double mu = 1;
|
|
const double gamma = 200;
|
|
const int N = 3;
|
|
const double lambda = mu/N;
|
|
|
|
module server
|
|
|
|
s : [1..3]; // station
|
|
a : [0..1]; // action: 0=polling, 1=serving
|
|
|
|
[loop1a] (s=1)&(a=0) -> gamma : (s'=s+1);
|
|
[loop1b] (s=1)&(a=0) -> gamma : (a'=1);
|
|
[serve1] (s=1)&(a=1) -> mu : (s'=s+1)&(a'=0);
|
|
|
|
[loop2a] (s=2)&(a=0) -> gamma : (s'=s+1);
|
|
[loop2b] (s=2)&(a=0) -> gamma : (a'=1);
|
|
[serve2] (s=2)&(a=1) -> mu : (s'=s+1)&(a'=0);
|
|
|
|
[loop3a] (s=3)&(a=0) -> gamma : (s'=1);
|
|
[loop3b] (s=3)&(a=0) -> gamma : (a'=1);
|
|
[serve3] (s=3)&(a=1) -> mu : (s'=1)&(a'=0);
|
|
|
|
endmodule
|
|
|
|
module station1
|
|
|
|
s1 : [0..1]; // state: 0=empty , 1=full
|
|
|
|
[loop1a] (s1=0) -> 1 : (s1'=0);
|
|
[] (s1=0) -> lambda : (s1'=1);
|
|
[loop1b] (s1=1) -> 1 : (s1'=1);
|
|
[serve1] (s1=1) -> 1 : (s1'=0);
|
|
|
|
endmodule
|
|
|
|
// construct further stations through renaming
|
|
module station2 = station1 [s1=s2, loop1a=loop2a, loop1b=loop2b, serve1=serve2] endmodule
|
|
module station3 = station1 [s1=s3, loop1a=loop3a, loop1b=loop3b, serve1=serve3] endmodule
|
|
|
|
// cumulative rewards
|
|
const int waiting = 1; // expected time the station 1 is waiting to be served
|
|
const int served = 0; // expected number of times station1 is served
|
|
|
|
rewards
|
|
|
|
s1=1 & !(s=1 & a=1) : waiting;
|
|
[serve1] true : served;
|
|
|
|
endrewards
|