Class IPolicy
Class IPolicy
- Defined in File PolicyInterface.h
Inheritance Relationships
Derived Types
-
public UBlueprintPolicy(Class UBlueprintPolicy) -
public UNNEPolicy(Class UNNEPolicy)
class IPolicySource: Source/Schola/Public/Policies/PolicyInterface.h
Dependencies: FInteractionDefinition, FPoint
Interface for policy implementations in the Schola framework.
A policy maps observations to actions, typically through a trained neural network model or other decision-making algorithm. This interface defines the core methods that all policies must implement for inference and initialization.
Subclassed by UBlueprintPolicy, UNNEPolicy
Public Functions
| Symbol | Details |
|---|---|
Think | Generates an action from the given observations. |
BatchedThink | Generates actions from a batch of observations. |
Init | Initializes the policy from an interaction definition. |
IsInferenceBusy | Checks if the policy is currently performing inference. |
Think
inline virtual bool Think(const TInstancedStruct<FPoint> &InObservations, TInstancedStruct<FPoint> &OutAction)Generates an action from the given observations.
This is the core inference method that takes observations from the environment and produces an action for the agent to execute.
Parameters
-
InObservations – [in] The observations from the environment.
-
OutAction – [out] Output parameter that receives the generated action.
Returns:
True if inference succeeded, false otherwise.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | InObservations | const TInstancedStruct< FPoint > & | The observations from the environment. |
| 2 | — | OutAction | TInstancedStruct< FPoint > & | Output parameter that receives the generated action. |
Attributes: inline, virtual
Source: Source/Schola/Public/Policies/PolicyInterface.h
BatchedThink
inline virtual boolBatchedThink(const TArray<TInstancedStruct<FPoint>> &InObservations, TArray<TInstancedStruct<FPoint>> &OutActions)Generates actions from a batch of observations.
This method processes multiple observations at once, which can be more efficient than processing them individually. The default implementation calls Think for each observation, but derived classes can override this for optimized batch processing.
Parameters
-
InObservations – [in] Array of observations to process.
-
OutActions – [out] Output array that receives the generated actions.
Returns:
True if all inferences succeeded, false otherwise.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | InObservations | const TArray< TInstancedStruct< FPoint > > & | Array of observations to process. |
| 2 | — | OutActions | TArray< TInstancedStruct< FPoint > > & | Output array that receives the generated actions. |
Attributes: inline, virtual
Source: Source/Schola/Public/Policies/PolicyInterface.h
Init
inline virtual bool Init(const FInteractionDefinition &InPolicyDefinition)Initializes the policy from an interaction definition.
This method sets up the policy with the observation and action space definitions, allowing it to validate inputs and outputs and configure any internal structures needed for inference.
Parameters
InPolicyDefinition – [in] An object defining the policy’s input/output shapes and parameters.
Returns:
True if initialization succeeded, false otherwise.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | InPolicyDefinition | const FInteractionDefinition & | An object defining the policy’s input/output shapes and parameters. |
Attributes: inline, virtual
Source: Source/Schola/Public/Policies/PolicyInterface.h
IsInferenceBusy
inline virtual bool IsInferenceBusy() constChecks if the policy is currently performing inference.
This method can be used to determine if the policy is busy processing a request, which is useful for asynchronous inference implementations.
Returns:
True if inference is in progress, false otherwise.
Attributes: inline, const, virtual