コード例 #1
0
    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()
コード例 #2
0
ファイル: test_graphs.py プロジェクト: dsacc/pygsp
 def test_LowStretchTree():
     G = graphs.LowStretchTree()
コード例 #3
0
ファイル: test_graphs.py プロジェクト: andromeda0505/pygsp
 def test_lowstretchtree(self):
     graphs.LowStretchTree()
コード例 #4
0
ファイル: test_plotting.py プロジェクト: dsacc/pygsp
 def test_LowStretchTree():
     G = graphs.LowStretchTree()
     needed_attributes_testing(G)