GeneralLinearCombiner.h
Go to the documentation of this file.00001 #ifndef CGENERALLINEARCOMBINER_H
00002 #define CGENERALLINEARCOMBINER_H
00003 #include <vector>
00004 #include <boost/shared_ptr.hpp>
00005
00006 namespace gplib
00007 {
00008 class GeneralNeuron;
00009
00010
00011
00012
00013
00014
00015
00016
00017 class GeneralLinearCombiner
00018 {
00019 public:
00020 typedef std::vector<boost::shared_ptr<GeneralNeuron> > tinvector;
00021 private:
00022
00023 std::vector<double> Weights;
00024
00025 double Output;
00026
00027 tinvector Input;
00028
00029 double Bias;
00030
00031 bool wchanged;
00032
00033 bool bchanged;
00034
00035 bool cachedoutput;
00036 public:
00037
00038 void SetBias(const double b)
00039 {
00040 bchanged = true;
00041 Bias = b;
00042 }
00043
00044 double GetBias() const
00045 {
00046 return Bias;
00047 }
00048
00049 const std::vector<double> &GetWeights() const
00050 {
00051 return Weights;
00052 }
00053
00054 std::vector<double> &SetWeights()
00055 {
00056 wchanged = true;
00057 return Weights;
00058 }
00059
00060 virtual double CalcOutput();
00061
00062 virtual void SetInput(const tinvector &LocalInput);
00063
00064 const tinvector &GetInput() const
00065 {
00066 return Input;
00067 }
00068 explicit GeneralLinearCombiner(bool wantcached = false);
00069 virtual ~GeneralLinearCombiner();
00070 };
00071
00072 }
00073 #endif // CGENERALLINEARCOMBINER_H