70 int64 expectedRowCount);
152 virtual bool HaveNewOutputData() = 0;
191 virtual void ClearData() = 0;
265 virtual void RegisterController(
IGraphController* controller,
const char* modelName,
342 virtual void Update(
float deltaTime) = 0;
407 SMARTENGINE_EXPORT ObjPtr GraphInputOutput_GetGraphComponent(ObjPtr
object,
const char* componentNodeName);
408 SMARTENGINE_EXPORT ObjPtr GraphInputOutput_GetInput(ObjPtr
object,
const char* nodeName);
409 SMARTENGINE_EXPORT
void GraphInputOutput_RequestOutput(ObjPtr
object,
const char* nodeName, int64 expectedRowCount);
410 SMARTENGINE_EXPORT ObjPtr GraphInputOutput_GetOutput(ObjPtr
object,
const char* nodeName);
413 SMARTENGINE_EXPORT
int GraphController_HaveNewOutputData(ObjPtr
object);
415 SMARTENGINE_EXPORT ObjPtr GraphModelOutput_GetOutputRWString(ObjPtr
object,
const char* nodeName);
416 SMARTENGINE_EXPORT ObjPtr GraphModelOutput_GetOutputRWHash(ObjPtr
object,
HashKey nameHash);
418 SMARTENGINE_EXPORT
void GraphModel_ClearData(ObjPtr
object);
419 SMARTENGINE_EXPORT
void GraphModel_AddData(ObjPtr
object,
const char* nodeName, ObjPtr data);
420 SMARTENGINE_EXPORT
void GraphModel_RequestOutput(ObjPtr
object,
int controllerId,
const char* nodeName,
421 int64 expectedRowCount);
422 SMARTENGINE_EXPORT
void GraphModel_Execute(ObjPtr
object);
423 SMARTENGINE_EXPORT
void GraphModel_RetrieveOutput(ObjPtr
object,
int controllerId, ObjPtr modelOut);
424 SMARTENGINE_EXPORT
void GraphModel_Reset(ObjPtr
object);
427 SMARTENGINE_EXPORT ObjPtr StandardGraphModel_GetGraph(ObjPtr
object);
428 SMARTENGINE_EXPORT int64 StandardGraphModel_GetExpectedRowCount(ObjPtr
object,
int controllerId,
const char* outputName);
432 SMARTENGINE_EXPORT ObjPtr GraphManager_CreateInstance(
const GraphManagerCInfo& cinfo);
433 SMARTENGINE_EXPORT
void GraphManager_RegisterController(ObjPtr
object, ObjPtr controller,
const char* modelName,
435 SMARTENGINE_EXPORT
void GraphManager_UnregisterController(ObjPtr
object, ObjPtr controller);
436 SMARTENGINE_EXPORT
int GraphManager_IsControllerRegistered(ObjPtr
object, ObjPtr controller);
437 SMARTENGINE_EXPORT
void GraphManager_RegisterAgent(ObjPtr
object, ObjPtr agent, ObjPtr controller);
438 SMARTENGINE_EXPORT
void GraphManager_UnregisterAgent(ObjPtr
object, ObjPtr agent);
439 SMARTENGINE_EXPORT
void GraphManager_RegisterModel(ObjPtr
object, ObjPtr model,
const char* modelName,
float updateRate);
440 SMARTENGINE_EXPORT
void GraphManager_RegisterModelFromGraph(ObjPtr
object, ObjPtr graph,
const char* modelName,
442 SMARTENGINE_EXPORT
void GraphManager_RegisterModelFromGraphResource(ObjPtr
object,
const char* resourceName,
443 const char* modelName,
float updateRate);
444 SMARTENGINE_EXPORT
void GraphManager_UnregisterModel(ObjPtr
object,
const char* modelName);
445 SMARTENGINE_EXPORT
void GraphManager_Update(ObjPtr
object,
float deltaTime);
446 SMARTENGINE_EXPORT
void GraphManager_UpdateController(ObjPtr
object, ObjPtr controller);
447 SMARTENGINE_EXPORT
void GraphManager_BeginStreaming(ObjPtr
object, ObjPtr controller);
448 SMARTENGINE_EXPORT
void GraphManager_PushStreamData(ObjPtr
object, ObjPtr controller);
449 SMARTENGINE_EXPORT int64 GraphManager_GetStreamingInputRowCount(ObjPtr
object, ObjPtr controller);
450 SMARTENGINE_EXPORT
void GraphManager_EndStreaming(ObjPtr
object, ObjPtr controller);
451 SMARTENGINE_EXPORT
void GraphManager_Reset(ObjPtr
object);
virtual void UnregisterController(IGraphController *controller)=0
Unregisters a controller. It will no longer receive output data.
void * userData
Definition: GraphModel.h:80
void(SMARTENGINE_CALLBACK * GraphModel_AddData_Ptr)(void *userData, const char *nodeName, ObjPtr data)
Definition: GraphModel.h:68
Takes input from a controller and produces an output. If using a graph as the model,...
Definition: GraphModel.h:186
void(SMARTENGINE_CALLBACK * GraphModel_ClearData_Ptr)(void *userData)
Definition: GraphModel.h:67
virtual void RegisterModelFromGraph(IGraph *graph, const char *modelName, float updateRate=cUpdateEveryFrameRate)=0
Registers a graph as a model with the given name and update rate. If a model with the given name is a...
Data used to construct an overridable instance of IGraphModel
Definition: GraphModel.h:79
Definition: StrongNumber.h:9
virtual void RetrieveOutput(int controllerId, IGraphModelOutput *modelOut)=0
Dump all output for the specified controller from the last execution into modelOut.
virtual void Reset()=0
Resets all models.
const float cDefaultUpdateRate
Use the model's default update rate. Not valid when registering a model. This is the only value that ...
Definition: GraphModel.h:34
virtual void RegisterModel(IGraphModel *model, const char *modelName, float updateRate=cUpdateEveryFrameRate)=0
Registers a model with the given name and update rate. If a model with the given name is already regi...
void(SMARTENGINE_CALLBACK * GraphModel_RequestOutput_Ptr)(void *userData, int controllerId, const char *nodeName, int64 expectedRowCount)
Definition: GraphModel.h:69
void(SMARTENGINE_CALLBACK * GraphModel_Execute_Ptr)(void *userData)
Definition: GraphModel.h:71
virtual void BeginStreaming(IGraphController *controller)=0
Streaming lets you feed in chunks of data over time into the model. After beginning the stream,...
Data used to construct an IStandardGraphModel instance
Definition: GraphModel.h:60
Data used to construct an IGraphController instance
Definition: GraphModel.h:41
virtual void PushStreamData(IGraphController *controller)=0
Pushes whatever inputs are set on the controller into the model. The model will not be cleared during...
virtual void Execute()=0
Execute the model and save the results locally.
Interface to the standard model that interacts with a graph. This can be used to extend the standard ...
Definition: GraphModel.h:233
IContext * context
Context to use when creating standard graph models from a graph resource.
Definition: GraphModel.h:53
virtual void UnregisterModel(const char *modelName)=0
Unregisters a model. Any connected controllers will no longer receive data.
Data used to construct an IGraphManager instance
Definition: GraphModel.h:48
const float cUpdateManuallyRate
An update rate set to this value means we shouldn't update the controller automatically,...
Definition: GraphModel.h:26
virtual void AddData(const char *nodeName, IMatrix *data)=0
Add one or more rows of data to the specified node.
virtual void Reset()=0
Called upon request from the user. Reset any internal state.
Smart pointer to an IObject. Automatic ref counting.
Definition: ObjectPtr.h:16
void(SMARTENGINE_CALLBACK * GraphModel_Reset_Ptr)(void *userData)
Definition: GraphModel.h:73
virtual void Update(float deltaTime)=0
Advance the models ahead in time, updating controllers as necessary.
virtual void UnregisterAgent(IAgent *agent)=0
Unregisters an agent
virtual void EndStreaming(IGraphController *controller)=0
Ends the streaming cycle. The graph will execute any requested outputs.
Definition: A2CTrainer.h:10
Base class for SmartEngine AI objects. It is not common to deal with this class directly.
Definition: Object.h:19
GraphModel_Execute_Ptr execute
Definition: GraphModel.h:84
Connects graph controllers with graph models. Graph controllers define a single use of a graph....
Definition: GraphModel.h:260
virtual void RegisterModelFromGraphResource(const char *resourceName, const char *modelName, float updateRate=cUpdateEveryFrameRate)=0
Registers a model with the given name and update rate. This will generate a standard model from a gra...
GraphModel_RetrieveOutput_Ptr retrieveOutput
Definition: GraphModel.h:85
Wrapper around either a const or a mutable matrix.
Definition: Matrix.h:17
void(SMARTENGINE_CALLBACK * GraphModel_RetrieveOutput_Ptr)(void *userData, int controllerId, ObjPtr modelOut)
Definition: GraphModel.h:72
A graph is a collection of buffers and nodes that together form a neural network. The graph is create...
Definition: Graph.h:61
Represents a use of a graph. Owners of the controller feed data to the controller at regular interval...
Definition: GraphModel.h:147
GraphModel_ClearData_Ptr clearData
Definition: GraphModel.h:81
virtual void RequestOutput(int controllerId, const char *nodeName, MatrixIndex expectedRowCount)=0
Execute() should produce output for this node.
GraphModel_RequestOutput_Ptr requestOutput
Definition: GraphModel.h:83
GraphModel_AddData_Ptr addData
Definition: GraphModel.h:82
unsigned int HashKey
Definition: Hash.h:8
SMARTENGINE_EXPORT ObjectPtr< IGraphManager > CreateGraphManager(const GraphManagerCInfo &cinfo)
Creates an instance of IGraphManager.
Used to return output back to controllers.
Definition: GraphModel.h:163
virtual void UpdateController(IGraphController *controller)=0
Updates a controller now. This is the only way to update manually stepped controllers.
virtual MatrixIndex GetExpectedRowCount(int controllerId, const char *outputName) const =0
Returns the number of rows we expect to see for the specified controller and output....
SMARTENGINE_EXPORT ObjectPtr< IGraphController > CreateGraphController(const GraphControllerCInfo &cinfo)
Creates an instance of IGraphController.
GraphModel_Reset_Ptr reset
Definition: GraphModel.h:86
virtual ObjectPtr< IMatrix > GetOutputRW(HashKey nameHash)=0
Returns a read-write matrix for the given name hash. Faster version than the one that takes a string.
const float cUpdateEveryFrameRate
An update rate set to this value means we should update the controller with model output every frame.
Definition: GraphModel.h:19
Every node in the AI graph must belong to the same context.
Definition: Context.h:40
virtual bool IsControllerRegistered(IGraphController *controller) const =0
Returns true if the controller is registered with us.
virtual MatrixIndex GetStreamingInputRowCount(IGraphController *controller) const =0
Returns the current number of streamed rows currently pushed to the model. If the input buffers have ...
SMARTENGINE_EXPORT ObjectPtr< IGraphModel > CreateUserGraphModel(const UserGraphModelCInfo &cinfo)
Creates an overridable instance if IGraphModel
SMARTENGINE_EXPORT ObjectPtr< IStandardGraphModel > CreateStandardGraphModel(const StandardGraphModelCInfo &cinfo)
Creates an instance of IStandardGraphModel.
virtual void RegisterAgent(IAgent *agent, IGraphController *controller)=0
Registers an agent for the specified controller. The agent will automatically start new experiences a...
Agents are used to track the performance of one instance of a network.
Definition: Agent.h:84
IGraph * graph
The graph this model interacts with.
Definition: GraphModel.h:64