Library/Interface
This section details the interface and functions provided by POMDPStressTesting.jl.
Contents
Index
POMDPStressTesting.ASTPOMDPStressTesting.AST.BlackBoxPOMDPStressTesting.AST.GrayBoxPOMDPStressTesting.POMDPStressTestingPOMDPStressTesting.AST.ASTActionPOMDPStressTesting.AST.ASTMDPPOMDPStressTesting.AST.ASTMetricsPOMDPStressTesting.AST.ASTParamsPOMDPStressTesting.AST.ASTSampleActionPOMDPStressTesting.AST.ASTSeedActionPOMDPStressTesting.AST.ASTStatePOMDPStressTesting.AST.GrayBox.EnvironmentPOMDPStressTesting.AST.GrayBox.EnvironmentSamplePOMDPStressTesting.AST.GrayBox.SamplePOMDPStressTesting.AST.GrayBox.SimulationPOMDPStressTesting.AST.BlackBox.distancePOMDPStressTesting.AST.BlackBox.evaluate!POMDPStressTesting.AST.BlackBox.initialize!POMDPStressTesting.AST.BlackBox.iseventPOMDPStressTesting.AST.BlackBox.isterminalPOMDPStressTesting.AST.GrayBox.environmentPOMDPStressTesting.AST.GrayBox.transition!POMDPStressTesting.AST.action_q_tracePOMDPStressTesting.AST.action_tracePOMDPStressTesting.AST.get_top_pathPOMDPStressTesting.AST.go_to_statePOMDPStressTesting.AST.online_pathPOMDPStressTesting.AST.playbackPOMDPStressTesting.AST.q_tracePOMDPStressTesting.AST.random_actionPOMDPStressTesting.AST.recordPOMDPStressTesting.AST.record_tracePOMDPStressTesting.AST.reset_metrics!POMDPStressTesting.AST.rolloutPOMDPStressTesting.AST.rollout_endPOMDPStressTesting.AST.search!POMDPStressTesting.AST.state_tracePOMDPStressTesting.distribution_figuresPOMDPStressTesting.episodic_figuresPOMDPStressTesting.print_metricsPOMDPStressTesting.visualizePOMDPs.actionPOMDPs.convert_sPOMDPs.discountPOMDPs.genPOMDPs.initialstatePOMDPs.isterminalPOMDPs.reward
Modules
POMDPStressTesting.POMDPStressTesting — ModuleAdaptive Stress Testing for the POMDPs.jl ecosystem.
POMDPStressTesting.AST — ModuleProvides implementation of Adaptive Stress Testing (AST) formulation of MDPs/POMDPs.
POMDPStressTesting.AST.GrayBox — ModuleProvides virtual interface for the gray-box environment and simulator.
POMDPStressTesting.AST.BlackBox — ModuleProvides virtual interface for the black-box system under test (SUT).
GrayBox
POMDPStressTesting.AST.GrayBox.Simulation — TypeGrayBox.SimulationAbstract base type for a gray-box simulation.
POMDPStressTesting.AST.GrayBox.Sample — TypeGrayBox.SampleHolds sampled value and log-probability.
POMDPStressTesting.AST.GrayBox.Environment — TypeGrayBox.EnvironmentAlias type for a dictionary of gray-box environment distributions.
e.g., `Environment(:variable_name => Sampleable)`POMDPStressTesting.AST.GrayBox.EnvironmentSample — TypeGrayBox.EnvironmentSampleAlias type for a single environment sample.
e.g., `EnvironmentSample(:variable_name => Sample(value, logprob))`POMDPStressTesting.AST.GrayBox.environment — Functionenvironment(sim::GrayBox.Simulation)Return all distributions used in the simulation environment.
POMDPStressTesting.AST.GrayBox.transition! — Functiontransition!(sim::Union{GrayBox.Simulation, GrayBox.Simulation})::RealGiven an input sample::EnvironmentSample, apply transition and return the transition log-probability.
transition!(sim::GrayBox.Simulation)::RealApply a transition step, and return the transition log-probability (used with ASTSeedAction).
BlackBox
POMDPStressTesting.AST.BlackBox.initialize! — Functioninitialize!(sim::GrayBox.Simulation)Reset state to its initial state.
POMDPStressTesting.AST.BlackBox.evaluate! — Functionevaluate!(sim::GrayBox.Simulation)::Tuple{logprob::Real, miss_distance::Real, isevent::Bool}
evaluate!(sim::GrayBox.Simulation, sample::GrayBox.EnvironmentSample)::Tuple{logprob::Real, miss_distance::Real, isevent::Bool}Evaluate the SUT given some input seed and current state, returns logprob, miss_distance, and isevent indication. If the sample version is implemented, then ASTSampleAction will be used instead of ASTSeedAction.
POMDPStressTesting.AST.BlackBox.distance — Functiondistance(sim::GrayBox.Simulation)::RealReturn how close to an event a terminal state was (i.e. some measure of "miss distance" to the event of interest).
POMDPStressTesting.AST.BlackBox.isevent — Functionisevent(sim::GrayBox.Simulation)::BoolReturn a boolean indicating if the SUT reached a failure event of interest.
POMDPStressTesting.AST.BlackBox.isterminal — Functionisterminal(sim::GrayBox.Simulation)::BoolReturn an indication that the simulation is in a terminal state.
AST
POMDPStressTesting.AST.search! — Functionsearch!(planner)Search for failures given a planner. Implemented by each solver.
POMDPs.initialstate — FunctionInitialize AST MDP state. Overridden from POMDPs.initialstate interface.
POMDPs.reward — Functionreward(mdp::ASTMDP, logprob::Real, isevent::Bool, isterminal::Bool, miss_distance::Real)::Float64Reward function for the AST formulation. Defaults to:
R_E if isterminal and isevent (1)
-d if isterminal and !isevent (2)
log(p) otherwise (3)
1) Terminates with event, collect reward_bonus (defaults to 0)
2) Terminates without event, collect negative miss distance
3) Each non-terminal step, accumulate reward correlated with the transition probabilityFor epsidic reward problems (i.e. rewards only at the end of an episode), set mdp.params.episodic_rewards to get:
(log(p) - d)*R_E if isterminal and isevent (1)
log(p) - d if isterminal and !isevent (2)
0 otherwise (3)
1) Terminates with event, collect transition probability and miss distance with multiplicative reward bonus
2) Terminates without event, collect transitions probability and miss distance
3) Each non-terminal step, no intermediate reward (set `mdp.params.give_intermediate_reward` to use log transition probability)POMDPs.gen — FunctionGenerate next state and reward for AST MDP (handles episodic reward problems). Overridden from POMDPs.gen interface.
POMDPs.isterminal — FunctionDetermine if AST MDP is in a terminal state. Overridden from POMDPs.isterminal interface.
POMDPs.discount — FunctionAST problems are (generally) undiscounted to treat future reward equally. Overridden from POMDPs.discount interface.
POMDPStressTesting.AST.random_action — FunctionRandomly select next action, independent of the state.
POMDPs.action — FunctionRandomly select next action, independent of the state. Overridden from POMDPs.action interface.
Missing docstring for actions. Check Documenter's build log for details.
POMDPs.convert_s — FunctionUsed by the CommonRLInterface to interact with deep RL solvers.
POMDPStressTesting.AST.go_to_state — FunctionReset AST simulation to a given state; used by the MCTS DPWSolver as the reset_callback function.
POMDPStressTesting.AST.record — FunctionAST.record(::ASTMDP, sym::Symbol, val)Recard an ASTMetric specified by sym.
POMDPStressTesting.AST.record_trace — FunctionRecord the best paths from termination leaf node.
POMDPStressTesting.AST.get_top_path — FunctionGet k-th top path from the recorded top_paths.
POMDPStressTesting.AST.rollout — FunctionRollout simulation for MCTS; used by the MCTS DPWSolver as the estimate_value function. Custom rollout records action trace once the depth has been reached.
POMDPStressTesting.AST.rollout_end — FunctionRollout to only execute SUT at end (p accounts for probabilities generated outside the rollout)
User defined:
feed_gen Function to feed best action, replaces call to gen when feeding
feed_type Indicate when to feed best action. Either at the start of the rollout :start, or mid-rollout :mid
best_callback Callback function to record best miss distance or reward for later feeding during rollout
POMDPStressTesting.AST.playback — FunctionPlay back a given action trace from the initialstate of the MDP.
POMDPStressTesting.AST.online_path — FunctionFollow MCTS optimal path online calling action after each selected state.
POMDPStressTesting.AST.state_trace — FunctionTrace up the tree to get all ancestor states.
POMDPStressTesting.AST.action_trace — FunctionTrace up the tree to get all ancestor actions.
POMDPStressTesting.AST.q_trace — FunctionTrace up the tree and accumulate Q-values.
POMDPStressTesting.AST.action_q_trace — FunctionTrace up the tree to get all ancestor actions and summed Q-values.
POMDPStressTesting.AST.reset_metrics! — FunctionClear data stored in mdp.metrics.
AST Types
POMDPStressTesting.AST.ASTParams — TypeAST.ASTParamsAdaptive Stress Testing specific simulation parameters.
POMDPStressTesting.AST.ASTAction — TypeAbstract type for the AST action variants.
POMDPStressTesting.AST.ASTSeedAction — TypeAST.ASTSeedActionRandom seed AST action.
POMDPStressTesting.AST.ASTSampleAction — TypeAST.ASTSampleActionRandom environment sample as the AST action.
POMDPStressTesting.AST.ASTState — TypeAST.ASTStateState of the AST MDP.
POMDPStressTesting.AST.ASTMetrics — TypeAST.ASTMetricsDebugging metrics.
POMDPStressTesting.AST.ASTMDP — TypeAST.ASTMDPAdaptive Stress Testing MDP problem formulation object.
Metrics
POMDPStressTesting.print_metrics — Functionprint_metrics(planner)
print_metrics(mdp::ASTMDP)
print_metrics(metrics::ASTMetrics)Print failure metrics including:
- iteration of first failure
- number of failures
- failure rate
- highest log-likelihood of failure
Visualizations/Figures
POMDPStressTesting.visualize — FunctionVisualize MCTS tree structure for AST MDP.
POMDPStressTesting.episodic_figures — FunctionStacked figure with metrics over episodes:
- Running miss distance mean
- Minimum miss distance
- Cumulative number of failure eventsPOMDPStressTesting.distribution_figures — FunctionStacked figure with distributions:
- Miss distance distribution
- Log-likelihood distribution