7 #include "MemoryBuffer.h"
14 class IAgentDataStore;
17 struct AgentDataStoreCInfo :
public ResourceCInfo
31 typedef void (SMARTENGINE_CALLBACK *
Agent_RecordObservation_Ptr)(
void* userData,
const char* inputName,
const float* buffer, int64 bufferCount);
32 typedef void (SMARTENGINE_CALLBACK *
Agent_RecordAction_Ptr)(
void* userData,
const char* actionName,
const float* buffer, int64 bufferCount);
62 virtual void ClearAllExperiences() = 0;
86 SMARTENGINE_DECLARE_CLASS(
IAgent)
89 virtual void StartNewExperience() = 0;
99 virtual void RecordObservation(
const char* inputName,
const float* buffer, int64 bufferCount) = 0;
109 virtual void RecordAction(
const char* actionName,
const float* buffer, int64 bufferCount) = 0;
154 SMARTENGINE_EXPORT
void AgentDataStore_ClearAllExperiences(ObjPtr
object);
155 SMARTENGINE_EXPORT
void AgentDataStore_ClearExperiences(ObjPtr
object,
const char* agentName);
157 SMARTENGINE_EXPORT
void Agent_StartNewExperience(ObjPtr
object);
158 SMARTENGINE_EXPORT
void Agent_RecordObservation(ObjPtr
object,
const char* inputName,
const float* buffer,
160 SMARTENGINE_EXPORT
void Agent_RecordAction(ObjPtr
object,
const char* actionName,
const float* buffer, int64 bufferCount);
161 SMARTENGINE_EXPORT
void Agent_GiveReward(ObjPtr
object,
float reward);
162 SMARTENGINE_EXPORT
void Agent_EndEpisode(ObjPtr
object);
164 SMARTENGINE_EXPORT ObjPtr UserAgent_CreateInstance(
const UserAgentCInfo& cinfo);
Agent_RecordObservation_Ptr recordObservation
Definition: Agent.h:43
void(SMARTENGINE_CALLBACK * Agent_EndEpisode_Ptr)(void *userData)
Definition: Agent.h:34
virtual void RecordAction(const char *actionName, const float *buffer, int64 bufferCount)=0
Records the output of the network we applied to the environment (the game or character)
RL trainers implement this to create agents.
Definition: Agent.h:129
virtual void RecordObservation(const char *inputName, const float *buffer, int64 bufferCount)=0
Records the input data to the network we are watching.
void(SMARTENGINE_CALLBACK * Agent_RecordObservation_Ptr)(void *userData, const char *inputName, const float *buffer, int64 bufferCount)
Definition: Agent.h:31
Base class for objects that can be loaded from and saved to an in memory buffer.
Definition: Resource.h:54
Agent_EndEpisode_Ptr endEpisode
Definition: Agent.h:46
Data used to construct an IAgentDataStore instance
Definition: Agent.h:21
void(SMARTENGINE_CALLBACK * Agent_RecordAction_Ptr)(void *userData, const char *actionName, const float *buffer, int64 bufferCount)
Definition: Agent.h:32
Agent_StartNewExperience_Ptr startNewExperience
Definition: Agent.h:42
Smart pointer to an IObject. Automatic ref counting.
Definition: ObjectPtr.h:16
void * userData
Definition: Agent.h:41
Definition: A2CTrainer.h:10
Base class for SmartEngine AI objects. It is not common to deal with this class directly.
Definition: Object.h:19
virtual void ClearExperiences(const char *agentName)=0
Removes all experiences from the store for a given agent name.
int maxExperiences
The maximum number of experiences to keep per RL trainer before we start removing old ones
Definition: Agent.h:27
Agent_RecordAction_Ptr recordAction
Definition: Agent.h:44
Agent_GiveReward_Ptr giveReward
Definition: Agent.h:45
SMARTENGINE_EXPORT ObjectPtr< IAgent > CreateUserAgent(const UserAgentCInfo &cinfo)
Creates an overridable instance of IAgent from a previously serialized agent.
void(SMARTENGINE_CALLBACK * Agent_StartNewExperience_Ptr)(void *userData)
Definition: Agent.h:30
Base class for objects that can be loaded from and saved to disk.
Definition: Resource.h:77
The agent data store keeps experience data for the purpose of training. Some RL trainers don't store ...
Definition: Agent.h:57
virtual void EndEpisode()=0
Called at the logical conclusion of a training session. Usually some event like the player died or th...
SMARTENGINE_EXPORT ObjectPtr< IAgentDataStore > CreateAgentDataStore(const AgentDataStoreCInfo &cinfo)
Creates an instance of IAgentDataStore
void(SMARTENGINE_CALLBACK * Agent_GiveReward_Ptr)(void *userData, float reward)
Definition: Agent.h:33
virtual void GiveReward(float reward)=0
The trainers will try to maximize rewards. The higher the value, the better the rewards....
Agents are used to track the performance of one instance of a network.
Definition: Agent.h:84
Data used to construct an overridable instance of IAgent
Definition: Agent.h:40