Advertisement
gbc921

Environment Class

Aug 15th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. #!/usr/bin/python2.7
  2.  
  3. class RoomEnv(Environment):
  4.     # number of action values acceptable by the environment
  5.     # Two events: go forward and go back through the door (but, how we know what room is connect to another?)
  6.     indim = 2
  7.     # Maybe a matrix where 0 is no connection and 1 is a connection(?)
  8.                 #    A,B,C,D,E,F
  9.     #indim = array([[0,0,0,0,0,0],  # A
  10.             [0,0,0,0,0,1],  # B
  11.             [0,0,0,0,0,0],  # C
  12.             [0,0,0,0,0,0],  # D
  13.             [0,0,0,0,0,1],  # E
  14.             [0,0,0,0,0,1],  # F
  15.               ])
  16.  
  17.     # the number of sensors is the number of the rooms
  18.     outdim = 6
  19.  
  20.     def getSensors(self):
  21.         # Initial state:
  22.         return start=array(2,2)
  23.  
  24.     def performAction(self, action):
  25.         # We should look at all the states possible to learn what are the best option to go to the outside state.
  26.         # Maybe a for loop that goes through all the paths and use some weight to know where is the best option?
  27.  
  28.         print "Action performed: ", action
  29.  
  30.     def reset(self):
  31.             """ Most environments will implement this optional method that allows for reinitialization.
  32.             """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement