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.

142 lines
2.9 KiB

4 years ago
4 years ago
4 years ago
  1. // maze example (POMDP)
  2. // slightly extends that presented in
  3. // Littman, Cassandra and Kaelbling
  4. // Learning policies for partially observable environments: Scaling up
  5. // Technical Report CS, Brown University
  6. // gxn 29/01/16
  7. // state space (value of variable "s")
  8. // 0 1 2 3 4
  9. // 5 6 7
  10. // 8 9 10
  11. // 11 13 12
  12. // 13 is the target
  13. pomdp
  14. // can observe the walls and target
  15. observables
  16. o
  17. endobservables
  18. // o=0 - observation in initial state
  19. // o=1 - west and north walls (s0)
  20. // o=2 - north and south walls (s1 and s3)
  21. // o=3 - north wall (s2)
  22. // o=4 - east and north way (s4)
  23. // o=5 - east and west walls (s5, s6, s7, s8, s9 and s10)
  24. // o=6 - east, west and south walls (s11 and s12)
  25. // o=7 - the target (s13)
  26. const double i;
  27. module maze
  28. s : [-1..13];
  29. o : [0..7];
  30. // initialisation
  31. [] s=-1 -> 1/13 : (s'=0) & (o'=1)
  32. + 1/13 : (s'=1) & (o'=2)
  33. + 1/13 : (s'=2) & (o'=3)
  34. + 1/13 : (s'=3) & (o'=2)
  35. + 1/13 : (s'=4) & (o'=4)
  36. + 1/13 : (s'=5) & (o'=5)
  37. + 1/13 : (s'=6) & (o'=5)
  38. + 1/13 : (s'=7) & (o'=5)
  39. + 1/13 : (s'=8) & (o'=5)
  40. + 1/13 : (s'=9) & (o'=5)
  41. + 1/13 : (s'=10) & (o'=5)
  42. + 1/13 : (s'=11) & (o'=6)
  43. + 1/13 : (s'=12) & (o'=6);
  44. // moving around the maze
  45. [east] s=0 -> (s'=1) & (o'=2);
  46. [west] s=0 -> (s'=0);
  47. [north] s=0 -> (s'=0);
  48. [south] s=0 -> (s'=5) & (o'=5);
  49. [east] s=1 -> (s'=2) & (o'=3);
  50. [west] s=1 -> (s'=0) & (o'=1);
  51. [north] s=1 -> (s'=1);
  52. [south] s=1 -> (s'=1);
  53. [east] s=2 -> (s'=3) & (o'=2);
  54. [west] s=2 -> (s'=1) & (o'=2);
  55. [north] s=2 -> (s'=2);
  56. [south] s=2 -> (s'=6) & (o'=5);
  57. [east] s=3 -> (s'=4) & (o'=4);
  58. [west] s=3 -> (s'=2) & (o'=3);
  59. [north] s=3 -> (s'=3);
  60. [south] s=3 -> (s'=3);
  61. [east] s=4 -> (s'=4);
  62. [west] s=4 -> (s'=3) & (o'=2);
  63. [north] s=4 -> (s'=4);
  64. [south] s=4 -> (s'=7) & (o'=5);
  65. [east] s=5 -> (s'=5);
  66. [west] s=5 -> (s'=5);
  67. [north] s=5 -> (s'=0) & (o'=1);
  68. [south] s=5 -> (s'=8);
  69. [east] s=6 -> (s'=6);
  70. [west] s=6 -> (s'=6);
  71. [north] s=6 -> (s'=2) & (o'=3);
  72. [south] s=6 -> (s'=9);
  73. [east] s=7 -> (s'=7);
  74. [west] s=7 -> (s'=7);
  75. [north] s=7 -> (s'=4) & (o'=4);
  76. [south] s=7 -> (s'=10);
  77. [east] s=8 -> (s'=8);
  78. [west] s=8 -> (s'=8);
  79. [north] s=8 -> (s'=5);
  80. [south] s=8 -> (s'=11) & (o'=6);
  81. [east] s=9 -> (s'=9);
  82. [west] s=9 -> (s'=9);
  83. [north] s=9 -> (s'=6);
  84. [south] s=9 -> i: (s'=13) & (o'=7) + (1-i):(s'=9);
  85. [east] s=10 -> (s'=10);
  86. [west] s=10 -> (s'=10);
  87. [north] s=10 -> (s'=7);
  88. [south] s=10 -> (s'=12) & (o'=6);
  89. [east] s=11 -> (s'=11);
  90. [west] s=11 -> (s'=11);
  91. [north] s=11 -> (s'=8) & (o'=5);
  92. [south] s=11 -> (s'=11);
  93. [east] s=12 -> (s'=12);
  94. [west] s=12 -> (s'=12);
  95. [north] s=12 -> (s'=10) & (o'=5);
  96. [south] s=12 -> (s'=12);
  97. // loop when we reach the target
  98. [done] s=13 -> true;
  99. endmodule
  100. // reward structure (number of steps to reach the target)
  101. rewards
  102. [east] true : 1;
  103. [west] true : 1;
  104. [north] true : 1;
  105. [south] true : 1;
  106. endrewards
  107. // target observation
  108. label "goal" = o=7;
  109. label "bad" = o=6;