mdp const int initY = 40; const int initX = 80; //const int maxY = 580; //const int maxY = 430; const int maxY = 200; const int minX = 10; const int maxX = 152; const int maxVel = 8; formula Gate_1 = (((42=124 & x<=142) & (y>=190 & y<=200)); formula Tree_2 = ((x>=32 & x<=49) & (y>=284 & y<=295)); formula Tree_3 = ((x>=30 & x<=49) & (y>=317 & y<=327)); formula Tree_4 = ((x>=12 & x<=30) & (y>=408 & y<=418)); formula Tree_5 = ((x>=129 & x<=146) & (y>=468 & y<=480)); formula Tree_6 = ((x>=140 & x<=152) & (y>=496 & y<=510)); formula S_Tree_1 = ((x>=114 & x<=152) & (y>=150 & y<=200)); formula S_Tree_2 = ((x>=22 & x<=59) & (y>=244 & y<=295)); formula S_Tree_3 = ((x>=20 & x<=59) & (y>=277 & y<=327)); formula S_Tree_4 = ((x>=2 & x<=40) & (y>=368 & y<=418)); formula S_Tree_5 = ((x>=119 & x<=156) & (y>=438 & y<=480)); formula S_Tree_6 = ((x>=130 & x<=162) & (y>=456 & y<=510)); formula Hit_Tree = Tree_1 | Tree_2 | Tree_3 | Tree_4 | Tree_5 | Tree_6; formula Hit_Gate = Gate_1 | Gate_2 | Gate_3 | Gate_4 | Gate_5; formula S_Hit_Tree = S_Tree_1 | S_Tree_2 | S_Tree_3 | S_Tree_4 | S_Tree_5 | S_Tree_6; formula S_Hit_Gate = S_Gate_1 | S_Gate_2 | S_Gate_3 | S_Gate_4 | S_Gate_5; label "Hit_Tree" = Hit_Tree; label "Hit_Gate" = Hit_Gate; label "S_Hit_Tree" = S_Hit_Tree; label "S_Hit_Gate" = S_Hit_Gate; global move : [0..3]; module skier ski_position : [1..8] init 4; reward_given: bool init false; //done: bool init false; [left] !reward_given & !Safe_1 & !Unsafe_1 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_1 & !Unsafe_1 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_1 & !Unsafe_1 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_1 | Unsafe_1 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_1 | Unsafe_1 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_1 | Unsafe_1 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); [left] !reward_given & !Safe_2 & !Unsafe_2 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_2 & !Unsafe_2 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_2 & !Unsafe_2 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_2 | Unsafe_2 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_2 | Unsafe_2 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_2 | Unsafe_2 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); [left] !reward_given & !Safe_3 & !Unsafe_3 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_3 & !Unsafe_3 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_3 & !Unsafe_3 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_3 | Unsafe_3 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_3 | Unsafe_3 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_3 | Unsafe_3 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); [left] !reward_given & !Safe_4 & !Unsafe_4 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_4 & !Unsafe_4 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_4 & !Unsafe_4 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_4 | Unsafe_4 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_4 | Unsafe_4 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_4 | Unsafe_4 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); [left] !reward_given & !Safe_5 & !Unsafe_5 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_5 & !Unsafe_5 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_5 & !Unsafe_5 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_5 | Unsafe_5 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_5 | Unsafe_5 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_5 | Unsafe_5 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); [left] !reward_given & !Safe_6 & !Unsafe_6 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_6 & !Unsafe_6 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_6 & !Unsafe_6 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_6 | Unsafe_6 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_6 | Unsafe_6 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_6 | Unsafe_6 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); [left] !reward_given & !Safe_7 & !Unsafe_7 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_7 & !Unsafe_7 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_7 & !Unsafe_7 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_7 | Unsafe_7 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_7 | Unsafe_7 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_7 | Unsafe_7 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); [left] !reward_given & !Safe_8 & !Unsafe_8 & !Hit_Gate & !Hit_Tree & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1); [right] !reward_given & !Safe_8 & !Unsafe_8 & !Hit_Gate & !Hit_Tree & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1); [noop] !reward_given & !Safe_8 & !Unsafe_8 & !Hit_Gate & !Hit_Tree & move=0 -> (move'=1); //[left] !reward_given & (Safe_8 | Unsafe_8 | Hit_Tree | Hit_Gate) & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (reward_given'=true); //[right] !reward_given & (Safe_8 | Unsafe_8 | Hit_Tree | Hit_Gate) & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (reward_given'=true); //[noop] !reward_given & (Safe_8 | Unsafe_8 | Hit_Tree | Hit_Gate) & move=0 -> (move'=1) & (reward_given'=true); //[left] reward_given & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=true); //[right] reward_given & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (done'=true); //[noop] reward_given & move=0 -> (move'=1) & (done'=true); [done] !reward_given & (Hit_Tree | Hit_Gate) & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_1 & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_2 & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_3 & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_4 & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_5 & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_6 & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_7 & move=0 -> (reward_given'=true); [done] !reward_given & Unsafe_8 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_1 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_2 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_3 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_4 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_5 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_6 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_7 & move=0 -> (reward_given'=true); [done] !reward_given & Safe_8 & move=0 -> (reward_given'=true); endmodule module updateY y : [initY..maxY] ; velocity: [0..16]; standstill : [0..8] ; [update_y] move=1 & standstill>=5 -> (y'=y) & (move'=2); [update_y] move=1 & standstill<5 -> (y'=min(maxY,y+velocity)) & (move'=2); [update_y] move=2 & (ski_position=1 | ski_position = 8) & standstill>=5 -> (standstill'=min(8,standstill+1)) & (move'=3); [update_y] move=2 & (ski_position=1 | ski_position = 8) & standstill<5 -> (velocity'=max(0,velocity-4)) &(move'=3); [update_y] move=2 & (ski_position=2 | ski_position = 7) -> (velocity'=max(0 ,velocity-2)) & (standstill'=0) & (move'=3); [update_y] move=2 & (ski_position=3 | ski_position = 6) -> (velocity'=min(maxVel,velocity+2)) & (standstill'=0) & (move'=3); [update_y] move=2 & (ski_position=4 | ski_position = 5) -> (velocity'=min(maxVel,velocity+4)) & (standstill'=0) & (move'=3); endmodule module updateX x : [minX..maxX] init initX; [update_x] move=3 & standstill>=8 -> (move'=0); [update_x] move=3 & standstill<8 & (ski_position=4 | ski_position=5) -> (move'=0); [update_x] move=3 & standstill<8 & (ski_position=3) -> 0.4: (x'=max(minX,x-0)) & (move'=0) + 0.6: (x'=max(minX,x-1)) & (move'=0); [update_x] move=3 & standstill<8 & (ski_position=6) -> 0.4: (x'=min(maxX,x+0)) & (move'=0) + 0.6: (x'=min(maxX,x+1)) & (move'=0); [update_x] move=3 & standstill<8 & (ski_position=2) -> 0.3: (x'=max(minX,x-1)) & (move'=0) + 0.7: (x'=max(minX,x-2)) & (move'=0); [update_x] move=3 & standstill<8 & (ski_position=7) -> 0.3: (x'=min(maxX,x+1)) & (move'=0) + 0.7: (x'=min(maxX,x+2)) & (move'=0); [update_x] move=3 & standstill<8 & (ski_position=1) -> 0.2: (x'=max(minX,x-2)) & (move'=0) + 0.8: (x'=max(minX,x-3)) & (move'=0); [update_x] move=3 & standstill<8 & (ski_position=8) -> 0.2: (x'=min(maxX,x+2)) & (move'=0) + 0.8: (x'=min(maxX,x+3)) & (move'=0); endmodule //rewards // [left] !done & !reward_given & Hit_Tree : -100; // [left] !done & !reward_given & Hit_Gate : -100; // [left] !done & !reward_given & (Unsafe_1 | Unsafe_2 | Unsafe_3 | Unsafe_4 | Unsafe_5 | Unsafe_6 | Unsafe_7 | Unsafe_8) : -100; // [right] !done & !reward_given & Hit_Tree : -100; // [right] !done & !reward_given & Hit_Gate : -100; // [right] !done & !reward_given & (Unsafe_1 | Unsafe_2 | Unsafe_3 | Unsafe_4 | Unsafe_5 | Unsafe_6 | Unsafe_7 | Unsafe_8) : -100; // [noop] !done & !reward_given & Hit_Tree : -100; // [noop] !done & !reward_given & Hit_Gate : -100; // [noop] !done & !reward_given & (Unsafe_1 | Unsafe_2 | Unsafe_3 | Unsafe_4 | Unsafe_5 | Unsafe_6 | Unsafe_7 | Unsafe_8) : -100; //endrewards rewards [done] !reward_given & (Hit_Gate | Hit_Tree | (Unsafe_1 | Unsafe_2 | Unsafe_3 | Unsafe_4 | Unsafe_5 | Unsafe_6 | Unsafe_7 | Unsafe_8)) : -100; endrewards