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.

54 lines
1.6 KiB

  1. smg
  2. player sh
  3. [planA], [planA_Dev], [planB], [planB_Dev]
  4. endplayer
  5. player learned_controller
  6. controller, env
  7. endplayer
  8. global move : [0..2] init 0;
  9. const int lengthA = 10;
  10. const int lengthB = lengthA + 5;
  11. global stepA : [0..lengthA] init 0;
  12. global stepB : [0..lengthB] init 0;
  13. global planA : bool init true;
  14. global shieldPlanA : bool init true;
  15. global stepTaken : bool init false;
  16. global waiting : bool init false;
  17. const int waiting_cost = 2;
  18. const double blockedProb = 0.5;
  19. module controller
  20. [] move=0 & shieldPlanA & stepA<lengthA -> (planA'=true) & (stepTaken'=false) & (waiting'=false) & (move'=1);
  21. [] move=0 & shieldPlanA & stepA<lengthA -> (planA'=false) & (stepTaken'=false) & (waiting'=false) & (move'=1);
  22. [] move=0 & !shieldPlanA & stepB<lengthB -> (planA'=false) & (stepTaken'=false) & (waiting'=false) & (move'=1);
  23. endmodule
  24. module shield
  25. [planA] move=1 & planA -> (shieldPlanA'=true) & (move'=2);
  26. [planB_Dev] move=1 & planA -> (shieldPlanA'=false) & (move'=2);
  27. [planB] move=1 & !planA -> (shieldPlanA'=false) & (move'=2);
  28. [planA_Dev] move=1 & !planA -> (shieldPlanA'=true) & (move'=2);
  29. endmodule
  30. module env
  31. [] move=2 & shieldPlanA& stepA<lengthA -> 1 - blockedProb : (stepA'=min(stepA+1, lengthA)) & (stepTaken'=true) & (move'=0) + blockedProb : (stepA'=stepA) & (waiting'=true) & (move'=0);
  32. [] move=2 & !shieldPlanA & stepB<lengthB -> (stepB'=min(stepB+1, lengthB)) & (stepTaken'=true) & (move'=0);
  33. [] move=2 & (lengthB=stepB | lengthA=stepA) -> (stepTaken'=false) & (waiting'=false);
  34. endmodule
  35. rewards "travel_costs"
  36. stepTaken : 1;
  37. waiting : waiting_cost;
  38. endrewards