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.

73 lines
2.2 KiB

  1. // GRID WORLD MODEL OF A SEMIAUTONOMOUS EXPLORING ROBOT
  2. // Sebastian Junges, RWTH Aachen University
  3. // As described in
  4. // Junges, Jansen, Dehnert, Topcu, Katoen:
  5. // Safety Constrained Reinforcement Learning
  6. // Proc. of TACAS16
  7. mdp
  8. //PARAMETERS
  9. //The difference of the reliability of the channels between the worst and at the best position
  10. const double pLDiff;//=0.1;
  11. const double pHDiff;//=0.1;
  12. //Scaling factor for the minimum reliability of the channels
  13. const double pL;//=8/9;
  14. const double pH;//=1;
  15. //CONSTANTS
  16. //The minimum reliablities
  17. const double pLMin=pL*(1-pLDiff);
  18. const double pHMin=pH*(1-pHDiff);
  19. // Grid size
  20. const int Xsize = 6;
  21. const int Ysize = 6;
  22. // Number of tries before an error
  23. const int MAXTRIES = 2;
  24. // Ball within the robot has to move.
  25. const int B=2;
  26. formula T = (xLoc = Xsize & yLoc = Ysize);
  27. module robot
  28. xLoc : [1..Ysize] init 1;
  29. yLoc : [1..Xsize] init 1;
  30. unreported : [0..B] init 0;
  31. hasSendNow : bool init false;
  32. tries : [0..MAXTRIES] init 0;
  33. [up] xLoc < Xsize & !T & hasSendNow -> 1:(xLoc'=xLoc+1) & (unreported' = 0) & (hasSendNow'=false);
  34. [up] xLoc < Xsize & !T & !hasSendNow -> 1:(xLoc'=xLoc+1) & (unreported'=min(unreported+1, B));
  35. [right] yLoc < Ysize & !T & hasSendNow -> 1:(yLoc'=yLoc+1) & (unreported' = 0)& (hasSendNow'=false);
  36. [right] yLoc < Ysize & !T & !hasSendNow -> 1:(yLoc'=yLoc+1) & (unreported'=min(unreported+1,B));
  37. [sendL] !hasSendNow & !T & tries < MAXTRIES -> (pLMin + pLDiff * xLoc/Xsize):(hasSendNow'=true) & (tries'=0) + (1 - pLMin - pLDiff * xLoc/Xsize): (tries'=tries+1);
  38. [sendH] !hasSendNow & !T & tries < MAXTRIES -> (pHMin + pHDiff * yLoc/Ysize):(hasSendNow'=true) & (tries'=0) + (1 - pHMin - pHDiff * yLoc/Ysize): (tries'=tries+1);
  39. [done] T -> 1:true;
  40. endmodule
  41. rewards "sendbased"
  42. [up] true: 0.03;
  43. [right] true: 0.03;
  44. [sendL] true: max(10, min(11 + xLoc - yLoc, 20));
  45. [sendH] true: min(13 + xLoc + yLoc, 24);
  46. endrewards
  47. rewards "sendbased_lower"
  48. [up] true: 0.03;
  49. [right] true: 0.03;
  50. [sendL] true: 10;
  51. [sendH] true: 12;
  52. endrewards
  53. rewards "sendbased_upper"
  54. [up] true: 0.03;
  55. [right] true: 0.03;
  56. [sendL] true: 20;
  57. [sendH] true: 24;
  58. endrewards
  59. label "Target" = T;
  60. label "Crash" = unreported=B;