def test_to_n_dimensional(): N = state_by_node.shape[-1] S = state_by_node.shape[0] result = convert.to_n_dimensional(state_by_node) for i in range(S): state = convert.loli_index2state(i, N) assert np.array_equal(result[state], state_by_node[i])
def test_state_by_state2state_by_node(): result = convert.state_by_state2state_by_node(state_by_state) expected = convert.to_n_dimensional(state_by_node) print("Result:") print(result) print("Expected:") print(expected) assert np.array_equal(result, expected)
def test_nondet_state_by_state2state_by_node(): # Test for nondeterministic TPM. result = convert.state_by_state2state_by_node(state_by_state_nondet) expected = convert.to_n_dimensional(state_by_node_nondet) print("Result:") print(result) print("Expected:") print(expected) assert np.array_equal(result, expected)
def test_n_d_state_by_node2state_by_state(): # Check with N-D form. sbn = convert.to_n_dimensional(state_by_node) result = convert.state_by_node2state_by_state(sbn) expected = state_by_state print("Result:") print(result) print("Expected:") print(expected) assert np.array_equal(result, expected)