tasks package

The Task Class

class autompc.tasks.Task(system)[source]

Defines a control task to be solved

set_num_steps(num_steps)[source]

Sets maximum number of steps as the task terminiation condition.

Parameters:

num_steps (int) – Maximum number of steps.

has_num_steps()[source]

Check whether task has a maximum number of steps for the task.

Returns:

True if maximum number of steps is set

Return type:

bool

get_num_steps()[source]

Returns the maxium number steps if available. None otherwise.

term_cond(traj)[source]

Checks the task termination condition.

Parameters:

traj (Trajectory) – Trajectory to check termination condition.

Returns:

True if termination condition met.

Return type:

bool

set_term_cond(term_cond)[source]

Set the task termination condition

Parameters:

term_cond (Function, Trajectory -> bool) – Termination condition function.

set_cost(cost)[source]

Sets the task cost

Parameters:

cost (Cost) – Cost to be set

get_cost()[source]

Get the task cost

Returns:

Task cost

Return type:

Cost

set_init_obs(init_obs)[source]

Sets the initial observation for the task.

Parameters:

init_obs (numpy array of size self.system.obs_dim) – Initial observation

get_init_obs()[source]

Get the initial observation for the task

Returnsnumpy array of size self.system.obs_dim

Initial observation

set_obs_bound(obs_label, lower, upper)[source]

Set a bound for one dimension of the observation

Parameters:
  • obs_label (string) – Name of observation dimension to be bounded

  • lower (float) – Lower bound

  • upper (float) – Upper bound

set_obs_bounds(lowers, uppers)[source]

Set bound for all observation dimensions

Parameters:
  • lowers (numpy array of size self.system.obs_dim) – Lower bounds

  • uppers (numpy array of size self.system.obs_dim) – Upper bounds

set_ctrl_bound(ctrl_label, lower, upper)[source]

Set a bound for one dimension of the control

Parameters:
  • ctrl_label (string) – Name of control dimension to be bounded

  • lower (float) – Lower bound

  • upper (float) – Upper bound

set_ctrl_bounds(lowers, uppers)[source]

Set bound for all control dimensions

Parameters:
  • lowers (numpy array of size self.system.ctrl_dim) – Lower bounds

  • uppers (numpy array of size self.system.ctrl_dim) – Upper bounds

are_obs_bounded()[source]

Check whether task has observation bounds

Returns:

True if any observation dimension is bounded

Return type:

bool

are_ctrl_bounded()[source]

Check whether task has control bounds

Returns:

True if any control dimension is bounded

Return type:

bool

get_obs_bounds()[source]

Get observation bounds. If unbounded, lower and upper bound are -np.inf and +np.inf respectively.

Returns:

Observation bounds

Return type:

numpy array of shape (self.system.obs_dim, 2)

get_ctrl_bounds()[source]

Get control bounds. If unbounded, lower and upper bound are -np.inf and +np.inf respectively.

Returns:

Control bounds

Return type:

numpy array of shape (self.system.ctrl_dim, 2)