|
|
|
|
|
|
@pytest.mark.parametrize( |
|
|
|
"behavior_spec", |
|
|
|
[ |
|
|
|
BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_CONTINUOUS), |
|
|
|
BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_TWODISCRETE), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_CONTINUOUS |
|
|
|
), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_TWODISCRETE |
|
|
|
), |
|
|
|
], |
|
|
|
) |
|
|
|
def test_construction(behavior_spec: BehaviorSpec) -> None: |
|
|
|
|
|
|
@pytest.mark.parametrize( |
|
|
|
"behavior_spec", |
|
|
|
[ |
|
|
|
BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_CONTINUOUS), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_CONTINUOUS |
|
|
|
), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,), (64, 66, 3), (84, 86, 1)]), |
|
|
|
ACTIONSPEC_CONTINUOUS, |
|
|
|
|
|
|
ACTIONSPEC_TWODISCRETE, |
|
|
|
), |
|
|
|
BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_DISCRETE), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_DISCRETE |
|
|
|
), |
|
|
|
], |
|
|
|
) |
|
|
|
def test_factory(behavior_spec: BehaviorSpec) -> None: |
|
|
|
|
|
|
create_observation_specs_with_shapes([(10,), (64, 66, 3), (24, 26, 1)]), |
|
|
|
ACTIONSPEC_CONTINUOUS, |
|
|
|
), |
|
|
|
BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_TWODISCRETE), |
|
|
|
BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_DISCRETE), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_TWODISCRETE |
|
|
|
), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_DISCRETE |
|
|
|
), |
|
|
|
], |
|
|
|
) |
|
|
|
def test_reward_decreases(behavior_spec: BehaviorSpec, seed: int) -> None: |
|
|
|
|
|
|
@pytest.mark.parametrize("seed", SEED) |
|
|
|
@pytest.mark.parametrize( |
|
|
|
"behavior_spec", |
|
|
|
[BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_CONTINUOUS)], |
|
|
|
[ |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_CONTINUOUS |
|
|
|
) |
|
|
|
], |
|
|
|
) |
|
|
|
def test_continuous_action_prediction(behavior_spec: BehaviorSpec, seed: int) -> None: |
|
|
|
np.random.seed(seed) |
|
|
|
|
|
|
create_observation_specs_with_shapes([(10,), (64, 66, 3), (24, 26, 1)]), |
|
|
|
ACTIONSPEC_CONTINUOUS, |
|
|
|
), |
|
|
|
BehaviorSpec(create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_TWODISCRETE), |
|
|
|
BehaviorSpec(create_observation_spec_with_shapes([(10,)]), ACTIONSPEC_DISCRETE), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_TWODISCRETE |
|
|
|
), |
|
|
|
BehaviorSpec( |
|
|
|
create_observation_specs_with_shapes([(10,)]), ACTIONSPEC_DISCRETE |
|
|
|
), |
|
|
|
], |
|
|
|
) |
|
|
|
def test_next_state_prediction(behavior_spec: BehaviorSpec, seed: int) -> None: |
|
|
|