utils.py 900 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 14:44:07 2013

@author: steve
"""

import numpy as np
import scipy as sp

import mdptoolbox.example

13 14 15
class BaseTestMDP(object):
    small_P, small_R = mdptoolbox.example.small()

16 17 18 19 20
STATES = 10
ACTIONS = 3
SMALLNUM = 10e-12

# np.arrays
21
P_small, R_small = mdptoolbox.example.small()
22 23

P_sparse = np.empty(2, dtype=object)
24 25
P_sparse[0] = sp.sparse.csr_matrix(P_small[0])
P_sparse[1] = sp.sparse.csr_matrix(P_small[1])
26 27 28

P_forest, R_forest = mdptoolbox.example.forest()

29 30 31 32
P_forest_sparse, R_forest_sparse = mdptoolbox.example.forest(S=STATES,
                                                             is_sparse=True)

np.random.seed(0)
33 34
P_rand, R_rand = mdptoolbox.example.rand(STATES, ACTIONS)

35 36 37
np.random.seed(0)
P_rand_sparse, R_rand_sparse = mdptoolbox.example.rand(STATES, ACTIONS,
                                                       is_sparse=True)