Example #1
0
 def setUp(self):
     self.R = np.asarray([[1.0, 0.4, -0.4], [0.4, 1.0, 0.6],
                          [-0.4, 0.6, 1.0]])
     self.mu = [100.0] * 3
     self.sigma = [10.0] * 3
     self.cov = gen.cor2cov(self.R, self.sigma)
     self.maze = gen.make_multimaze(4, 4, 3)
     self.goals = gen.maze_goal_states(self.maze, 3, self.mu, self.cov)
Example #2
0
 def setUp(self):
     self.R = np.asarray([[ 1.0,  0.4, -0.4],
                          [ 0.4,  1.0,  0.6],
                          [-0.4,  0.6,  1.0]])
     self.mu = [100.0] * 3
     self.sigma = [10.0] * 3
     self.cov = gen.cor2cov(self.R, self.sigma)
     self.maze = gen.make_multimaze(4, 4, 3)
     self.goals = gen.maze_goal_states(self.maze, 3, self.mu, self.cov)
Example #3
0
 def test_invalidR(self):
     numStates = 1000
     numActions = 10
     mu = [0.0] * 3
     sigma = [1.0] * 3
     R = np.asarray([[1.0, -0.7, 0.8], [-0.7, 1.0, 0.9], [0.8, 0.9, 1.0]])
     cov = gen.cor2cov(R, sigma)
     self.assertRaises(sla.LinAlgError, gen.mvnrewards, numStates,
                       numActions, mu, R)
Example #4
0
 def test_rewards2(self):
     numStates = 5000
     numActions = 20
     mu = [10, 10, 10]
     sigma = [1, 1, 1]
     R = np.asarray([[1.0, -0.7, -0.5], [-0.7, 1.0, 0.8], [-0.5, 0.8, 1.0]])
     cov = gen.cor2cov(R, sigma)
     D = gen.mvnrewards(numStates, numActions, mu, cov)
     self.checkCorrelations(R, D)
Example #5
0
 def test_rewards1(self):
     numStates = 1000
     numActions = 5
     mu = [20, 0, 50]
     sigma = [5, 5, 10]
     R = np.asarray([[1.0, 0.4, -0.4], [0.4, 1.0, 0.6], [-0.4, 0.6, 1.0]])
     cov = gen.cor2cov(R, sigma)
     D = gen.mvnrewards(numStates, numActions, mu, cov)
     self.checkCorrelations(R, D)
Example #6
0
 def test_invalidR(self):
     numStates = 1000
     numActions = 10
     mu = [0.0] * 3
     sigma = [1.0] * 3 
     R = np.asarray([[ 1.0, -0.7,  0.8],
                     [-0.7,  1.0,  0.9],
                     [ 0.8,  0.9,  1.0]])
     cov = gen.cor2cov(R, sigma)
     self.assertRaises(sla.LinAlgError, gen.mvnrewards, numStates, numActions, mu, R)
Example #7
0
 def test_rewards3(self):
     numStates = 200
     numActions = 8
     mu = [0, -10, 30, 0]
     sigma = [5, 0.5, 10, 2.0]
     R = np.asarray([[1.0, 0.2, -0.5, 0.0], [0.2, 1.0, 0.4, 0.0],
                     [-0.5, 0.4, 1.0, 0.6], [0.0, 0.0, 0.6, 1.0]])
     cov = gen.cor2cov(R, sigma)
     D = gen.mvnrewards(numStates, numActions, mu, cov)
     self.checkCorrelations(R, D)
Example #8
0
 def test_rewards2(self):
     numStates = 5000
     numActions = 20
     mu = [10, 10, 10]
     sigma = [1, 1, 1]
     R = np.asarray([[ 1.0, -0.7, -0.5],
                     [-0.7,  1.0,  0.8],
                     [-0.5,  0.8,  1.0]])
     cov = gen.cor2cov(R, sigma)
     D = gen.mvnrewards(numStates, numActions, mu, cov)
     self.checkCorrelations(R, D)
Example #9
0
 def test_rewards1(self):
     numStates = 1000
     numActions = 5
     mu = [20, 0, 50]
     sigma = [5, 5, 10]
     R = np.asarray([[ 1.0,  0.4, -0.4],
                     [ 0.4,  1.0,  0.6],
                     [-0.4,  0.6,  1.0]])
     cov = gen.cor2cov(R, sigma)
     D = gen.mvnrewards(numStates, numActions, mu, cov)
     self.checkCorrelations(R, D)
Example #10
0
 def test_rewards3(self):
     numStates = 200
     numActions = 8
     mu = [0, -10, 30, 0]
     sigma = [5, 0.5, 10, 2.0]
     R = np.asarray([[ 1.0,  0.2, -0.5,  0.0],
                     [ 0.2,  1.0,  0.4,  0.0],
                     [-0.5,  0.4,  1.0,  0.6],
                     [ 0.0,  0.0,  0.6,  1.0]])
     cov = gen.cor2cov(R, sigma)
     D = gen.mvnrewards(numStates, numActions, mu, cov)
     self.checkCorrelations(R, D)