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.

113 lines
5.8 KiB

  1. mdp
  2. const int initY = 40;
  3. const int initX = 80;
  4. const int maxY = 210;
  5. const int minX = 4;
  6. const int maxX = 144;
  7. formula Gate_1 = ((42<x & x<50 | 74<x & x=80) & 184<y & y<172);
  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>160 & y<176)); //(y=168));
  13. formula Passed_Gate_2 = ((x>71 & x<104) & (y>253 & y<269)); //(y=261));
  14. formula Passed_Gate_3 = ((x>81 & x<113) & (y>345 & y<361)); //(y=353));
  15. formula Passed_Gate_4 = ((x>55 & x<88) & (y>438 & y<454)); //(y=446));
  16. formula Passed_Gate_5 = ((x>79 & x<110) & (y>530 & y<546)); //(y=538));
  17. formula Left_Gate_1 = y>176;
  18. formula Left_Gate_2 = y>269;
  19. formula Left_Gate_3 = y>361;
  20. formula Left_Gate_4 = y>454;
  21. formula Left_Gate_5 = y>546;
  22. formula Tree_1 = ((x>=124 & x<=142) & (y>=190 & y<=200));
  23. formula Tree_2 = ((x>=32 & x<=42) & (y>=287 & y<=297));
  24. formula Tree_3 = ((x>=28 & x<=38) & (y>=317 & y<=327));
  25. formula Tree_4 = ((x>=12 & x<=22) & (y>=408 & y<=418));
  26. formula Tree_5 = ((x>=129 & x<=139) & (y>=468 & y<=480));
  27. formula Tree_6 = ((x>=140 & x<=144) & (y>=496 & y<=510));
  28. formula Hit_Tree = Tree_1 | Tree_2 | Tree_3 | Tree_4 | Tree_5 | Tree_6;
  29. formula Hit_Gate = Gate_1 | Gate_2 | Gate_3 | Gate_4 | Gate_5;
  30. formula Passed_Gate = Passed_Gate_1 | Passed_Gate_2 | Passed_Gate_3 | Passed_Gate_4 | Passed_Gate_5;
  31. formula Left_Gate = Left_Gate_1 | Left_Gate_2 | Left_Gate_3 | Left_Gate_4 | Left_Gate_5;
  32. init
  33. move=0 & !done & !passed_gate & standstill=0
  34. endinit
  35. global move : [0..3];
  36. formula Fixed_Left = false;
  37. formula Fixed_Right = false;
  38. formula Fixed_Noop = false;
  39. formula Fixed = Fixed_Left | Fixed_Right | Fixed_Noop;
  40. module skier
  41. ski_position : [1..14] ;
  42. done : bool ;
  43. passed_gate : bool ;
  44. [left] !Fixed & !passed_gate & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Passed_Gate));
  45. [right] !Fixed & !passed_gate & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Passed_Gate));
  46. [noop] !Fixed & !passed_gate & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Passed_Gate));
  47. [left] !Fixed & passed_gate & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  48. [right] !Fixed & passed_gate & move=0 & ski_position<14 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  49. [noop] !Fixed & passed_gate & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  50. [left] Fixed_Left & move=0 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  51. [right] Fixed_Right & move=0 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  52. [noop] Fixed_Noop & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  53. [done] done -> true;
  54. endmodule
  55. module updateY
  56. y : [initY..maxY] ;
  57. standstill : [0..8] ;
  58. [update_y] move=1 & (ski_position=1 | ski_position = 14) & standstill>=5 -> (y'=y) & (standstill'=min(8,standstill+1)) & (move'=2);
  59. [update_y] move=1 & (ski_position=1 | ski_position = 14) & standstill<5 -> (y'=min(maxY,y+4)) & (standstill'=min(8,standstill+1)) & (move'=2);
  60. [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);
  61. [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);
  62. [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);
  63. endmodule
  64. module updateX
  65. x : [minX..maxX] ;
  66. [update_x] move=2 & standstill>=8 -> (move'=0);
  67. [update_x] move=2 & standstill<8 & (ski_position=7 | ski_position=8) -> (move'=0);
  68. [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);
  69. [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);
  70. [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);
  71. [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);
  72. [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);
  73. [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);
  74. [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);
  75. [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);
  76. endmodule
  77. rewards
  78. [left] !passed_gate & standstill<2 & Passed_Gate: 100;
  79. [right] !passed_gate & standstill<2 & Passed_Gate: 100;
  80. [noop] !passed_gate & standstill<2 & Passed_Gate: 100;
  81. [left] !done & (Hit_Tree) : -100;
  82. [right] !done & (Hit_Tree) : -100;
  83. [noop] !done & (Hit_Tree) : -100;
  84. [left] !done & (Hit_Gate) : -100;
  85. [right] !done & (Hit_Gate) : -100;
  86. [noop] !done & (Hit_Gate) : -100;
  87. endrewards