Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef NeuronalNetworkH
00033 #define NeuronalNetworkH
00034
00035 #include <zeusmath/Intel/Interfaces/INeuronalNetwork.hpp>
00036 #include <zeusmath/Intel/Interfaces/INeuronalNetworkObserver.hpp>
00037 #include <zeusmath/Intel/Neuron.hpp>
00038 #include <zeusbase/System/ArrayList.hpp>
00039 #include <zeusbase/System/SingleLinkedList.hpp>
00040 #include <zeusbase/System/ManagedList.hpp>
00041 #include <zeusbase/System/Map.hpp>
00042 #include <zeusbase/System/XMLFile.h>
00043
00044 BEGIN_NAMESPACE_Zeus
00045
00046
00050
00051 zeusmath_class TNeuronalNetwork : public TZObject, public INeuronalNetwork
00052 {
00053 public:
00054 TNeuronalNetwork();
00055
00056
00057 virtual Retval MQUALIFIER addHiddenLayer(Int iNeuronCount);
00058 virtual Retval MQUALIFIER createInputLayer(Int iNeuronCount);
00059 virtual Retval MQUALIFIER createOutputLayer(Int iNeuronCount);
00060 virtual void MQUALIFIER findFixed(const IList<bool>& rList);
00061 virtual Int MQUALIFIER getLayerCount() const;
00062 virtual void MQUALIFIER getOutputActivity(IList<bool>& rList) const;
00063 virtual void MQUALIFIER setInputActivity(const IList<bool>& rList);
00064 virtual void MQUALIFIER loadFromXML(const IString& rFileName);
00065 virtual void MQUALIFIER saveToXML();
00066
00067
00068 virtual Retval MQUALIFIER attach(IObserver& rObserver);
00069 virtual Retval MQUALIFIER detach(IObserver& rObserver);
00070
00071
00072 MEMORY_MANAGER_DECL
00073
00074 protected:
00075 virtual ~TNeuronalNetwork();
00076
00078
00079 inline virtual TNeuron& createNeuron(Uint uiID, Float fThreshold, Float fPotential)
00080 { return *new TNeuron(uiID, fThreshold, fPotential); }
00081
00082 inline virtual TNeuron& createNeuron()
00083 { return *new TNeuron(); }
00085
00086
00087 void fireLayer(Int iLayerIndex);
00088 void resetPotentials();
00089 void updateLayer(Int iLayerIndex);
00090 void createLayer(Int iLayerIndex, Int iNeuronCount);
00091
00092 typedef TManagedList<TNeuron> TNeuronList;
00093
00094 TSingleLinkedList<TNeuronList> m_lstLayers;
00095 TManagedList<INeuronalNetworkObserver> m_lstObserver;
00096
00097
00098 static void connectWithChance(TNeuronList& rSourceList,
00099 TNeuronList& rDestList,
00100 Int iSrcStart = -1,
00101 Int iSrcEnd = -1,
00102 Int iDestStart = -1,
00103 Int iDestEnd = -1,
00104 Float fChance = 1.0);
00105
00106 private:
00108 bool m_bNotifyObserver;
00110 TAutoPtr<TXMLFile> m_ptrDataFile;
00111
00112 void releaseInstances();
00113 };
00114
00115
00116
00119
00120 inline Int MQUALIFIER TNeuronalNetwork::getLayerCount() const
00121 {
00122 return m_lstLayers.getCount();
00123 }
00124
00125
00126 END_NAMESPACE_Zeus
00127
00128 #endif