def __init__(self, rewards_locations, obstacles_location, initial_state=None, obstacles_transition_probability=.2, success_probability=.9): if obstacles_transition_probability < 0 or obstacles_transition_probability > 1: raise ValueError( 'obstacles_transition_probability must be in range [0, 1]') self.num_states = 64 self.reward_location = rewards_locations self.initial_state = initial_state self.transition_probabilities = np.ones( self.num_states) * success_probability self.transition_probabilities[ obstacles_location] = obstacles_transition_probability self.graph = graphs.LowStretchTree(k=3) self.weighted_graph = graphs.LowStretchTree(k=3) for obstacle in obstacles_location: self.weighted_graph.W[ obstacle, :] *= obstacles_transition_probability self.weighted_graph.W[:, obstacle] *= obstacles_transition_probability self.weighted_graph.Ne = sparse.tril(self.weighted_graph.W).nnz self._state = self._init_random_state()
def test_LowStretchTree(): G = graphs.LowStretchTree()
def test_lowstretchtree(self): graphs.LowStretchTree()
def test_LowStretchTree(): G = graphs.LowStretchTree() needed_attributes_testing(G)