rlang.agents package
Table of Contents
rlang.agents.RLangPolicyAgentClass module
- class rlang.agents.RLangPolicyAgentClass.RLangPolicyAgent[source]
Bases:
Module
Implementation for an agent that uses an RLang policy
- __init__(rlang_policy, epsilon=1e-08, n_actions=2, obs_normalizer=None)[source]
- Parameters
rlang_policy (Policy) – an RLang policy.
epsilon (float) – Exploration term.
n_actions (int) – Number of actions.
obs_normalizer –
- forward(state)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
rlang.agents.RLangQLearningAgentClass module
- class rlang.agents.RLangQLearningAgentClass.RLangQLearningAgent[source]
Bases:
QLearningAgent
Implementation for a Q Learning agent that utilizes RLang hints
- __init__(actions, states, knowledge, name='RLang-Q-learning', use_transition=False, alpha=0.1, gamma=0.99, epsilon=0.1, explore='uniform', anneal=False, default_q=0)[source]
- Parameters
actions (list) – Contains strings denoting the actions.
states (list) – A list of all possible states.
knowledge (list) – An RLangKnowledge object.
name (str) – Denotes the name of the agent.
alpha (float) – Learning rate.
gamma (float) – Discount factor.
epsilon (float) – Exploration term.
explore (str) – One of {softmax, uniform}. Denotes explore policy.
default_q (float) – the default value to initialize every entry in the q-table with [by default, set to 0.0]