rlang.grounding package
Table of Contents
rlang.grounding.groundings module
Module containing all RLang groundings.
- class rlang.grounding.groundings.Grounding[source]
Bases:
object
Parent class for all groundings.
For all intents and purposes, this is an abstract class.
- class rlang.grounding.groundings.GroundingFunction[source]
Bases:
Grounding
Parent class for groundings that are callable. In general, only the children of this class should be used.
All GroundingFunctions have a specified domain and codomain. They are invoked using keyword arguments that correspond to their domain:
from rlang import Domain def can_move_fun(*args, **kwargs): return not kwargs['state'] in pit_states and kwargs['action'] in move_actions can_move = GroundingFunction(domain=Domain.STATE_ACTION, codomain=Domain.BOOLEAN, function=can_move_fun) can_move(state=0, action=1) >> True
- class rlang.grounding.groundings.PrimitiveGrounding[source]
Bases:
GroundingFunction
GroundingFunction which requires no arguments, i.e. domain=Domain.ANY
- class rlang.grounding.groundings.ConstantGrounding[source]
Bases:
PrimitiveGrounding
GroundingFunction for defined RLang Constants
- class rlang.grounding.groundings.ParameterizedActionExecution[source]
Bases:
GroundingFunction
- __init__(parameterized_action, arguments)[source]
Initialize a GroundingFunction.
- Parameters
domain – Domain of the function.
codomain – Codomain of the function.
function – the function.
name – the name of the Grounding.
arguments (List[GroundingFunction]) –
- class rlang.grounding.groundings.ActionReference[source]
Bases:
GroundingFunction
Represents a reference to a specified action.
- class rlang.grounding.groundings.IdentityGrounding[source]
Bases:
GroundingFunction
Grounding for representing S, A, and S’.
- class rlang.grounding.groundings.MDPClassGrounding[source]
Bases:
GroundingFunction
- class rlang.grounding.groundings.MDPObjectGrounding[source]
Bases:
GroundingFunction
For representing objects, which may have properties that are functions of state.
- class rlang.grounding.groundings.MDPObjectAttributeGrounding[source]
Bases:
GroundingFunction
For referencing attributes of abstract objects that are not in the state.
- __init__(grounding, attribute_chain)[source]
Initialize a grounding for referencing abstract object attributes.
- Parameters
grounding (GroundingFunction) – the MDPObjectGrounding whose attribute you are referencing.
attribute_chain (List) – a list of attribute/sub-attributes (e.g. [“color”, “red_value”])
- class rlang.grounding.groundings.PredicateEvaluation[source]
Bases:
GroundingFunction
- __init__(predicate, arguments)[source]
Initialize a GroundingFunction.
- Parameters
domain – Domain of the function.
codomain – Codomain of the function.
function – the function.
name – the name of the Grounding.
arguments (List[GroundingFunction]) –
- class rlang.grounding.groundings.StateObjectAttributeGrounding[source]
Bases:
GroundingFunction
For referencing attributes of objects in the state when the state is object-oriented.
- __init__(attribute_chain, domain=Domain.STATE)[source]
Initialize a grounding for referencing object attributes, when those objects are in the state.
- Parameters
attribute_chain (List) – a list of attribute/sub-attributes (e.g. [“ball”, “color”, “red_value”])
domain (Union[str, Domain]) – either “state” or “next_state”.
- class rlang.grounding.groundings.Factor[source]
Bases:
GroundingFunction
Represents a factor of the state space.
- class rlang.grounding.groundings.Feature[source]
Bases:
GroundingFunction
Represents a feature of the state space.
Can represent any function of the state space.
- class rlang.grounding.groundings.MarkovFeature[source]
Bases:
GroundingFunction
Represents a Grounding that is a function of (state, action, next_state)
- class rlang.grounding.groundings.Proposition[source]
Bases:
GroundingFunction
Represents a function which has a truth value.
A Proposition is a feature with a codomain restricted to True or False.
- class rlang.grounding.groundings.Goal[source]
Bases:
Proposition
- class rlang.grounding.groundings.ValueFunction[source]
Bases:
GroundingFunction
Represents a value function.
- class rlang.grounding.groundings.ProbabilisticFunction[source]
Bases:
GroundingFunction
Represents a function that provides stochastic output.
- class rlang.grounding.groundings.ActionDistribution[source]
Bases:
ProbabilityDistribution
Represents a distribution of possible next actions, options, or policies
- Parameters
distribution – a dictionary of the form {Action/Option/Policy: probability,}
- class rlang.grounding.groundings.StateDistribution[source]
Bases:
ProbabilityDistribution
- class rlang.grounding.groundings.RewardDistribution[source]
Bases:
ProbabilityDistribution
- class rlang.grounding.groundings.GroundingDistribution[source]
Bases:
ProbabilityDistribution
- class rlang.grounding.groundings.Policy[source]
Bases:
ProbabilisticFunction
Represents a closed-loop policy function
- class rlang.grounding.groundings.PlanExecution[source]
Bases:
GroundingFunction
- __init__(plan, arguments=None)[source]
Initialize a GroundingFunction.
- Parameters
domain – Domain of the function.
codomain – Codomain of the function.
function – the function.
name – the name of the Grounding.
arguments (Optional[List[GroundingFunction]]) –
- class rlang.grounding.groundings.Option[source]
Bases:
Grounding
Grounding object for an option.
- __init__(initiation, policy, termination, name=None)[source]
- Parameters
initiation (Proposition) – A Proposition capturing the initiation set of the option.
policy (Policy) – A PolicyOld capturing the policy of the option.
termination (Proposition) – A Proposition capturing the termination set of the option.
name (optional) – the name of the grounding.
- class rlang.grounding.groundings.TransitionFunction[source]
Bases:
ProbabilisticFunction
Represents a transition function.
- class rlang.grounding.groundings.RewardFunction[source]
Bases:
ProbabilisticFunction
Represents function of expected reward.
- class rlang.grounding.groundings.Prediction[source]
Bases:
ProbabilisticFunction
GroundingFunction for an RLang Prediction object.
Used to express the predicted value of another RLang object. Limited to GroundingFunctions with a domain of (S) or (S, A).
- __init__(grounding, function=None, domain=Domain.STATE_ACTION, complete=False, *args, **kwargs)[source]
- classmethod from_grounding_distribution(grounding, function, complete=False)[source]
- Parameters
grounding (Grounding) – The grounding that is predicted
function (GroundingDistribution) – The prediction function
- class rlang.grounding.groundings.Effect[source]
Bases:
Grounding
GroundingFunction for an RLang Effect object.
Contains an optional RewardFunction, TransitionFunction, and list of Predictions.
- __init__(reward_function=None, transition_function=None, predictions=None, name=None, probability=1.0)[source]
- Parameters
reward_function (Optional[RewardFunction]) – a RewardFunction
transition_function (Optional[TransitionFunction]) – a TransitionFunction
predictions (Optional[List[Prediction]]) – a list of Predictions
name (Optional[str]) – name of the Effect
probability (Optional[float]) – probability of this effect occurring; default: 1