Skip to content

Class IPolicy

Class IPolicy

  • Defined in File PolicyInterface.h

Inheritance Relationships

Derived Types

class IPolicy

Source: 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

SymbolDetails
ThinkGenerates an action from the given observations.
BatchedThinkGenerates actions from a batch of observations.
InitInitializes the policy from an interaction definition.
IsInferenceBusyChecks 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.

#DirectionNameTypeDescription
1InObservationsconst TInstancedStruct< FPoint > &The observations from the environment.
2OutActionTInstancedStruct< FPoint > &Output parameter that receives the generated action.

Attributes: inline, virtual

Source: Source/Schola/Public/Policies/PolicyInterface.h

BatchedThink

inline virtual bool
BatchedThink(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.

#DirectionNameTypeDescription
1InObservationsconst TArray< TInstancedStruct< FPoint > > &Array of observations to process.
2OutActionsTArray< 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.

#DirectionNameTypeDescription
1InPolicyDefinitionconst 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() const

Checks 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

Source: Source/Schola/Public/Policies/PolicyInterface.h