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.

126 lines
3.8 KiB

2 months ago
  1. // flexible manufacturing system [CT93]
  2. // gxn/dxp 11/06/01
  3. ctmc // model is a ctmc
  4. const int n = 2; // number of tokens
  5. // rates from Pi equal #(Pi) * min(1, np/r)
  6. // where np = (3n)/2 and r = P1+P2+P3+P12
  7. const int np=floor((3*n)/2);
  8. formula r = P1+P2+P3+P12;
  9. module machine1
  10. P1 : [0..n] init n;
  11. P1wM1 : [0..n];
  12. P1M1 : [0..3];
  13. P1d : [0..n];
  14. P1s : [0..n];
  15. P1wP2 : [0..n];
  16. M1 : [0..3] init 3;
  17. [t1] (P1>0) & (M1>0) & (P1M1<3) -> P1*min(1,np/r) : (P1'=P1-1) & (P1M1'=P1M1+1) & (M1'=M1-1);
  18. [t1] (P1>0) & (M1=0) & (P1wM1<n) -> P1*min(1,np/r) : (P1'=P1-1) & (P1wM1'=P1wM1+1);
  19. [] (P1M1>0) & (P1wM1=0) & (M1<3) & (P1s<n) -> 0.2*P1M1 : (P1M1'=P1M1-1) & (M1'=M1+1) & (P1s'=P1s+1);
  20. [] (P1M1>0) & (P1wM1>0) & (P1s<n) -> 0.2*P1M1 : (P1wM1'=P1wM1-1) & (P1s'=P1s+1);
  21. [] (P1M1>0) & (P2wP1=0) & (P1wM1=0) & (M1<3) & (P1wP2<n) -> 0.05*P1M1 : (P1M1'=P1M1-1) & (M1'=M1+1) & (P1wP2'=P1wP2+1);
  22. [] (P1M1>0) & (P2wP1=0) & (P1wM1>0) & (P1wP2<n) -> 0.05*P1M1 : (P1wM1'=P1wM1-1) & (P1wP2'=P1wP2+1);
  23. [p1p2] (P1M1>0) & (P2wP1>0) & (P1wM1=0) & (M1<3) -> 0.05*P1M1 : (P1M1'=P1M1-1) & (M1'=M1+1);
  24. [p1p2] (P1M1>0) & (P2wP1>0) & (P1wM1>0) -> 0.05*P1M1 : (P1wM1'=P1wM1-1);
  25. [p1p2] (P1wP2>0) -> 1: (P1wP2'=P1wP2-1);
  26. [] (P1s>0) & (P1+P1s<=n) -> 1/60 : (P1s'=0) & (P1'=P1+P1s);
  27. [fp12] (P1+P12s<=n) -> 1: (P1'=P1+P12s);
  28. endmodule
  29. module machine2
  30. P2 : [0..n] init n;
  31. P2wM2 : [0..n];
  32. P2M2 : [0..1];
  33. P2s : [0..n];
  34. P2wP1 : [0..n];
  35. M2 : [0..1] init 1;
  36. [t2] (P2>0) & (M2>0) & (P2M2<1) -> P2*min(1,np/r) : (P2'=P2-1) & (P2M2'=P2M2+1) & (M2'=M2-1);
  37. [t2] (P2>0) & (M2=0) & (P2wM2<n) -> P2*min(1,np/r) : (P2'=P2-1) & (P2wM2'=P2wM2+1);
  38. [] (P2M2>0) & (P2wM2=0) & (M2<1) & (P2s<n) -> 0.1 : (P2M2'=P2M2-1) & (M2'=M2+1) & (P2s'=P2s+1);
  39. [] (P2M2>0) & (P2wM2>0) & (P2s<n) -> 0.1 : (P2wM2'=P2wM2-1) & (P2s'=P2s+1);
  40. [] (P2M2>0) & (P1wP2=0) & (P2wM2=0) & (M2<1) & (P2wP1<n) -> 1/15: (P2M2'=P2M2-1) & (M2'=M2+1) & (P2wP1'=P2wP1+1);
  41. [] (P2M2>0) & (P1wP2=0) & (P2wM2>0) & (P2wP1<n) -> 1/15: (P2wM2'=P2wM2-1) & (P2wP1'=P2wP1+1);
  42. [p1p2] (P2M2>0) & (P1wP2>0) & (P2wM2=0) & (M2<1) -> 1/15: (P2M2'=P2M2-1) & (M2'=M2+1);
  43. [p1p2] (P2M2>0) & (P1wP2>0) & (P2wM2>0) -> 1/15: (P2wM2'=P2wM2-1);
  44. [p1p2] (P2wP1>0) -> 1 : (P2wP1'=P2wP1-1);
  45. [] (P2s>0) & (P2+P2s<=n) -> 1/60 : (P2s'=0) & (P2'=P2+P2s);
  46. [fp12] (P2+P12s<=n) -> 1 : (P2'=P2+P12s);
  47. [p2p3] (M2>0) -> 1 : (M2'=M2);
  48. endmodule
  49. module machine3
  50. P3 : [0..n] init n;
  51. P3M2 : [0..n];
  52. P3s : [0..n];
  53. [t3] (P3>0) & (P3M2<n) -> P3*min(1,np/r) : (P3'=P3-1) & (P3M2'=P3M2+1);
  54. [p2p3] (P3M2>0) & (P3s<n) -> 1/2 : (P3M2'=P3M2-1) & (P3s'=P3s+1);
  55. [] (P3s>0) & (P3+P3s<=n) -> 1/60 : (P3s'=0) & (P3'=P3+P3s);
  56. endmodule
  57. module machine12
  58. P12 : [0..n];
  59. P12wM3 : [0..n];
  60. P12M3 : [0..2];
  61. P12s : [0..n];
  62. M3 : [0..2] init 2;
  63. [p1p2] (P12<n) -> 1: (P12'=P12+1);
  64. [t12] (P12>0) & (M3>0) & (P12M3<2) -> P12*min(1,np/r) : (P12'=P12-1) & (P12M3'=P12M3+1) & (M3'=M3-1);
  65. [t12] (P12>0) & (M3=0) & (P12wM3<n) -> P12*min(1,np/r) : (P12'=P12-1) & (P12wM3'=P12wM3+1);
  66. [] (P12M3>0) & (P12wM3=0) & (P12s<n) & (M3<2) -> P12M3 : (P12M3'=P12M3-1) & (P12s'=P12s+1) & (M3'=M3+1);
  67. [] (P12M3>0) & (P12wM3>0) & (P12s<n) -> P12M3 : (P12wM3'=P12wM3-1) & (P12s'=P12s+1);
  68. [fp12] (P12s>0) -> 1/60 : (P12s'=0);
  69. endmodule
  70. // reward structures
  71. // throughput of machine1
  72. rewards "throughput_m1"
  73. [t1] true : 1;
  74. endrewards
  75. // throughput of machine2
  76. rewards "throughput_m2"
  77. [t2] true : 1;
  78. endrewards
  79. // throughput of machine3
  80. rewards "throughput_m3"
  81. [t3] true : 1;
  82. endrewards
  83. // throughput of machine12
  84. rewards "throughput_m12"
  85. [t12] true : 1;
  86. endrewards
  87. // productivity of the system
  88. rewards "productivity"
  89. [t1] true : 400;
  90. [t2] true : 600;
  91. [t3] true : 100;
  92. [t12] true : 1100;
  93. endrewards