API Documentation¶
The safemdp package implements tools for safe exploration in finite MDPs.
Main classes¶
These classes provide the main functionality for the safe exploration
SafeMDP(graph, gp, S_hat0, h, L[, beta]) |
Base class for safe exploration in MDPs. |
link_graph_and_safe_set(graph, safe_set) |
Link the safe set to the graph model. |
reachable_set(graph, initial_nodes[, out]) |
Compute the safe, reachable set of a graph |
returnable_set(graph, reverse_graph, ...[, out]) |
Compute the safe, returnable set of a graph |
Grid world¶
Some additional functionality specific to gridworlds.
GridWorld(gp, world_shape, step_size, beta, ...) |
Grid world with Safe exploration |
states_to_nodes(states, world_shape, step_size) |
Convert physical states to node numbers. |
nodes_to_states(nodes, world_shape, step_size) |
Convert node numbers to physical states. |
draw_gp_sample(kernel, world_shape, step_size) |
Draws a sample from a Gaussian process distribution over a user |
grid_world_graph(world_size) |
Create a graph that represents a grid world. |
grid(world_shape, step_size) |
Creates grids of coordinates and indices of state space |
compute_true_safe_set(world_shape, altitude, h) |
Computes the safe set given a perfect knowledge of the map |
compute_true_S_hat(graph, safe_set, ...[, ...]) |
Compute the true safe set with reachability and returnability. |
compute_S_hat0(s, world_shape, n_actions, ...) |
Compute a valid initial safe seed. |
shortest_path(source, next_sample, G) |
Computes shortest safe path from a source to the next state-action pair |
path_to_boolean_matrix(path, graph, S) |
Computes a S-like matrix for approaches where performances is based on the trajectory of the agent (e.g. |
safe_subpath(path, altitudes, h) |
Computes the maximum subpath of path along which the safety constraint is |
Utilities¶
The following are utilities to make testing and working with the library more pleasant.
DifferenceKernel(kernel) |
A fake kernel that can be used to predict differences two function values. |
max_out_degree(graph) |
Compute the maximum out_degree of a graph |