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.

65 lines
1.7 KiB

  1. // polling example [IT90]
  2. // gxn/dxp 26/01/00
  3. ctmc
  4. const int N = 5;
  5. const double mu = 1;
  6. const double gamma = 200;
  7. const double lambda = mu/N;
  8. module server
  9. s : [1..5]; // station
  10. a : [0..1]; // action: 0=polling, 1=serving
  11. [loop1a] (s=1)&(a=0) -> gamma : (s'=s+1);
  12. [loop1b] (s=1)&(a=0) -> gamma : (a'=1);
  13. [serve1] (s=1)&(a=1) -> mu : (s'=s+1)&(a'=0);
  14. [loop2a] (s=2)&(a=0) -> gamma : (s'=s+1);
  15. [loop2b] (s=2)&(a=0) -> gamma : (a'=1);
  16. [serve2] (s=2)&(a=1) -> mu : (s'=s+1)&(a'=0);
  17. [loop3a] (s=3)&(a=0) -> gamma : (s'=s+1);
  18. [loop3b] (s=3)&(a=0) -> gamma : (a'=1);
  19. [serve3] (s=3)&(a=1) -> mu : (s'=s+1)&(a'=0);
  20. [loop4a] (s=4)&(a=0) -> gamma : (s'=s+1);
  21. [loop4b] (s=4)&(a=0) -> gamma : (a'=1);
  22. [serve4] (s=4)&(a=1) -> mu : (s'=s+1)&(a'=0);
  23. [loop5a] (s=5)&(a=0) -> gamma : (s'=1);
  24. [loop5b] (s=5)&(a=0) -> gamma : (a'=1);
  25. [serve5] (s=5)&(a=1) -> mu : (s'=1)&(a'=0);
  26. endmodule
  27. module station1
  28. s1 : [0..1]; // state of station: 0=empty, 1=full
  29. [loop1a] (s1=0) -> 1 : (s1'=0);
  30. [] (s1=0) -> lambda : (s1'=1);
  31. [loop1b] (s1=1) -> 1 : (s1'=1);
  32. [serve1] (s1=1) -> 1 : (s1'=0);
  33. endmodule
  34. // construct further stations through renaming
  35. module station2 = station1 [ s1=s2, loop1a=loop2a, loop1b=loop2b, serve1=serve2 ] endmodule
  36. module station3 = station1 [ s1=s3, loop1a=loop3a, loop1b=loop3b, serve1=serve3 ] endmodule
  37. module station4 = station1 [ s1=s4, loop1a=loop4a, loop1b=loop4b, serve1=serve4 ] endmodule
  38. module station5 = station1 [ s1=s5, loop1a=loop5a, loop1b=loop5b, serve1=serve5 ] endmodule
  39. // (cumulative) rewards
  40. // expected time station 1 is waiting to be served
  41. rewards "waiting"
  42. s1=1 & !(s=1 & a=1) : 1;
  43. endrewards
  44. // expected number of times station 1 is served
  45. rewards "served"
  46. [serve1] true : 1;
  47. endrewards