The source code and dockerfile for the GSW2024 AI Lab.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

148 lines
2.8 KiB

2 months ago
  1. // bounded retransmission protocol [D'AJJL01]
  2. // gxn/dxp 23/05/2001
  3. // Modified by Ernst Moritz Hahn (emh@cs.uni-sb.de)
  4. mdp
  5. //dtmc
  6. // number of chunks
  7. const int N = 16;
  8. // maximum number of retransmissions
  9. const int MAX = 2;
  10. // reliability of channels
  11. const double pL;
  12. const double pK;
  13. // timeouts
  14. const double TOMsg;
  15. const double TOAck;
  16. module sender
  17. s : [0..6];
  18. // 0 idle
  19. // 1 next_frame
  20. // 2 wait_ack
  21. // 3 retransmit
  22. // 4 success
  23. // 5 error
  24. // 6 wait sync
  25. srep : [0..3];
  26. // 0 bottom
  27. // 1 not ok (nok)
  28. // 2 do not know (dk)
  29. // 3 ok (ok)
  30. nrtr : [0..MAX];
  31. i : [0..N];
  32. bs : bool;
  33. s_ab : bool;
  34. fs : bool;
  35. ls : bool;
  36. // idle
  37. [NewFile] (s=0) -> (s'=1) & (i'=1) & (srep'=0);
  38. // next_frame
  39. [aF] (s=1) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=0);
  40. // wait_ack
  41. [aB] (s=2) -> (s'=4) & (s_ab'=!s_ab);
  42. [TO_Msg] (s=2) -> (s'=3);
  43. [TO_Ack] (s=2) -> (s'=3);
  44. // retransmit
  45. [aF] (s=3) & (nrtr<MAX) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=nrtr+1);
  46. [] (s=3) & (nrtr=MAX) & (i<N) -> (s'=5) & (srep'=1);
  47. [] (s=3) & (nrtr=MAX) & (i=N) -> (s'=5) & (srep'=2);
  48. // success
  49. [] (s=4) & (i<N) -> (s'=1) & (i'=i+1);
  50. [] (s=4) & (i=N) -> (s'=0) & (srep'=3);
  51. // error
  52. [SyncWait] (s=5) -> (s'=6);
  53. // wait sync
  54. [SyncWait] (s=6) -> (s'=0) & (s_ab'=false);
  55. endmodule
  56. module receiver
  57. r : [0..5];
  58. // 0 new_file
  59. // 1 fst_safe
  60. // 2 frame_received
  61. // 3 frame_reported
  62. // 4 idle
  63. // 5 resync
  64. rrep : [0..4];
  65. // 0 bottom
  66. // 1 fst
  67. // 2 inc
  68. // 3 ok
  69. // 4 nok
  70. fr : bool;
  71. lr : bool;
  72. br : bool;
  73. r_ab : bool;
  74. recv : bool;
  75. // new_file
  76. [SyncWait] (r=0) -> (r'=0);
  77. [aG] (r=0) -> (r'=1) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=T);
  78. // fst_safe_frame
  79. [] (r=1) -> (r'=2) & (r_ab'=br);
  80. // frame_received
  81. [] (r=2) & (r_ab=br) & (fr=true) & (lr=false) -> (r'=3) & (rrep'=1);
  82. [] (r=2) & (r_ab=br) & (fr=false) & (lr=false) -> (r'=3) & (rrep'=2);
  83. [] (r=2) & (r_ab=br) & (fr=false) & (lr=true) -> (r'=3) & (rrep'=3);
  84. [aA] (r=2) & !(r_ab=br) -> (r'=4);
  85. // frame_reported
  86. [aA] (r=3) -> (r'=4) & (r_ab'=!r_ab);
  87. // idle
  88. [aG] (r=4) -> (r'=2) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=T);
  89. [SyncWait] (r=4) & (ls=true) -> (r'=5);
  90. [SyncWait] (r=4) & (ls=false) -> (r'=5) & (rrep'=4);
  91. // resync
  92. [SyncWait] (r=5) -> (r'=0) & (rrep'=0);
  93. endmodule
  94. module checker
  95. T : bool init false;
  96. [NewFile] (T=false) -> (T'=false);
  97. [NewFile] (T=false) -> (T'=true);
  98. endmodule
  99. module channelK
  100. k : [0..2];
  101. // idle
  102. [aF] (k=0) -> pK : (k'=1) + 1-pK : (k'=2);
  103. // sending
  104. [aG] (k=1) -> (k'=0);
  105. // lost
  106. [TO_Msg] (k=2) -> (k'=0);
  107. endmodule
  108. module channelL
  109. l : [0..2];
  110. // idle
  111. [aA] (l=0) -> pL : (l'=1) + 1-pL : (l'=2);
  112. // sending
  113. [aB] (l=1) -> (l'=0);
  114. // lost
  115. [TO_Ack] (l=2) -> (l'=0);
  116. endmodule
  117. rewards
  118. [TO_Msg] true : TOMsg;
  119. [TO_Ack] true : TOAck;
  120. endrewards