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.

132 lines
7.4 KiB

  1. mdp
  2. const int initY = 40;
  3. const int initX = 80;
  4. const int maxY = 560;
  5. const int minX = 4;
  6. const int maxX = 144;
  7. formula Gate_1 = ((x=41 | x=73) & y=168);
  8. formula Gate_2 = ((x=71 | x=104) & y=261);
  9. formula Gate_3 = ((x=81 | x=113) & y=353);
  10. formula Gate_4 = ((x=55 | x=88) & y=446);
  11. formula Gate_5 = ((x=79 | x=110) & y=538);
  12. formula Passed_Gate_1 = ((x>41 & x<73) & (y>164 & y<170)); //(y=168));
  13. formula Passed_Gate_2 = ((x>71 & x<104) & (y>257 & y<262)); //(y=261));
  14. formula Passed_Gate_3 = ((x>81 & x<113) & (y>349 & y<355)); //(y=353));
  15. formula Passed_Gate_4 = ((x>55 & x<88) & (y>442 & y<448)); //(y=446));
  16. formula Passed_Gate_5 = ((x>79 & x<110) & (y>534 & y<540)); //(y=538));
  17. formula Tree_1 = ((x>=124 & x<=134) & (y>=194 & y<=200));
  18. formula Tree_2 = ((x>=32 & x<=42) & (y>=291 & y<=297));
  19. formula Tree_3 = ((x>=28 & x<=38) & (y>=321 & y<=327));
  20. formula Tree_4 = ((x>=12 & x<=22) & (y>=412 & y<=418));
  21. formula Tree_5 = ((x>=129 & x<=139) & (y>=472 & y<=480));
  22. formula Tree_6 = ((x>=140 & x<=144) & (y>=502 & y<=510));
  23. formula Hit_Tree = Tree_1 | Tree_2 | Tree_3 | Tree_4 | Tree_5 | Tree_6;
  24. formula Hit_Gate = Gate_1 | Gate_2 | Gate_3 | Gate_4 | Gate_5;
  25. global move : [0..3] init 0;
  26. module skier
  27. ski_position : [1..14] init 8;
  28. done : bool init false;
  29. passed_gate_1 : bool init false;
  30. passed_gate_2 : bool init false;
  31. passed_gate_3 : bool init false;
  32. passed_gate_4 : bool init false;
  33. passed_gate_5 : bool init false;
  34. [g1_left] !passed_gate_1 & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_1'=(Passed_Gate_1));
  35. [g1_right] !passed_gate_1 & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_1'=(Passed_Gate_1));
  36. [g1_noop] !passed_gate_1 & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_1'=(Passed_Gate_1));
  37. [g2_left] !passed_gate_2 & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_2'=(Passed_Gate_2));
  38. [g2_right] !passed_gate_2 & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_2'=(Passed_Gate_2));
  39. [g2_noop] !passed_gate_2 & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_2'=(Passed_Gate_2));
  40. [g3_left] !passed_gate_3 & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_3'=(Passed_Gate_3));
  41. [g3_right] !passed_gate_3 & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_3'=(Passed_Gate_3));
  42. [g3_noop] !passed_gate_3 & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_3'=(Passed_Gate_3));
  43. [g4_left] !passed_gate_4 & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_4'=(Passed_Gate_4));
  44. [g4_right] !passed_gate_4 & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_4'=(Passed_Gate_4));
  45. [g4_noop] !passed_gate_4 & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_4'=(Passed_Gate_4));
  46. [g5_left] !passed_gate_5 & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_5'=(Passed_Gate_5));
  47. [g5_right] !passed_gate_5 & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_5'=(Passed_Gate_5));
  48. [g5_noop] !passed_gate_5 & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate_5'=(Passed_Gate_5));
  49. [left] !done & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate));
  50. [right] !done & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate));
  51. [noop] !done & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate));
  52. [left] done & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1);
  53. [right] done & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1);
  54. [noop] done & move=0 -> (move'=1);
  55. endmodule
  56. module updateY
  57. y : [initY..maxY] init initY;
  58. standstill : [0..8] init 0;
  59. [update_y] move=1 & (ski_position=1 | ski_position = 14) & standstill>=5 -> (y'=y) & (standstill'=min(8,standstill+1)) & (move'=2);
  60. [update_y] move=1 & (ski_position=1 | ski_position = 14) & standstill<5 -> (y'=min(maxY,y+4)) & (standstill'=min(8,standstill+1)) & (move'=2);
  61. [update_y] move=1 & (ski_position=2 | ski_position = 3 | ski_position = 12 | ski_position = 13) -> (y'=min(maxY,y+8)) & (standstill'=0) & (move'=2);
  62. [update_y] move=1 & (ski_position=4 | ski_position = 5 | ski_position = 10 | ski_position = 11) -> (y'=min(maxY,y+12)) & (standstill'=0) & (move'=2);
  63. [update_y] move=1 & (ski_position=6 | ski_position = 7 | ski_position = 8 | ski_position = 9) -> (y'=min(maxY,y+16)) & (standstill'=0) & (move'=2);
  64. endmodule
  65. module updateX
  66. x : [minX..maxX] init initX;
  67. [update_x] move=2 & standstill>=8 -> (move'=0);
  68. [update_x] move=2 & standstill<8 & (ski_position=7 | ski_position=8) -> (move'=0);
  69. [update_x] move=2 & standstill<8 & ski_position=6 -> 0.1: (x'=max(minX,x-2)) + 0.7: (x'=max(minX,x-4)) + 0.2: (x'=max(minX,x-6)) & (move'=0);
  70. [update_x] move=2 & standstill<8 & ski_position=9 -> 0.1: (x'=min(maxX,x+2)) + 0.7: (x'=min(maxX,x+4)) + 0.2: (x'=min(maxX,x+6)) & (move'=0);
  71. [update_x] move=2 & standstill<8 & (ski_position=4 | ski_position=5) -> 0.1: (x'=max(minX,x-4)) + 0.7: (x'=max(minX,x-6)) + 0.2: (x'=max(minX,x-8)) & (move'=0);
  72. [update_x] move=2 & standstill<8 & (ski_position=10 | ski_position=11) -> 0.1: (x'=min(maxX,x+4)) + 0.7: (x'=min(maxX,x+6)) + 0.2: (x'=min(maxX,x+8)) & (move'=0);
  73. [update_x] move=2 & standstill<8 & (ski_position=2 | ski_position=3) -> 0.1: (x'=max(minX,x-4)) + 0.7: (x'=max(minX,x-6)) + 0.2: (x'=max(minX,x-8)) & (move'=0);
  74. [update_x] move=2 & standstill<8 & (ski_position=12 | ski_position=13) -> 0.1: (x'=min(maxX,x+4)) + 0.7: (x'=min(maxX,x+6)) + 0.2: (x'=min(maxX,x+8)) & (move'=0);
  75. [update_x] move=2 & standstill<8 & (ski_position=1) -> 0.1: (x'=max(minX,x-0)) + 0.7: (x'=max(minX,x-2)) + 0.2: (x'=max(minX,x-4)) & (move'=0);
  76. [update_x] move=2 & standstill<8 & (ski_position=14) -> 0.1: (x'=min(maxX,x+0)) + 0.7: (x'=min(maxX,x+2)) + 0.2: (x'=min(maxX,x+4)) & (move'=0);
  77. endmodule
  78. rewards
  79. [g1_left] !passed_gate_1 & Passed_Gate_1: 100;
  80. [g1_right] !passed_gate_1 & Passed_Gate_1: 100;
  81. [g1_noop] !passed_gate_1 & Passed_Gate_1: 100;
  82. [g2_left] !passed_gate_2 & Passed_Gate_2: 100;
  83. [g2_right] !passed_gate_2 & Passed_Gate_2: 100;
  84. [g2_noop] !passed_gate_2 & Passed_Gate_2: 100;
  85. [g3_left] !passed_gate_3 & Passed_Gate_3: 100;
  86. [g3_right] !passed_gate_3 & Passed_Gate_3: 100;
  87. [g3_noop] !passed_gate_3 & Passed_Gate_3: 100;
  88. [g4_left] !passed_gate_4 & Passed_Gate_4: 100;
  89. [g4_right] !passed_gate_4 & Passed_Gate_4: 100;
  90. [g4_noop] !passed_gate_4 & Passed_Gate_4: 100;
  91. [g5_left] !passed_gate_5 & Passed_Gate_5: 100;
  92. [g5_right] !passed_gate_5 & Passed_Gate_5: 100;
  93. [g5_noop] !passed_gate_5 & Passed_Gate_5: 100;
  94. [left] !done & (Hit_Tree) : -100;
  95. [right] !done & (Hit_Tree) : -100;
  96. [noop] !done & (Hit_Tree) : -100;
  97. [left] !done & (Hit_Gate) : -100;
  98. [right] !done & (Hit_Gate) : -100;
  99. [noop] !done & (Hit_Gate) : -100;
  100. endrewards