コード例 #1
0
ファイル: synth_test.py プロジェクト: ericskim/tulip-control
def test_env_fts_int_actions():
    """Env FTS actions must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.actions_must='mutex'
    env.actions.add('stop')
    
    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        bool_states=False,
        action_vars=('eact', 'act'),
        bool_actions=False
    )
    
    assert('park' not in spec.env_vars)
    assert('go' not in spec.env_vars)
    assert('stop' not in spec.env_vars)
    
    assert('sys_actions' not in spec.env_vars)
    assert('env_actions' in spec.env_vars)    
    
    print spec.env_vars['env_actions']
    assert(set(spec.env_vars['env_actions']) ==
           {'park', 'go', 'stop', 'env_actionsnone'})
コード例 #2
0
ファイル: synth_test.py プロジェクト: necozay/tulip-control
def test_env_ofts_int_actions():
    """Env OpenFTS actions must become 1 int var in GR(1)."""
    env = env_ofts_int_actions()
    env.sys_actions_must = 'mutex'
    spec = synth.env_to_spec(env,
                             ignore_initial=False,
                             statevar='eloc',
                             bool_actions=False)
    _check_ofts_int_actions(spec)
コード例 #3
0
def test_env_ofts_int_actions():
    """Env OpenFTS actions must become 1 int var in GR(1)."""
    env = env_ofts_int_actions()
    env.sys_actions_must = 'mutex'
    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        statevar='eloc',
        bool_actions=False)
    _check_ofts_int_actions(spec)
コード例 #4
0
def test_env_ofts_int_actions():
    """Env OpenFTS actions must become 1 int var in GR(1)."""
    env = env_ofts_int_actions()
    env.sys_actions_must = 'mutex'
    # there exists an env deadend, hence the warning
    with pytest.warns(UserWarning):
        spec = synth.env_to_spec(
            env,
            ignore_initial=False,
            statevar='eloc',
            bool_actions=False)
    _check_ofts_int_actions(spec)
コード例 #5
0
ファイル: synth_test.py プロジェクト: necozay/tulip-control
def test_env_ofts_bool_actions():
    """Env OpenFTS has 2 actions, bools requested.
    """
    env = env_ofts_int_actions()
    env.env_actions_must = 'mutex'
    env.env_actions.remove('stop')
    env.sys_actions.remove('hover')

    spec = synth.env_to_spec(env,
                             ignore_initial=False,
                             statevar='eloc',
                             bool_actions=True)

    _check_ofts_bool_actions(spec)
コード例 #6
0
def test_env_ofts_bool_actions():
    """Env OpenFTS has 2 actions, bools requested.
    """
    env = env_ofts_int_actions()
    env.env_actions_must = 'mutex'
    env.env_actions.remove('stop')
    env.sys_actions.remove('hover')
    # there exists an env deadend, hence the warning
    with pytest.warns(UserWarning):
        spec = synth.env_to_spec(
            env,
            ignore_initial=False,
            statevar='eloc',
            bool_actions=True)
    _check_ofts_bool_actions(spec)
コード例 #7
0
ファイル: synth_test.py プロジェクト: ericskim/tulip-control
def test_env_ofts_int_actions():
    """Env OpenFTS actions must become 1 int var in GR(1).
    """
    env = env_ofts_int_actions()
    env.actions_must='mutex'
    
    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        bool_states=False,
        action_vars=('eact', 'act'),
        bool_actions=False
    )
    
    _check_ofts_int_actions(spec)
コード例 #8
0
def test_env_ofts_bool_actions():
    """Env OpenFTS has 2 actions, bools requested.
    """
    env = env_ofts_int_actions()
    env.env_actions_must = 'mutex'
    env.env_actions.remove('stop')
    env.sys_actions.remove('hover')

    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        statevar='eloc',
        bool_actions=True
    )

    _check_ofts_bool_actions(spec)
コード例 #9
0
def test_env_fts_bool_actions():
    """Env FTS has 2 actions, bools requested."""
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'
    # there exists an env deadend, hence the warning
    with pytest.warns(UserWarning):
        spec = synth.env_to_spec(
            env,
            ignore_initial=False,
            statevar='eloc',
            bool_actions=True)
    assert 'sys_actions' not in spec.env_vars
    assert 'env_actions' not in spec.env_vars

    assert 'park' in spec.env_vars
    assert spec.env_vars['park'] == 'boolean'

    assert 'go' in spec.env_vars
    assert spec.env_vars['go'] == 'boolean'
コード例 #10
0
ファイル: synth_test.py プロジェクト: necozay/tulip-control
def test_env_fts_int_states():
    """Env FTS has 3 states, must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'
    env.states.add('e2')

    spec = synth.env_to_spec(env,
                             ignore_initial=False,
                             statevar='eloc',
                             bool_actions=False)

    assert 'e0' not in spec.env_vars
    assert 'e1' not in spec.env_vars
    assert 'e2' not in spec.env_vars

    assert 'loc' not in spec.env_vars
    assert 'eloc' in spec.env_vars
    print(spec.env_vars['eloc'])
    assert sorted(spec.env_vars['eloc']) == ['e0', 'e1', 'e2']
コード例 #11
0
def test_env_fts_bool_actions():
    """Env FTS has 2 actions, bools requested."""
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'

    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        statevar='eloc',
        bool_actions=True,
    )

    assert 'sys_actions' not in spec.env_vars
    assert 'env_actions' not in spec.env_vars

    assert 'park' in spec.env_vars
    assert spec.env_vars['park'] == 'boolean'

    assert 'go' in spec.env_vars
    assert spec.env_vars['go'] == 'boolean'
