Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

RecurrentNetwork.h

Go to the documentation of this file.
00001 
00005 #ifndef RECURRENTNETWORK_H
00006 #define RECURRENTNETWORK_H
00007 
00008 #include "Network.h"
00009 #include "InputLayer.h"
00010 #include "RecurrentNeuron.h"
00011 
00012 namespace annie {
00013 
00015 typedef TLayer<RecurrentNeuron> RecurrentLayer;
00016         
00027 
00028 //GeneticRN(list<VECTOR> genotype);
00029 
00030 class RecurrentNetwork : public Network {
00031 public:
00032     static const int INPUT_NEURONS_LABEL_OFFSET;
00037     RecurrentNetwork(uint initialInputCount=0, uint initialRecurrenCount=0);
00038 
00039     void addInput(real initialValue=0);
00040     void addInput(InputNeuron *in) { _inputs.addNeuron(in); }
00041 
00043     void addNeuron(real bias=0, real activation=0);
00044     void addNeuron(RecurrentNeuron *n) { _neurons.addNeuron(n); }
00045 
00047     virtual const char* getClassName() const { return "RecurrentNetwork"; }
00048 
00050     virtual uint getInputCount() const { return _inputs.size(); }
00051 
00053     virtual uint getOutputCount() const { return _neurons.size(); }
00054 
00059     virtual void setInput(const Vector &input);
00060 
00062     RecurrentNeuron &getNeuron(uint index) { return _neurons[index]; }
00063     RecurrentNeuron &operator[](uint index) { return getNeuron(index); }
00064     
00065     InputNeuron &getInputNeuron(uint index) { return _inputs[index]; };
00066 
00071     virtual void resetActivations(const Vector &activations);
00072 
00074     virtual void step();
00075     
00079     virtual real getNeuronOutput(uint neuron) { return _neurons[neuron].getOutput(); }
00080 
00084     virtual Vector getOutput() const;
00085 
00089     virtual Vector getOutput(const Vector &input);
00090 
00092     virtual void save(const std::string &filename) { throw Exception("Not implemented"); }
00093    protected:
00094     InputLayer _inputs;
00095     RecurrentLayer _neurons;
00096     uint _time; //TODO: is it good for something?
00097 };
00098 
00099 } //namespace annie
00100 #endif // _H

Generated on Fri Jun 18 13:18:10 2004 for Annie by doxygen 1.3.5