POMDPPlanners.tests package
Subpackages
- POMDPPlanners.tests.benchmarks package
- POMDPPlanners.tests.test_configs package
- Submodules
- POMDPPlanners.tests.test_configs.test_environment_configs module
TestEnvironmentConfigsTestEnvironmentConfigs.setup_method()TestEnvironmentConfigs.test_all_configs_have_consistent_interface()TestEnvironmentConfigs.test_cartpole_pomdp_config()TestEnvironmentConfigs.test_config_api_initialization()TestEnvironmentConfigs.test_continuous_light_dark_continuous_actions_config()TestEnvironmentConfigs.test_continuous_light_dark_discrete_actions_config()TestEnvironmentConfigs.test_get_compatible_environments_continuous_continuous()TestEnvironmentConfigs.test_get_compatible_environments_discrete_continuous()TestEnvironmentConfigs.test_get_compatible_environments_discrete_discrete()TestEnvironmentConfigs.test_get_compatible_environments_empty_result()TestEnvironmentConfigs.test_get_compatible_environments_returns_proper_beliefs()TestEnvironmentConfigs.test_get_compatible_environments_verifies_compatibility_logic()TestEnvironmentConfigs.test_laser_tag_pomdp_config()TestEnvironmentConfigs.test_mountain_car_pomdp_config()TestEnvironmentConfigs.test_pacman_pomdp_config()TestEnvironmentConfigs.test_push_pomdp_config()TestEnvironmentConfigs.test_risk_averse_config_api_initialization()TestEnvironmentConfigs.test_risk_averse_light_dark_continuous_actions_config()TestEnvironmentConfigs.test_risk_averse_light_dark_discrete_actions_config()TestEnvironmentConfigs.test_risk_averse_push_pomdp_config()TestEnvironmentConfigs.test_risk_averse_rock_sample_pomdp_config()TestEnvironmentConfigs.test_rock_sample_pomdp_config()TestEnvironmentConfigs.test_safety_ant_velocity_pomdp_config()TestEnvironmentConfigs.test_tiger_pomdp_config()
main()
- POMDPPlanners.tests.test_configs.test_experiment_configs module
- POMDPPlanners.tests.test_configs.test_planners_hyperparam_configs module
- POMDPPlanners.tests.test_core package
- Subpackages
- POMDPPlanners.tests.test_core.test_belief package
- Submodules
- POMDPPlanners.tests.test_core.test_belief.belief_equivalence_utils module
- POMDPPlanners.tests.test_core.test_belief.test_base module
- POMDPPlanners.tests.test_core.test_belief.test_belief_environment_integration module
- POMDPPlanners.tests.test_core.test_belief.test_belief_utils module
- POMDPPlanners.tests.test_core.test_belief.test_gaussian_belief module
- POMDPPlanners.tests.test_core.test_belief.test_gaussian_belief_updaters module
- POMDPPlanners.tests.test_core.test_belief.test_gaussian_mixture_belief module
- POMDPPlanners.tests.test_core.test_belief.test_particle_beliefs module
- POMDPPlanners.tests.test_core.test_belief.test_vectorized_weighted_particle_belief module
- POMDPPlanners.tests.test_core.test_belief.vectorized_updater_test_utils module
- POMDPPlanners.tests.test_core.test_belief package
- Submodules
- POMDPPlanners.tests.test_core.test_cost module
- POMDPPlanners.tests.test_core.test_distributions module
- POMDPPlanners.tests.test_core.test_environment module
- POMDPPlanners.tests.test_core.test_hyper_parameter_tuning module
TestCategoricalHyperParameterIdUniquenessTestCategoricalHyperParameterIdUniqueness.test_complex_choices_produce_unique_ids()TestCategoricalHyperParameterIdUniqueness.test_different_choices_produce_different_ids()TestCategoricalHyperParameterIdUniqueness.test_different_names_produce_different_ids()TestCategoricalHyperParameterIdUniqueness.test_different_order_choices_produce_different_ids()TestCategoricalHyperParameterIdUniqueness.test_empty_choices_produce_unique_ids()TestCategoricalHyperParameterIdUniqueness.test_same_parameters_produce_same_ids()
TestHyperParamPlannerConfigIdUniquenessTestHyperParamPlannerConfigIdUniqueness.test_different_constant_parameters_produce_different_ids()TestHyperParamPlannerConfigIdUniqueness.test_different_hyper_parameter_order_produces_same_id()TestHyperParamPlannerConfigIdUniqueness.test_different_hyper_parameters_produce_different_ids()TestHyperParamPlannerConfigIdUniqueness.test_different_policy_classes_produce_different_ids()TestHyperParamPlannerConfigIdUniqueness.test_same_configs_produce_same_ids()
TestHyperParamPlannerConfigValidationTestHyperParamPlannerConfigValidation.test_invalid_constant_parameter_name_raises_value_error()TestHyperParamPlannerConfigValidation.test_invalid_constant_parameters_type_raises_type_error()TestHyperParamPlannerConfigValidation.test_invalid_hyper_parameter_element_type_raises_type_error()TestHyperParamPlannerConfigValidation.test_invalid_hyper_parameters_type_raises_type_error()TestHyperParamPlannerConfigValidation.test_invalid_hyperparameter_name_raises_value_error()TestHyperParamPlannerConfigValidation.test_invalid_policy_cls_type_raises_type_error()TestHyperParamPlannerConfigValidation.test_valid_config_with_all_parameters_succeeds()
TestHyperParameterRunParamsIdUniquenessTestHyperParameterRunParamsIdUniqueness.test_config_id_consistency()TestHyperParameterRunParamsIdUniqueness.test_config_id_property_exists()TestHyperParameterRunParamsIdUniqueness.test_different_numeric_parameters_produce_different_ids()TestHyperParameterRunParamsIdUniqueness.test_different_parameters_to_optimize_produce_different_ids()
TestIdConsistencyTestNumericalHyperParameterIdUniquenessTestNumericalHyperParameterIdUniqueness.test_different_high_values_produce_different_ids()TestNumericalHyperParameterIdUniqueness.test_different_low_values_produce_different_ids()TestNumericalHyperParameterIdUniqueness.test_different_names_produce_different_ids()TestNumericalHyperParameterIdUniqueness.test_different_numeric_types_produce_different_ids()TestNumericalHyperParameterIdUniqueness.test_same_parameters_produce_same_ids()
TestOptimizedPolicyResultValidationTestOptimizedPolicyResultValidation.test_empty_chosen_hyper_parameters_raises_value_error()TestOptimizedPolicyResultValidation.test_empty_parameters_to_optimize_raises_value_error()TestOptimizedPolicyResultValidation.test_extra_metric_in_optimized_metric_values_raises_value_error()TestOptimizedPolicyResultValidation.test_frozen_dataclass_is_immutable()TestOptimizedPolicyResultValidation.test_invalid_chosen_hyper_parameters_type_raises_type_error()TestOptimizedPolicyResultValidation.test_invalid_direction_type_in_parameters_to_optimize_raises_type_error()TestOptimizedPolicyResultValidation.test_invalid_environment_type_raises_type_error()TestOptimizedPolicyResultValidation.test_invalid_metric_name_raises_value_error()TestOptimizedPolicyResultValidation.test_invalid_metric_name_type_in_parameters_to_optimize_raises_type_error()TestOptimizedPolicyResultValidation.test_invalid_optimized_metric_values_type_raises_type_error()TestOptimizedPolicyResultValidation.test_invalid_parameter_to_optimize_tuple_type_raises_type_error()TestOptimizedPolicyResultValidation.test_invalid_parameters_to_optimize_type_raises_type_error()TestOptimizedPolicyResultValidation.test_invalid_policy_type_raises_type_error()TestOptimizedPolicyResultValidation.test_missing_metric_in_optimized_metric_values_raises_value_error()TestOptimizedPolicyResultValidation.test_multiple_metrics_validation_succeeds()TestOptimizedPolicyResultValidation.test_negative_num_episodes_raises_value_error()TestOptimizedPolicyResultValidation.test_negative_num_steps_raises_value_error()TestOptimizedPolicyResultValidation.test_none_metric_values_are_allowed()TestOptimizedPolicyResultValidation.test_valid_optimized_policy_result_succeeds()TestOptimizedPolicyResultValidation.test_zero_num_episodes_raises_value_error()TestOptimizedPolicyResultValidation.test_zero_num_steps_raises_value_error()
TestParallelizationLevelEnum
- POMDPPlanners.tests.test_core.test_policy module
- POMDPPlanners.tests.test_core.test_serialization module
- POMDPPlanners.tests.test_core.test_simulation module
- POMDPPlanners.tests.test_core.test_simulation_configs module
- POMDPPlanners.tests.test_core.test_tree module
- POMDPPlanners.tests.test_core.test_visualizers module
- Subpackages
- POMDPPlanners.tests.test_environments package
- Subpackages
- POMDPPlanners.tests.test_environments.test_laser_tag_pomdp package
- Subpackages
- Submodules
- POMDPPlanners.tests.test_environments.test_laser_tag_pomdp.test_continuous_laser_tag_geometry module
- POMDPPlanners.tests.test_environments.test_laser_tag_pomdp.test_continuous_laser_tag_pomdp module
- POMDPPlanners.tests.test_environments.test_laser_tag_pomdp.test_continuous_laser_tag_visualizer module
- POMDPPlanners.tests.test_environments.test_laser_tag_pomdp.test_laser_tag_pomdp module
- POMDPPlanners.tests.test_environments.test_laser_tag_pomdp.test_laser_tag_visualizer module
- POMDPPlanners.tests.test_environments.test_light_dark_pomdp package
- POMDPPlanners.tests.test_environments.test_pacman_pomdp_beliefs package
- Submodules
- POMDPPlanners.tests.test_environments.test_pacman_pomdp_beliefs.benchmark_pacman_vectorized_belief module
- POMDPPlanners.tests.test_environments.test_pacman_pomdp_beliefs.test_pacman_belief_factory module
- POMDPPlanners.tests.test_environments.test_pacman_pomdp_beliefs.test_pacman_belief_integration module
- POMDPPlanners.tests.test_environments.test_pacman_pomdp_beliefs.test_pacman_grid_utils module
- POMDPPlanners.tests.test_environments.test_pacman_pomdp_beliefs.test_pacman_vectorized_updater module
- POMDPPlanners.tests.test_environments.test_push_pomdp package
- POMDPPlanners.tests.test_environments.test_rock_sample_pomdp package
- Submodules
- POMDPPlanners.tests.test_environments.test_rock_sample_pomdp.benchmark_rocksample_vectorized_belief module
- POMDPPlanners.tests.test_environments.test_rock_sample_pomdp.test_rock_sample_pomdp module
- POMDPPlanners.tests.test_environments.test_rock_sample_pomdp.test_rock_sample_visualizer module
- POMDPPlanners.tests.test_environments.test_rock_sample_pomdp.test_rocksample_belief_factory module
- POMDPPlanners.tests.test_environments.test_rock_sample_pomdp.test_rocksample_belief_integration module
- POMDPPlanners.tests.test_environments.test_rock_sample_pomdp.test_rocksample_vectorized_updater module
- POMDPPlanners.tests.test_environments.test_safety_ant_velocity_pomdp package
- POMDPPlanners.tests.test_environments.test_laser_tag_pomdp package
- Submodules
- POMDPPlanners.tests.test_environments.test_cartpole_pomdp module
- POMDPPlanners.tests.test_environments.test_cartpole_pomdp_belief_factory module
- POMDPPlanners.tests.test_environments.test_cartpole_pomdp_beliefs module
- POMDPPlanners.tests.test_environments.test_cartpole_pomdp_gaussian_beliefs module
- POMDPPlanners.tests.test_environments.test_environment_serialization module
- POMDPPlanners.tests.test_environments.test_environment_visualizations_golden_files module
- POMDPPlanners.tests.test_environments.test_mountain_car_pomdp module
- POMDPPlanners.tests.test_environments.test_mountain_car_pomdp_belief_factory module
- POMDPPlanners.tests.test_environments.test_mountain_car_pomdp_beliefs module
- POMDPPlanners.tests.test_environments.test_mountain_car_pomdp_gaussian_beliefs module
- POMDPPlanners.tests.test_environments.test_pacman_pomdp module
- POMDPPlanners.tests.test_environments.test_sanity_pomdp module
- POMDPPlanners.tests.test_environments.test_tiger_pomdp module
- Subpackages
- POMDPPlanners.tests.test_examples package
- POMDPPlanners.tests.test_interfaces package
- POMDPPlanners.tests.test_planners package
- Subpackages
- POMDPPlanners.tests.test_planners.test_mcts_planners package
- Subpackages
- Submodules
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_icvar_pft_dpw module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_icvar_pomcpow module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_path_simulation_policy module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_pft_dpw module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_pomcp module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_pomcp_dpw module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_pomcpow module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_sparse_pft module
- POMDPPlanners.tests.test_planners.test_mcts_planners.test_utils module
- POMDPPlanners.tests.test_planners.test_open_loop_planners package
- POMDPPlanners.tests.test_planners.test_planners_utils package
- POMDPPlanners.tests.test_planners.test_sparse_sampling_planners package
- POMDPPlanners.tests.test_planners.test_mcts_planners package
- Submodules
- POMDPPlanners.tests.test_planners.test_planner_save_load_interface module
- POMDPPlanners.tests.test_planners.test_planner_serialization module
- Subpackages
- POMDPPlanners.tests.test_simulations package
- Subpackages
- POMDPPlanners.tests.test_simulations.test_simulations_apis package
- Submodules
- POMDPPlanners.tests.test_simulations.test_simulations_apis.api_test_fixtures module
- POMDPPlanners.tests.test_simulations.test_simulations_apis.api_test_mixins module
- POMDPPlanners.tests.test_simulations.test_simulations_apis.test_dask_simulations_api module
- POMDPPlanners.tests.test_simulations.test_simulations_apis.test_local_simulations_api module
- POMDPPlanners.tests.test_simulations.test_simulations_apis.test_pbs_simulations_api module
- POMDPPlanners.tests.test_simulations.test_simulations_deployment package
- POMDPPlanners.tests.test_simulations.test_workflows package
- POMDPPlanners.tests.test_simulations.test_simulations_apis package
- Submodules
- POMDPPlanners.tests.test_simulations.conftest module
- POMDPPlanners.tests.test_simulations.test_episode_returns_visualizer module
- POMDPPlanners.tests.test_simulations.test_hyper_parameter_tuning_simulations module
- POMDPPlanners.tests.test_simulations.test_simulation_statistics module
- POMDPPlanners.tests.test_simulations.test_simulator module
- POMDPPlanners.tests.test_simulations.test_simulator_serialization module
- Subpackages
- POMDPPlanners.tests.test_training package
- POMDPPlanners.tests.test_utils package
- Subpackages
- POMDPPlanners.tests.test_utils.test_visualization package
- Submodules
- POMDPPlanners.tests.test_utils.test_visualization.test_metrics_plots module
- POMDPPlanners.tests.test_utils.test_visualization.test_policy_simulation_plots module
- POMDPPlanners.tests.test_utils.test_visualization.test_returns_plots module
- POMDPPlanners.tests.test_utils.test_visualization.test_tree_plots module
- POMDPPlanners.tests.test_utils.test_visualization package
- Submodules
- POMDPPlanners.tests.test_utils.confidence_interval_utils module
- POMDPPlanners.tests.test_utils.history_builders module
- POMDPPlanners.tests.test_utils.test_action_samplers module
- POMDPPlanners.tests.test_utils.test_belief_factory module
- POMDPPlanners.tests.test_utils.test_confidence_interval_utils module
- POMDPPlanners.tests.test_utils.test_config_loader module
- POMDPPlanners.tests.test_utils.test_config_to_id module
TestConfigToIdTestConfigToId.test_deterministic_hashing()TestConfigToId.test_empty_dict_handling()TestConfigToId.test_hash_collision_resistance()TestConfigToId.test_key_order_independence()TestConfigToId.test_mixed_data_types()TestConfigToId.test_nested_dict_handling()TestConfigToId.test_numpy_array_handling()TestConfigToId.test_numpy_scalar_handling()TestConfigToId.test_simple_dict_hashing()
TestConfigToIdIntegrationTestConfigToIdIntegration.test_cartpole_environment_config_id_consistency()TestConfigToIdIntegration.test_cartpole_environment_different_configs_produce_different_ids()TestConfigToIdIntegration.test_complex_pomdp_configuration_with_numpy_arrays()TestConfigToIdIntegration.test_config_to_id_order_invariance_with_pomdp_objects()TestConfigToIdIntegration.test_config_to_id_with_objects_having_config_id_attribute()TestConfigToIdIntegration.test_pomcp_planner_config_id_consistency()TestConfigToIdIntegration.test_weighted_particle_belief_config_id_consistency()TestConfigToIdIntegration.test_weighted_particle_belief_different_configs_produce_different_ids()
TestNumpyEncoderTestNumpyEncoder.test_config_id_object_encoding()TestNumpyEncoder.test_getstate_exception_fallback()TestNumpyEncoder.test_getstate_object_encoding()TestNumpyEncoder.test_numpy_array_encoding()TestNumpyEncoder.test_numpy_scalar_encoding()TestNumpyEncoder.test_object_without_config_id_uses_getstate()TestNumpyEncoder.test_unsupported_type_fallback()
- POMDPPlanners.tests.test_utils.test_hyperparameter_tuning_and_eval module
- POMDPPlanners.tests.test_utils.test_logger module
test_cleanup_task_logger_failure_flushes_logs()test_cleanup_task_logger_success_discards_logs()test_conditional_memory_handler_buffering()test_conditional_memory_handler_flush_on_error()test_conditional_memory_handler_manual_flush()test_flush_buffered_task_logs_flushes_handlers()test_logger_console_output_false()test_logger_console_output_true()test_logger_file_output()test_logger_no_duplicate_handlers()test_logger_no_handlers_no_io()test_logger_no_multiple_files_on_repeated_calls()test_logger_reuses_handlers_with_same_name()test_queue_logger_backwards_compatibility()test_queue_logger_basic_functionality()test_queue_logger_cleanup()test_queue_logger_diagnostics()test_queue_logger_handler_management()test_queue_logger_individual_task_files()test_setup_task_logger_with_buffering_adds_memory_handlers()test_setup_task_logger_with_buffering_creates_logger()test_setup_task_logger_with_buffering_reuses_existing()test_task_logger_manager_state_tracking()test_task_logger_manager_thread_safety()
- POMDPPlanners.tests.test_utils.test_memory_tracker module
- POMDPPlanners.tests.test_utils.test_multivariate_normal module
- POMDPPlanners.tests.test_utils.test_planner_episode_visualization module
- POMDPPlanners.tests.test_utils.test_probability_utils module
- POMDPPlanners.tests.test_utils.test_simulations_caching module
- POMDPPlanners.tests.test_utils.test_statistics_utils module
- POMDPPlanners.tests.test_utils.test_tree_statistics module
- POMDPPlanners.tests.test_utils.test_weighted_particle_belief module
- Subpackages
Submodules
POMDPPlanners.tests.conftest module
POMDPPlanners.tests.test_metric_consistency module
POMDPPlanners.tests.test_metric_consistency_utils module
Reusable test utilities for verifying metric name consistency.
This module provides generic test functions to verify that the metric names declared by environments and policies match the actual metrics they produce.
- POMDPPlanners.tests.test_metric_consistency_utils.verify_environment_metric_consistency(environment, histories)[source]
Verify that environment’s declared metric names match actual produced metrics.
This function checks that: 1. get_metric_names() returns the exact set of metric names 2. compute_metrics() produces MetricValue objects with those exact names 3. No extra or missing metrics
- Parameters:
environment (
Environment) – Environment instance to testhistories (
List[History]) – List of episode histories to pass to compute_metrics()
- Raises:
AssertionError – If declared and actual metric names don’t match
- Return type:
Example
>>> from POMDPPlanners.environments.tiger_pomdp import TigerPOMDP >>> from POMDPPlanners.simulations.episodes import run_episode >>> from POMDPPlanners.core.belief import get_initial_belief >>> from POMDPPlanners.planners.mcts_planners.pomcp import POMCP >>> from POMDPPlanners.utils.logger import get_logger >>> >>> # Set up environment and run episodes >>> env = TigerPOMDP(discount_factor=0.95) >>> policy = POMCP(environment=env, discount_factor=0.95, depth=5, ... exploration_constant=1.0, name="test", n_simulations=10) >>> belief = get_initial_belief(env, n_particles=10) >>> logger = get_logger("test", debug=False) >>> history = run_episode(env, policy, belief, num_steps=3, logger=logger) >>> >>> # Verify consistency >>> verify_environment_metric_consistency(env, [history]) # Should pass without error
- POMDPPlanners.tests.test_metric_consistency_utils.verify_policy_class_metric_consistency(policy_class, policy_instance, belief)[source]
Verify policy class and instance metric consistency.
This is a convenience wrapper around verify_policy_metric_consistency() that also checks the policy class directly.
- Parameters:
- Raises:
AssertionError – If declared and actual info variable names don’t match
- Return type:
Example
>>> from POMDPPlanners.environments.tiger_pomdp import TigerPOMDP >>> from POMDPPlanners.planners.mcts_planners.pomcp import POMCP >>> from POMDPPlanners.core.belief import get_initial_belief >>> >>> env = TigerPOMDP(discount_factor=0.95) >>> policy = POMCP(environment=env, discount_factor=0.95, depth=5, ... exploration_constant=1.0, name="test", n_simulations=10) >>> belief = get_initial_belief(env, n_particles=10) >>> >>> verify_policy_class_metric_consistency(POMCP, policy, belief)
- POMDPPlanners.tests.test_metric_consistency_utils.verify_policy_metric_consistency(policy, belief)[source]
Verify that policy’s declared info variable names match actual produced names.
This function checks that: 1. get_info_variable_names() returns the exact set of info variable names 2. action() produces PolicyInfoVariable objects with those exact names 3. No extra or missing info variables
- Parameters:
- Raises:
AssertionError – If declared and actual info variable names don’t match
- Return type:
Example
>>> from POMDPPlanners.environments.tiger_pomdp import TigerPOMDP >>> from POMDPPlanners.planners.mcts_planners.pomcp import POMCP >>> from POMDPPlanners.core.belief import get_initial_belief >>> >>> # Set up policy >>> env = TigerPOMDP(discount_factor=0.95) >>> policy = POMCP(environment=env, discount_factor=0.95, depth=5, ... exploration_constant=1.0, name="test", n_simulations=10) >>> belief = get_initial_belief(env, n_particles=10) >>> >>> # Verify consistency >>> verify_policy_metric_consistency(policy, belief) # Should pass without error
POMDPPlanners.tests.test_setup module
Tests to verify package installation and basic functionality.
- POMDPPlanners.tests.test_setup.test_imports()[source]
Test that key package modules can be imported.
Purpose: Validates that all main POMDPPlanners modules can be successfully imported without errors
Given: POMDPPlanners package with core, planners, environments, utils, and simulations submodules When: Each main module is imported using importlib.import_module Then: All imports succeed without ImportError exceptions
Test type: unit
- POMDPPlanners.tests.test_setup.test_package_installed()[source]
Test that the package is installed and importable.
Purpose: Validates that POMDPPlanners package is properly installed and accessible with correct version
Given: POMDPPlanners package should be installed in the Python environment with version 0.2.0 When: Package is imported and version is checked Then: Import succeeds without error and version matches expected 0.2.0
Test type: unit
- POMDPPlanners.tests.test_setup.test_required_packages()[source]
Test that all required packages are installed with correct versions.
Purpose: Validates that all dependencies declared in pyproject.toml are properly installed with compatible versions
Given: POMDPPlanners package installed with dependencies declared in pyproject.toml When: Each required package is checked against installed packages using importlib.metadata Then: All requirements are satisfied without PackageNotFoundError or version conflicts
Test type: unit