NeuralEngine A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes. |

FgIFactorNode.h
1
11#pragma once
12
13#include <MachineLearning/FgIVariableNode.h>
14#include <MachineLearning/FgIMessage.h>
15
16 namespace NeuralEngine
17{
18 namespace MachineLearning
19 {
20 class NE_IMPEXP IFactorNode : public INode
21 {
22 public:
23
31 IFactorNode(IVariableNode &node);
32
41 IFactorNode(IVariableNode &node, std::string name);
42
51 template<class T>
52 IFactorNode(std::vector<T*> nodes, std::string name)
53 : INode(name)
54 {
55 for (int i = 0; i < nodes.size(); i++)
56 mNodes.insert(std::make_pair(nodes[i]->Name(), nodes[i]));
57 }
58
66 template<class T>
67 IFactorNode(std::vector<T*> nodes)
68 : IFactorNode(nodes, CreateName(nodes)) {}
69
75 ~IFactorNode();
76
86 virtual bool IsSupported(MsgType type) = 0;
87
88 protected:
101 virtual IMessage ComputeMessage(std::string toNodeName, MsgBox &neededMessages) = 0;
102
103 private:
104
114 template<class T>
115 std::string CreateName(std::vector<T*> &nodes)
116 {
117 std::string name = "P";
118 for (int i = 0; i < nodes.size(); i++)
119 name += "_" + nodes[i]->Name();
120
121 return name;
122 }
123
124 friend class boost::serialization::access;
125
126 template<class Archive>
127 void serialize(Archive& ar, unsigned int version)
128 {
129 ar & boost::serialization::base_object<INode>(*this);
130 //ar & mNodes & sIncomming & sOutgoing & mMessageBox & sName & iId;
131 }
132 };
133 }
134}
NeuralEngine::MachineLearning::IFactorNode
Definition: FgIFactorNode.h:21
NeuralEngine::MachineLearning::IFactorNode::IFactorNode
IFactorNode(IVariableNode &node)
Constructor.
NeuralEngine::MachineLearning::IFactorNode::IFactorNode
IFactorNode(std::vector< T * > nodes)
Constructor.
Definition: FgIFactorNode.h:67
NeuralEngine::MachineLearning::IFactorNode::IsSupported
virtual bool IsSupported(MsgType type)=0
Query if message type is supported.
NeuralEngine::MachineLearning::IFactorNode::IFactorNode
IFactorNode(std::vector< T * > nodes, std::string name)
Constructor.
Definition: FgIFactorNode.h:52
NeuralEngine::MachineLearning::IFactorNode::ComputeMessage
virtual IMessage ComputeMessage(std::string toNodeName, MsgBox &neededMessages)=0
Calculates a message to connectd node.
NeuralEngine::MachineLearning::IFactorNode::IFactorNode
IFactorNode(IVariableNode &node, std::string name)
Constructor.
NeuralEngine::MachineLearning::IFactorNode::~IFactorNode
~IFactorNode()
Destructor.
NeuralEngine::MachineLearning::IFactorNode::CreateName
std::string CreateName(std::vector< T * > &nodes)
Creates a name for the node, if no name is given.
Definition: FgIFactorNode.h:115
NeuralEngine::MachineLearning::IMessage
Definition: FgIMessage.h:27
NeuralEngine::MachineLearning::INode
Base Class INode.
Definition: FgINode.h:34
NeuralEngine::MachineLearning::IVariableNode
Definition: FgIVariableNode.h:21
NeuralEngine
Definition: NeArray2.h:18