Package teamwork :: Package test :: Package policy :: Module testPWLTable :: Class TestPWLTable
[hide private]
[frames] | no frames]

Class TestPWLTable

source code

       object --+    
                |    
unittest.TestCase --+
                    |
                   TestPWLTable

Nested Classes [hide private]

Inherited from unittest.TestCase: failureException

Instance Methods [hide private]
KeyedVector
generateVector(self, dimension=2, probability=False)
Returns: a random vector
source code
PWLTable
generateLHS(self, attributes=2, dimension=2)
Generates an initialized table with random LHS conditions, but no RHS
source code
 
generateRHS(self, table, actions=2, dimension=2, matrix=False, probability=False, rules=None)
Fills in random RHS value function for the given table
source code
 
testAddAttribute(self) source code
 
testMax(self) source code

Inherited from unittest.TestCase: __call__, __init__, __repr__, __str__, assertAlmostEqual, assertAlmostEquals, assertEqual, assertEquals, assertFalse, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertRaises, assertTrue, assert_, countTestCases, debug, defaultTestResult, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, setUp, shortDescription, tearDown

Inherited from unittest.TestCase (private): _exc_info

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

generateVector(self, dimension=2, probability=False)

source code 
Parameters:
  • dimension (int) - the size of the vector (default is 2)
  • probability (bool) - if True, then make sure vector values are nonneagtive and sum to 1. (default is False)
Returns: KeyedVector
a random vector

generateLHS(self, attributes=2, dimension=2)

source code 

Generates an initialized table with random LHS conditions, but no RHS

Parameters:
  • attributes (int) - the number of LHS attributes (default is 3)
  • dimension (int) - the size of the vector (default is 2)
Returns: PWLTable
a table with random LHS attributes

generateRHS(self, table, actions=2, dimension=2, matrix=False, probability=False, rules=None)

source code 

Fills in random RHS value function for the given table

Parameters:
  • table (PWLTable) - initialized table
  • actions (int) - the number of actions to define value function over (default is 3)
  • dimension (int) - dimension of arrays in RHS values (default is 2)
  • matrix (bool) - if True, use matrices in RHS; otherwise, use vectors (default is False, i.e., vectors)
  • probability (bool) - if True, then make sure vector values are nonneagtive and sum to 1. (default is False)
  • rules (int) - the maximum number of rules to generate (default is as many as supported by LHS combinations)

Warning: the table is modified in place

testMax(self)

source code 

Note: tests star method as well