コード例 #12
0
def test_env_fts_int_states():
    """Env FTS has 3 states, must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'
    env.states.add('e2')
    # there exists an env deadend, hence the warning
    with pytest.warns(UserWarning):
        spec = synth.env_to_spec(
            env,
            ignore_initial=False,
            statevar='eloc',
            bool_actions=False)
    assert 'e0' not in spec.env_vars
    assert 'e1' not in spec.env_vars
    assert 'e2' not in spec.env_vars

    assert 'loc' not in spec.env_vars
    assert 'eloc' in spec.env_vars
    print(spec.env_vars['eloc'])
    assert sorted(spec.env_vars['eloc']) == ['e0', 'e1', 'e2']
コード例 #13
0
ファイル: synth_test.py プロジェクト: ericskim/tulip-control
def test_env_fts_bool_actions():
    """Env FTS has 2 actions, bools requested.
    """
    env = env_fts_2_states()
    env.actions_must='mutex'
    
    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        bool_states=False,
        action_vars=('eact', 'act'),
        bool_actions=True,
    )
    
    assert('sys_actions' not in spec.env_vars)
    assert('env_actions' not in spec.env_vars)
    
    assert('park' in spec.env_vars)
    assert(spec.env_vars['park'] == 'boolean')
    
    assert('go' in spec.env_vars)
    assert(spec.env_vars['go'] == 'boolean')
コード例 #14
0
ファイル: synth_test.py プロジェクト: ericskim/tulip-control
def test_env_fts_int_states():
    """Env FTS has 3 states, must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.actions_must='mutex'
    env.states.add('e2')
    
    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        bool_states=False,
        action_vars=('eact', 'act'),
        bool_actions=False
    )
    
    assert('e0' not in spec.env_vars)
    assert('e1' not in spec.env_vars)
    assert('e2' not in spec.env_vars)
    
    assert('loc' not in spec.env_vars)
    assert('eloc' in spec.env_vars)
    assert(spec.env_vars['eloc'] == (0, 2))
コード例 #15
0
ファイル: synth_test.py プロジェクト: ericskim/tulip-control
def test_env_fts_bool_states():
    """Env FTS has 2 states, must become 2 bool vars in GR(1).
    """
    env = env_fts_2_states()
    env.actions_must = 'mutex'
    
    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        bool_states=False,
        action_vars=('eact', 'act'),
        bool_actions=False
    )
    
    assert('loc' not in spec.env_vars)
    assert('eloc' not in spec.env_vars)
    
    assert('e0' in spec.env_vars)
    assert(spec.env_vars['e0'] == 'boolean')
    
    assert('e1' in spec.env_vars)
    assert(spec.env_vars['e1'] == 'boolean')
コード例 #16
0
def test_env_fts_int_states():
    """Env FTS has 3 states, must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'
    env.states.add('e2')

    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        statevar='eloc',
        bool_actions=False
    )

    assert 'e0' not in spec.env_vars
    assert 'e1' not in spec.env_vars
    assert 'e2' not in spec.env_vars

    assert 'loc' not in spec.env_vars
    assert 'eloc' in spec.env_vars
    print(spec.env_vars['eloc'])
    assert sorted(spec.env_vars['eloc']) == ['e0', 'e1', 'e2']
コード例 #17
0
def test_env_fts_int_actions():
    """Env FTS actions must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'
    env.env_actions.add('stop')
    # there exists an env deadend, hence the warning
    with pytest.warns(UserWarning):
        spec = synth.env_to_spec(
            env,
            ignore_initial=False,
            statevar='eloc',
            bool_actions=False)
    assert 'park' not in spec.env_vars
    assert 'go' not in spec.env_vars
    assert 'stop' not in spec.env_vars

    assert 'sys_actions' not in spec.env_vars
    assert 'env_actions' in spec.env_vars

    print(spec.env_vars['env_actions'])
    assert (set(spec.env_vars['env_actions']) ==
            {'park', 'go', 'stop', 'env_actionsnone'})
コード例 #18
0
ファイル: synth_test.py プロジェクト: necozay/tulip-control
def test_env_fts_int_actions():
    """Env FTS actions must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'
    env.env_actions.add('stop')

    spec = synth.env_to_spec(env,
                             ignore_initial=False,
                             statevar='eloc',
                             bool_actions=False)

    assert 'park' not in spec.env_vars
    assert 'go' not in spec.env_vars
    assert 'stop' not in spec.env_vars

    assert 'sys_actions' not in spec.env_vars
    assert 'env_actions' in spec.env_vars

    print spec.env_vars['env_actions']
    assert (set(spec.env_vars['env_actions']) == {
        'park', 'go', 'stop', 'env_actionsnone'
    })
コード例 #19
0
ファイル: synth_test.py プロジェクト: johnyf/tulip-control
def test_env_fts_int_actions():
    """Env FTS actions must become 1 int var in GR(1).
    """
    env = env_fts_2_states()
    env.env_actions_must = 'mutex'
    env.env_actions.add('stop')

    spec = synth.env_to_spec(
        env,
        ignore_initial=False,
        statevar='eloc',
        bool_actions=False
    )

    assert 'park' not in spec.env_vars
    assert 'go' not in spec.env_vars
    assert 'stop' not in spec.env_vars

    assert 'sys_actions' not in spec.env_vars
    assert 'env_actions' in spec.env_vars

    print(spec.env_vars['env_actions'])
    assert (set(spec.env_vars['env_actions']) ==
            {'park', 'go', 'stop', 'env_actionsnone'})