Ejemplo n.º 1
0
	def makeTaskSpec(self):
		ts = TaskSpecRLGlue.TaskSpec(discount_factor=libpomdp.getDiscount(), reward_range=libpomdp.getRewardRange())
		ts.addDiscreteAction((0.0, libpomdp.getNumActions()-1))
		ts.addDiscreteObservation((0.0, libpomdp.getNumObservations()-1))
		ts.setContinuing() # The POMDP spec is not set up to have episodes
		ts.setExtra(self.domain_name)
		return ts.toTaskSpec()
Ejemplo n.º 2
0
    def __init__(self,
                 spec_filename=os.path.join(os.path.dirname(__file__),
                                            'configs', 'pomdps',
                                            'tiger.POMDP')):
        """This class loads a POMDP file and runs it as an RL-Glue environment. 

		POMDP files are located in pyrl/environments/configs/pomdps
		This class uses Anthony R. Cassandra's pomdp-solve code for loading pomdp configuration 
		files, ported for use as a python module.
		"""

        if not libpomdp.readMDP(spec_filename):
            print "ERROR: Unable to load POMDP spec file " + spec_filename
            sys.exit(1)
        self.initial_belief = libpomdp.getInitialBelief()
        self.state = None
        self.O = map(
            lambda k: self.buildSparseMatrix(k,
                                             (libpomdp.getNumStates(),
                                              libpomdp.getNumObservations())),
            libpomdp.getSparseObsMatrix())
        self.P = map(
            lambda k: self.buildSparseMatrix(k, (libpomdp.getNumStates(),
                                                 libpomdp.getNumStates())),
            libpomdp.getSparseTransitionMatrix())
        self.domain_name = "POMDP: " + os.path.split(spec_filename)[-1]
Ejemplo n.º 3
0
 def makeTaskSpec(self):
     ts = TaskSpecRLGlue.TaskSpec(discount_factor=libpomdp.getDiscount(),
                                  reward_range=libpomdp.getRewardRange())
     ts.addDiscreteAction((0.0, libpomdp.getNumActions() - 1))
     ts.addDiscreteObservation((0.0, libpomdp.getNumObservations() - 1))
     ts.setContinuing()  # The POMDP spec is not set up to have episodes
     ts.setExtra(self.domain_name)
     return ts.toTaskSpec()
Ejemplo n.º 4
0
	def __init__(self, spec_filename=os.path.join(os.path.dirname(__file__), 
                                                   'configs', 'pomdps', 'tiger.POMDP')):
		"""This class loads a POMDP file and runs it as an RL-Glue environment. 

		POMDP files are located in pyrl/environments/configs/pomdps
		This class uses Anthony R. Cassandra's pomdp-solve code for loading pomdp configuration 
		files, ported for use as a python module.
		"""

		if not libpomdp.readMDP(spec_filename):
			print "ERROR: Unable to load POMDP spec file " + spec_filename
			sys.exit(1)
		self.initial_belief = libpomdp.getInitialBelief()
		self.state = None
		self.O = map(lambda k: self.buildSparseMatrix(k, (libpomdp.getNumStates(),libpomdp.getNumObservations())), libpomdp.getSparseObsMatrix())
		self.P = map(lambda k: self.buildSparseMatrix(k, (libpomdp.getNumStates(), libpomdp.getNumStates())), libpomdp.getSparseTransitionMatrix())
		self.domain_name = "POMDP: " + os.path.split(spec_filename)[-1]