The source code and dockerfile for the GSW2024 AI Lab.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

139 lines
3.6 KiB

4 weeks 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 ways (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 sl;
  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 -> (1-sl):(s'=1) & (o'=2) + sl:(s'=s) & (o'=o);
  46. [west] s=0 -> (s'=0);
  47. [north] s=0 -> (s'=0);
  48. [south] s=0 -> (1-sl):(s'=5) & (o'=5) + sl:(s'=s) & (o'=o);
  49. [east] s=1 -> (1-sl):(s'=2) & (o'=3) + sl:(s'=s) & (o'=o);
  50. [west] s=1 -> (1-sl):(s'=0) & (o'=1) + sl:(s'=s) & (o'=o);
  51. [north] s=1 -> (s'=1);
  52. [south] s=1 -> (s'=1);
  53. [east] s=2 -> (1-sl):(s'=3) & (o'=2) + sl:(s'=s) & (o'=o);
  54. [west] s=2 -> (1-sl):(s'=1) & (o'=2) + sl:(s'=s) & (o'=o);
  55. [north] s=2 -> (s'=2);
  56. [south] s=2 -> (1-sl):(s'=6) & (o'=5) + sl:(s'=s) & (o'=o);
  57. [east] s=3 -> (1-sl):(s'=4) & (o'=4) + sl:(s'=s) & (o'=o);
  58. [west] s=3 -> (1-sl):(s'=2) & (o'=3) + sl:(s'=s) & (o'=o);
  59. [north] s=3 -> (s'=3);
  60. [south] s=3 -> (s'=3);
  61. [east] s=4 -> (s'=4);
  62. [west] s=4 -> (1-sl):(s'=3) & (o'=2) + sl:(s'=s) & (o'=o);
  63. [north] s=4 -> (s'=4);
  64. [south] s=4 -> (1-sl):(s'=7) & (o'=5) + sl:(s'=s) & (o'=o);
  65. [east] s=5 -> (s'=5);
  66. [west] s=5 -> (s'=5);
  67. [north] s=5 -> (1-sl):(s'=0) & (o'=1) + sl:(s'=s) & (o'=o);
  68. [south] s=5 -> (1-sl):(s'=8) + sl:(s'=s) & (o'=o);
  69. [east] s=6 -> (s'=6);
  70. [west] s=6 -> (s'=6);
  71. [north] s=6 -> (1-sl):(s'=2) & (o'=3) + sl:(s'=s) & (o'=o);
  72. [south] s=6 -> (1-sl):(s'=9) + sl:(s'=s) & (o'=o);
  73. [east] s=7 -> (s'=7);
  74. [west] s=7 -> (s'=7);
  75. [north] s=7 -> (1-sl):(s'=4) & (o'=4) + sl:(s'=s) & (o'=o);
  76. [south] s=7 -> (1-sl):(s'=10) + sl:(s'=s) & (o'=o);
  77. [east] s=8 -> (s'=8);
  78. [west] s=8 -> (s'=8);
  79. [north] s=8 -> (1-sl):(s'=5) + sl:(s'=s) & (o'=o);
  80. [south] s=8 -> (1-sl):(s'=11) & (o'=6) + sl:(s'=s) & (o'=o);
  81. [east] s=9 -> (s'=9);
  82. [west] s=9 -> (s'=9);
  83. [north] s=9 -> (1-sl):(s'=6) + sl:(s'=s) & (o'=o);
  84. [south] s=9 -> (1-sl):(s'=13) & (o'=7) + sl:(s'=s) & (o'=o);
  85. [east] s=10 -> (s'=10);
  86. [west] s=10 -> (s'=10);
  87. [north] s=10 -> (1-sl):(s'=7) + sl:(s'=s) & (o'=o);
  88. [south] s=10 -> (1-sl):(s'=12) & (o'=6) + sl:(s'=s) & (o'=o);
  89. [east] s=11 -> (s'=11);
  90. [west] s=11 -> (s'=11);
  91. [north] s=11 -> (1-sl):(s'=8) & (o'=5) + sl:(s'=s) & (o'=o);
  92. [south] s=11 -> (s'=11);
  93. [east] s=12 -> (s'=12);
  94. [west] s=12 -> (s'=12);
  95. [north] s=12 -> (1-sl):(s'=10) & (o'=5) + sl:(s'=s) & (o'=o);
  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)/7
  101. rewards
  102. [east] true : 1/7;
  103. [west] true : 1/7;
  104. [north] true : 1/7;
  105. [south] true : 1/7;
  106. endrewards
  107. // target observation
  108. label "goal" = o=7;
  109. label "bad" = o=6;