MuJoCo problem
- class blackbox.mujoco_problems.MujocoProblem(env_name, lb=-1.0, ub=1.0, num_rollouts=3, seed=None)[source]
Bases:
BaseProblem- __call__(x)[source]
Method to compute total reward for a given policy x
- Parameters:
x (np.ndarray) – input to be evaluated, can be a single sample or multiple samples, (dim,) or (n_samples,dim)
- Returns:
reward – reward of the trajectory for the given input, (1,) or (n_samples,1)
- Return type:
np.ndarray
- __init__(env_name, lb=-1.0, ub=1.0, num_rollouts=3, seed=None)[source]
Class for setting up MuJoCo environment and run the simulation
- Parameters:
env_name (str) – name of the mujoco environment, must be: ‘Swimmer-v5’, ‘HalfCheetah-v5’, ‘Hopper-v5’, ‘Walker2d-v5’, or ‘Humanoid-v5’
lb (float, default=-1.0) – lower bound of the input space
ub (float, default=1.0) – upper bound of the input space
num_rollouts (int, default=3) – number of times to run the entire episode for a given policy
seed (int | None, default=None) – seed for the environment
- class blackbox.mujoco_problems.RunningStat(shape=None)[source]
Bases:
object- __init__(shape=None)[source]
Class for computing statistics for a stream of data, here it is used for computing the mean and standard deviation of the observation space of the Mujoco env. This mean and standard deviation is used for normalizing the observation space before computing the next action
- property mean
- property n
- push(x)[source]
Method for adding a new value of x i.e new observation state to the running statistics
Note: x should be a single observation state, not a batch of states
- property shape
- property std
- property var