OmniSafe Simmer Agent#

BaseSimmerAgent(cfgs, budget_bound[, ...])

Base class for controlling safety budget of Simmer adapter.

SimmerPIDAgent(cfgs, budget_bound[, ...])

Simmer PID agent.

Base Simmer Agent#

Documentation

class omnisafe.common.simmer_agent.BaseSimmerAgent(cfgs, budget_bound, obs_space=(0,), action_space=(-1, 1), history_len=100)[source]#

Base class for controlling safety budget of Simmer adapter.

Parameters:
  • cfgs (Config) – The configurations for the agent.

  • budget_bound (torch.Tensor) – The bound of the safety budget.

  • obs_space (tuple[int,], optional) – The observation space. Defaults to (0,).

  • action_space (tuple[int, int], optional) – The action space. Defaults to (-1, 1).

  • history_len (int, optional) – The length of the history. Defaults to 100.

Initialize an instance of BaseSimmerAgent.

abstract act(safety_budget, observation)[source]#

Get the action.

Parameters:
  • safety_budget (torch.Tensor) – The current safety budget.

  • observation (torch.Tensor) – The current observation.

Raises:

NotImplementedError – The method is not implemented.

Return type:

Tensor

abstract get_greedy_action(safety_budget, observation)[source]#

Get the greedy action.

Parameters:
  • safety_budget (torch.Tensor) – The current safety budget.

  • observation (torch.Tensor) – The current observation.

Raises:

NotImplementedError – The method is not implemented.

Return type:

Tensor

Simmer PID Agent#

Documentation

class omnisafe.common.simmer_agent.SimmerPIDAgent(cfgs, budget_bound, obs_space=(0,), action_space=(-1, 1), history_len=100)[source]#

Simmer PID agent.

Parameters:
  • cfgs (Config) – The configurations for the agent.

  • budget_bound (torch.Tensor) – The bound of the safety budget.

  • obs_space (tuple[int,], optional) – The observation space. Defaults to (0,).

  • action_space (tuple[int, int], optional) – The action space. Defaults to (-1, 1).

  • history_len (int, optional) – The length of the history. Defaults to 100.

Initialize an instance of SimmerPIDAgent.

act(safety_budget, observation)[source]#

Get the action.

Parameters:
  • safety_budget (torch.Tensor) – The current safety budget.

  • observation (torch.Tensor) – The current observation.

Returns:

The selected action.

Return type:

Tensor

get_greedy_action(safety_budget, observation)[source]#

Get the greedy action.

Parameters:
  • safety_budget (torch.Tensor) – The current safety budget.

  • observation (torch.Tensor) – The current observation.

Returns:

The greedy action.

Return type:

Tensor