Skip to content

UPythonGymConnector

class UPythonGymConnector : public UExternalGymConnector

A connection to an external gym API implemented in Python, using gRPC for communication.

Note: This can theoretically work with any gRPC client, not just Python, although that is untested currently.

Dependencies

This type depends on:

Inherits from: public UExternalGymConnector

Public Interface

Constructor:

UPythonGymConnector

UPythonGymConnector()

Create a new UPythonGymConnector.

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 96, column 1)

Implementation: Schola/Source/Schola/Private/GymConnectors/PythonGymConnector.cpp (lines 5-7)

Public Functions:

RequestStateUpdate

virtual TFuture<FTrainingStateUpdate *> RequestStateUpdate() override

Request a state update from the gym API using the current state of the agents from environments.

Returns: A future that will eventually contain the decision for all agents in all environments.

Note: This function is asynchronous and will return immediately.

Returns: TFuture&lt;FTrainingStateUpdate &#42;&gt;

Attributes: virtual

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 103, column 9)

Implementation: Schola/Source/Schola/Private/GymConnectors/PythonGymConnector.cpp (lines 9-12)

SendState

virtual void SendState(const FTrainingState &Value) override

Send the current state to the gym.

Parameters:

  • Value (const FTrainingState &) – [in] The current state of the training.

Attributes: virtual

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 109, column 6)

Implementation: Schola/Source/Schola/Private/GymConnectors/PythonGymConnector.cpp (lines 14-18)

SubmitPostResetState

virtual void SubmitPostResetState(const FTrainingState &Value) override

Submit the post-reset state to the gym.

Parameters:

  • Value (const FTrainingState &) – [in] The state after a reset.

Attributes: virtual

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 115, column 6)

Implementation: Schola/Source/Schola/Private/GymConnectors/PythonGymConnector.cpp (lines 20-36)

Init

virtual void Init(const FTrainingDefinition &AgentDefns) override

Initialize the connector with the given training definitions.

Parameters:

  • AgentDefns (const FTrainingDefinition &) – [in] The training definitions to initialize with.

Attributes: virtual

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 121, column 6)

Implementation: Schola/Source/Schola/Private/GymConnectors/PythonGymConnector.cpp (lines 38-72)

Enable

virtual void Enable() override

Enable the connector.

Attributes: virtual

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 126, column 6)

Implementation: Schola/Source/Schola/Private/GymConnectors/PythonGymConnector.cpp (lines 74-77)

CheckForStart

virtual bool CheckForStart() override

Check if the start request has been received.

Returns: True if the start request has been received, false otherwise.

Returns: bool

Attributes: virtual

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 132, column 6)

Implementation: Schola/Source/Schola/Private/GymConnectors/PythonGymConnector.cpp (lines 79-87)

Private Interface

Private Members:

IPollingBackendInterface<GymConnectorStartRequest> * StartRequestService

IPollingBackendInterface<GymConnectorStartRequest> * StartRequestService

A type for a consumer interface that collects an initial GymConnectorStartRequest.

Attributes: private

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 78, column 26)

DRSType DecisionRequestService

DRSType DecisionRequestService

The service that will handle decision requests.

Attributes: private

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 81, column 9)

ADSType AgentDefinitionService

ADSType AgentDefinitionService

The service that will handle publishing agent definitions.

Attributes: private

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 83, column 9)

PRSType PostResetStateService

PRSType PostResetStateService

The service that will handle publishing the state after each reset.

Attributes: private

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 85, column 9)

UCommunicationManager * CommunicationManager

UCommunicationManager * CommunicationManager

The communication manager that will handle the gRPC server.

Attributes: private

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 89, column 23)

Source: Schola/Source/Schola/Public/GymConnectors/PythonGymConnector.h (line 67, column 1)