AdaStress.AdaStress
— ModuleAdaptive stress testing (AST) package. Finds and analyzes likeliest failures for a simulated system under test. See documentation for usage.
AdaStress.clean
— Methodclean()
Forcibly remove temporary environment, purging all enabled submodules. Only necessary if submodule manager is corrupted and disable
cannot restore functionality. Takes effect after Julia restart.
AdaStress.disable
— Methoddisable(submodule)
Disable submodule(s). Accepts string or vector of strings. With zero arguments defaults to all enabled submodules. Takes effect after Julia restart.
AdaStress.enable
— Methodenable(submodule)
Enable submodule(s). Accepts string or vector of strings. With zero arguments defaults to all associated submodules. Takes effect immediately.
AdaStress.enabled
— Methodenabled()
List enabled submodules.
AdaStress.exclude
— Methodexclude(dir::String)
Associate package directory to main package via submodule table instead of direct code loading. Equivalent of include
for submodules / optional dependencies.
AdaStress.init_submodules
— MethodInvoke any submodule-related initializations. Called by top-level __init__
function.
AdaStress.load
— Methodload()
Load enabled submodules (necessary after Julia restart). Takes effect immediately.
AdaStress.submodules
— Methodsubmodules()
List all available submodules.
AdaStress.unregistered_deps
— MethodList unregistered dependencies of submodule.
AdaStress.@verboseif
— MacroSuppresses output if verbosity condition is not met.
AdaStress.Interface
— ModuleInterface between custom simulation and AST framework. Supports various levels of observability and access.
AdaStress.Interface.ASTClient
— TypeASTClient
Solver-side client. Interacts with server via TCP.
AdaStress.Interface.ASTMDP
— TypeStandard MDP object for AST. Wraps simulation and contains auxiliary information and parameters.
AdaStress.Interface.ASTMDP
— MethodASTMDP(sim::AbstractSimulation; kwargs...)
Constructor for ASTMDP object. Infers various properties of MDP. Allows kwargs to be specified flatly and automatically assigns to correct level.
AdaStress.Interface.ASTServer
— TypeASTServer
Simulation-side server. Interacts with client via TCP.
AdaStress.Interface.ASTServer
— MethodASTServer(mdp::ASTMDP; kwargs...)
Constructor for server.
AdaStress.Interface.ASTServerError
— TypeException type for server-side error. Allows exceptions to propogate to client to avoid hanging connection.
AdaStress.Interface.AbstractASTMDP
— TypeAbstract AST MDP type.
AdaStress.Interface.AbstractCoreObjective
— TypeAST core objective function abstract type. Defines fundamental reward function by combining log probability, event bonus, and distance heuristic. Additional contributions to the reward should be added by implementing reward
function in GrayBox or BlackBox interface.
AdaStress.Interface.AbstractDistanceHeuristic
— TypeDistance heuristic abstract type. Custom heuristics inherit this type and implement reset!
and apply!
functions. Application can return scalar value or partially-applied function transforming f(s,s') to f(s)(s').
AdaStress.Interface.AbstractReward
— TypeAbstract AST reward structure.
AdaStress.Interface.AbstractSimulation
— TypeInternal abstract type.
AdaStress.Interface.Action
— TypeAbstract type for AST action.
AdaStress.Interface.BlackBox
— TypeBlackBox <: AbstractSimulation
Parent type for user simulation in which environment is not exposed.
AdaStress.Interface.Environment
— TypeSet of environment variables and their distributions.
AdaStress.Interface.EnvironmentInfo
— TypeProperties of environment variables.
AdaStress.Interface.EnvironmentValue
— TypeSamples from environment.
AdaStress.Interface.FinalHeuristic
— TypeFinal distance encountered. If MDP is episodic, this is equal to the minimum distance (determined retroactively instead of accumulated as in MinimumHeuristic).
AdaStress.Interface.Flat
— TypeEnvironment that will be flattened upon sampling.
AdaStress.Interface.Functoid
— TypeConditional function. Applies function if applicable, otherwise returns value. Useful for conditional partial function application.
AdaStress.Interface.GradientHeuristic
— TypeGradient of conservative potential. Default and recommended.
AdaStress.Interface.GrayBox
— TypeGrayBox <: AbstractSimulation
Parent type for user simulation in which environment is exposed.
AdaStress.Interface.MinimumHeuristic
— TypeMinimum distance across episode. Warning: non-Markovian.
AdaStress.Interface.NullHeuristic
— TypeNull heuristic. Returns zero.
AdaStress.Interface.ObservableState
— TypeState type for observable simulation.
AdaStress.Interface.RemoteASTMDP
— TypeRemoteASTMDP{S<:State, A<:Action} <: AbstractASTMDP{S, A}
MDP object that virtually references remote MDP. Autogenerated by ASTClient
.
AdaStress.Interface.Reward
— TypeStandard AST reward structure.
AdaStress.Interface.SampleAction
— TypeAction type corresponding to instantiation of stochastic environment.
AdaStress.Interface.SeedAction
— TypeAction type corresponding to setting random seed of simulation.
AdaStress.Interface.State
— TypeAbstract type for AST state.
AdaStress.Interface.Token
— TypeOptional private token for additional security. Use of token prompts seed rehashing to obstruct client-side interpretability.
AdaStress.Interface.UnimplementedError
— TypeInternal unimplemented exception type.
AdaStress.Interface.UnobservableState
— TypeState type for unobservable simulation.
AdaStress.Interface.VariableInfo
— TypeInferred properties of single environment variable.
AdaStress.Interface.VectorObjective
— TypeVector reward function. Maintains separate components to facilitate post-analysis and enhanced learning methods.
AdaStress.Interface.WeightedObjective
— TypeDefault objective function. Sums components at each timestep.
AdaStress.Interface._echo
— MethodRespond to echo request from ASTClient.
AdaStress.Interface._info
— MethodRespond to information request from ASTClient.
AdaStress.Interface.act!
— MethodApply raw action to environment and return reward.
AdaStress.Interface.act!
— MethodApply converted action to environment and return reward.
AdaStress.Interface.act_dim
— MethodInfer dimension of action space.
AdaStress.Interface.action_type
— MethodReturn action type.
AdaStress.Interface.actions
— MethodReturn set of available actions as sampleable object. # TODO: not type-stable.
AdaStress.Interface.call
— MethodPerform function call on server MDP. Call sends request to server with provided function and arguments and receives return value. Blocks until complete.
AdaStress.Interface.close_tunnel
— MethodClose SSH tunnel to/from remote server.
AdaStress.Interface.connect!
— Methodconnect!(client::ASTClient; remote::String="", remote_port::Int64=1812)
Connect client to server, optionally through SSH tunnel. Optional keyword argument remote
should be of the form user@machine
.
AdaStress.Interface.connect!
— Methodconnect!(server::ASTServer; remote::String="", remote_port::Int64=1812)
Connect server, optionally through SSH tunnel. Optional keyword argument remote
should be of the form user@machine
.
AdaStress.Interface.convert_a
— MethodWrap action for internal handling.
AdaStress.Interface.custom_reward
— MethodInternal handling of custom reward.
AdaStress.Interface.disconnect!
— Methoddisconnect!(client::ASTClient)
Disconnect client from server.
AdaStress.Interface.disconnect!
— Methoddisconnect!(server::ASTServer)
Disconnect server.
AdaStress.Interface.distance
— Methoddistance(sim::BlackBox)
Return custom metric of distance to event. For best results, metric should depend only on current state. For episodic simulation, return minimum distance to event across entire episode (miss distance).
AdaStress.Interface.distance
— Methoddistance(sim::GrayBox)
Return custom metric of distance to event. For best results, metric should depend only on current state. For episodic simulation, return minimum distance to event across entire episode (miss distance).
AdaStress.Interface.environment
— Methodenvironment(sim::GrayBox)
Return Environment
object constructed by simulation. Environment
is an alias of Dict{Symbol, Sampleable}
.
AdaStress.Interface.evaluate!
— MethodStep simulation and return log probability of transition.
AdaStress.Interface.flatten
— Methodflatten(distribution, value)
Flatten environment variable to quasi-normalized array.
AdaStress.Interface.flatten
— MethodFlatten EnvironmentValue
into array.
AdaStress.Interface.generate_mdp
— Methodgenerate_mdp(client::ASTClient)
Query remote MDP and generate RemoteASTMDP
with matching attributes to interface with appropriate solvers.
AdaStress.Interface.infer_info
— MethodInfer information about simulation environment.
AdaStress.Interface.infer_state
— MethodInfer type of state.
AdaStress.Interface.isevent
— Methodisevent(sim::BlackBox)
Check whether simulation is in event (failure) state. For episodic simulation, check whether event occurred during episode.
AdaStress.Interface.isevent
— Methodisevent(sim::GrayBox)
Check whether simulation is in event (failure) state. For episodic simulation, check whether event occurred during episode.
AdaStress.Interface.isterminal
— Methodisterminal(sim::BlackBox)
Check whether simulation has finished due to time limit or terminal state, independent of failure status.
AdaStress.Interface.isterminal
— Methodisterminal(sim::GrayBox)
Check whether simulation has finished due to time limit or terminal state, independent of failure status.
AdaStress.Interface.logprob
— MethodCalculate log probability of sample from environment variable.
AdaStress.Interface.logprob
— MethodCalculate total log probability of environment value.
AdaStress.Interface.obs_dim
— MethodInfer dimension of state space.
AdaStress.Interface.observe
— MethodReturn observation of environment.
AdaStress.Interface.observe
— Methodobserve(sim::BlackBox)
Return quasi-normalized observation of simulation. Observation should copy, not reference, simulation state. If simulation is unobservable, leave unimplemented.
AdaStress.Interface.observe
— Methodobserve(sim::GrayBox)
Return quasi-normalized observation of simulation. Observation should copy, not reference, simulation state. If simulation is unobservable, leave unimplemented.
AdaStress.Interface.open_tunnel
— MethodOpen SSH tunnel to/from remote server.
AdaStress.Interface.orderedkeys
— MethodReturn ordered list dictionary keys.
AdaStress.Interface.ping
— Methodping(client::ASTClient)
Request empty echo from ASTServer, returning approximate round-trip time in seconds.
AdaStress.Interface.reseed
— MethodSalt random seed with private token for additional security.
AdaStress.Interface.reset!
— MethodReset MDP.
AdaStress.Interface.reset!
— Methodreset!(sim::BlackBox)
Reset simulation.
AdaStress.Interface.reset!
— Methodreset!(sim::GrayBox)
Reset simulation.
AdaStress.Interface.respond
— MethodProcess simulation request from client and construct response.
AdaStress.Interface.reward
— Methodreward(sim::BlackBox)
Advanced option: additional reward or heuristic. Returns scalar value or partially-applied function, allowing efficient calculation of R(s,s') = R(s)(s'). Should not alter simulation. See documentation for more details.
AdaStress.Interface.reward
— Methodreward(sim::GrayBox, x::EnvironmentValue)
Advanced option: additional reward or heuristic. Returns scalar value or partially-applied function, allowing efficient calculation of R(s,a,s') = R(s,a)(s'). Should not alter simulation. See documentation for more details.
AdaStress.Interface.run
— MethodListen for incoming requests and execute function calls on MDP. Can handle multiple client connections asynchronously, but server currently holds a single MDP instance.
AdaStress.Interface.set_password
— Methodset_password(server::ASTServer)
Set private token to string input (password). Avoids explicit representation of password in storage or side effects.
AdaStress.Interface.set_token
— Methodset_token(server::ASTServer, token)
Set private token to encrypt seeds. Recommended to use set_password
instead, to avoid leaking token through side effects.
AdaStress.Interface.state_type
— MethodReturn state type.
AdaStress.Interface.step!
— Methodstep([rng::AbstractRNG], sim::BlackBox)
Step simulation and return log probability of transition. If simulation uses global RNG, the one-argument step! should be implemented. If simulation requires non-global RNG, the two-argument function should be implemented instead.
AdaStress.Interface.step!
— Methodstep(sim::GrayBox, x::EnvironmentValue)
Step simulation given an EnvironmentValue
object. EnvironmentValue
is an alias of Dict{Symbol, Any}
.
AdaStress.Interface.sync
— MethodRead from socket until communication is synchronized. Typically unnecessary, but mitigates issue in which IO between client and server can become mismatched.
AdaStress.Interface.terminated
— MethodReturn Boolean indicating termination status.
AdaStress.Interface.unflatten
— MethodReconstruct EnvironmentValue
from array.
AdaStress.Interface.unflatten
— Methodunflatten(distribution, array::AbstractVector{<:Real})
Reconstruct environment variable from quasi-normalized array.
Base.rand
— MethodSample environment, returning EnvironmentValue
(default) or array.
AdaStress.Analysis
— ModuleAnalysis framework. Provides utilities to analyze and visualize solver results.
AdaStress.Solvers.MonteCarloSearch
— ModuleSimple uninformed Monte Carlo search. Should be used as a baseline for other local solvers, in terms of runtime performance and overall efficacy.
AdaStress.Solvers.MonteCarloSearch.MCS
— TypeMCS <: LocalSolver
Monte Carlo search solver.
AdaStress.Solvers.MonteCarloSearch.MCSResult
— TypeMCSResult <: LocalResult
Monte Carlo search result.
AdaStress.Solvers
— ModuleSolvers module. Provides algorithms for solving AST MDPs.
AdaStress.Solvers.GlobalResult
— TypeAbstract type for global result (adversarial policy).
AdaStress.Solvers.GlobalSolver
— TypeAbstract type for solvers that return an adversarial policy.
AdaStress.Solvers.LocalResult
— TypeAbstract type for local result (failure examples).
AdaStress.Solvers.LocalSolver
— TypeAbstract type for solvers that return failure examples.
AdaStress.Solvers.Result
— TypeAbstract type for solver output.
AdaStress.Solvers.Solver
— TypeAbstract base type for solvers.
AdaStress.Solvers.solve
— Methodsolve(::Solver, ::Function)
Apply solver to MDP generator function.
DataStructures.enqueue!
— MethodDelete least significant keys if length exceeds k
. Facilitates top-k priority queueing.
AdaStress.Solvers.MonteCarloTreeSearch
— ModuleMonte Carlo tree search algorithm. Balances exploration and experience. Constructs partially-ordered search tree over actions, treating states as anonymous.
AdaStress.Solvers.MonteCarloTreeSearch.MCTS
— TypeMCTS <: LocalSolver
Monte Carlo tree search algorithm.
AdaStress.Solvers.MonteCarloTreeSearch.MCTSResult
— TypeMCTSResult <: LocalResult
Monte Carlo tree search result.
AdaStress.Solvers.MonteCarloTreeSearch.Node
— TypeAnonymous state node defined by unique chain of preceding actions. Search tree is composed of singly- and doubly-linked nodes.
AdaStress.Solvers.MonteCarloTreeSearch.add
— MethodTake an action from a given state, adding and returning new child. For transient action chains, such as rollouts, set forward link to false
; nodes are deleted automatically by garbage collector when leaf goes out of scope.
AdaStress.Solvers.MonteCarloTreeSearch.children
— MethodReturn unordered collection of children. Uses PQ backend to avoid unnecessary sort.
AdaStress.Solvers.MonteCarloTreeSearch.isleaf
— MethodReturn whether node is a leaf (no children).
AdaStress.Solvers.MonteCarloTreeSearch.isroot
— MethodReturn whether node is a root (no parent).
AdaStress.Solvers.MonteCarloTreeSearch.max_depth
— MethodReturn maximum depth of tree.
AdaStress.Solvers.MonteCarloTreeSearch.rollout
— MethodRoll out random policy from given state, returning total return and final state.
AdaStress.Solvers.MonteCarloTreeSearch.simulate
— FunctionPerform one full simulation of MCTS.
AdaStress.Solvers.MonteCarloTreeSearch.top_transition
— MethodReturn top-scoring action and next state.
AdaStress.Solvers.MonteCarloTreeSearch.total_size
— MethodReturn total number of nodes in tree.
AdaStress.Solvers.MonteCarloTreeSearch.trace
— MethodReturn action chain from root to current node.