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.

74 lines
2.0 KiB

2 months ago
  1. mdp
  2. module server
  3. s:[0..3];
  4. i:[0..3];
  5. j:[0..3];
  6. // initial cancel loops
  7. [client1_cancel] s=0 -> true;
  8. [client2_cancel] s=0 -> true;
  9. [client3_cancel] s=0 -> true;
  10. // client i request/grant/cancel
  11. [client1_request] s=0 -> (s'=1) & (i'=1);
  12. [client1_grant] s=1 & i=1 -> (s'=2);
  13. [client1_cancel] s=2 & i=1 -> (s'=0) & (i'=0);
  14. [client2_request] s=0 -> (s'=1) & (i'=2);
  15. [client2_grant] s=1 & i=2 -> (s'=2);
  16. [client2_cancel] s=2 & i=2 -> (s'=0) & (i'=0);
  17. [client3_request] s=0 -> (s'=1) & (i'=3);
  18. [client3_grant] s=1 & i=3 -> (s'=2);
  19. [client3_cancel] s=2 & i=3 -> (s'=0) & (i'=0);
  20. // deny other requests when serving
  21. [client1_request] s=2 -> (s'=3) & (j'=1);
  22. [client1_deny] s=3 & j=1 -> (s'=2) & (j'=0);
  23. [client2_request] s=2 -> (s'=3) & (j'=2);
  24. [client2_deny] s=3 & j=2 -> (s'=2) & (j'=0);
  25. [client3_request] s=2 -> (s'=3) & (j'=3);
  26. [client3_deny] s=3 & j=3 -> (s'=2) & (j'=0);
  27. // cancel loops when serving
  28. [client1_cancel] s=2 & i!=1 -> true;
  29. [client2_cancel] s=2 & i!=2 -> true;
  30. [client3_cancel] s=2 & i!=3 -> true;
  31. endmodule
  32. module client1
  33. c1:[-1..3];
  34. [client1_ch_mind] c1=-1 -> 0.9:(c1'=0)+0.1:(c1'=3);
  35. // change mind with probability 0.1
  36. [client1_request] c1=0 -> (c1'=1);
  37. [client1_deny] c1=1 -> (c1'=0);
  38. [client1_grant] c1=1 -> (c1'=2);
  39. [client1_useResource] c1=2 -> (c1'=2);
  40. [client1_cancel] c1=2 -> (c1'=0);
  41. [client1_cancel] c1=3 -> (c1'=1);
  42. endmodule
  43. module client2 = client1[ c1=c2, client1_ch_mind=client2_ch_mind, client1_request=client2_request,
  44. client1_deny=client2_deny, client1_grant=client2_grant,
  45. client1_useResource=client2_useResource, client1_cancel=client2_cancel]
  46. endmodule
  47. module client3 = client1[ c1=c3, client1_ch_mind=client3_ch_mind, client1_request=client3_request,
  48. client1_deny=client3_deny, client1_grant=client3_grant,
  49. client1_useResource=client3_useResource, client1_cancel=client3_cancel]
  50. endmodule
  51. rewards "grants"
  52. [client1_grant] true : 1;
  53. [client2_grant] true : 1;
  54. [client3_grant] true : 1;
  55. endrewards