Exemplo n.º 1
0
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])
Exemplo n.º 2
0
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])
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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)