BioinstSim  2
 All Classes Functions Variables
lineqinrobotagent.h
1 #ifndef LINEQINROBOTAGENT_H
2 #define LINEQINROBOTAGENT_H
3 
4 /******************************************************************************/
5 /******************************************************************************/
6 #include <assert.h>
7 #include <limits.h>
8 #include <math.h>
9 #include "arguments.h"
10 #include "featurevector.h"
11 #include "random.h"
12 #include "robotagent.h"
13 
14 /******************************************************************************/
15 /******************************************************************************/
16 
17 #define ACTIVATIONLOWERBOUND 1.0e-6 //todo: set as percentage instead of absolute value
18 
19 /******************************************************************************/
20 /******************************************************************************/
21 
22 class LINEQinRobotAgent;
23 
24 /******************************************************************************/
25 /******************************************************************************/
26 
27 class CRobotAgent;
28 
29 /******************************************************************************/
30 /******************************************************************************/
31 
33 {
34 public:
35  LINEQinRobotAgent(CRobotAgent* ptr_robotAgent, CArguments* m_lineqArguments);
36 
37  virtual ~LINEQinRobotAgent();
38 
39  virtual double GetLineqFV(unsigned index);
40  virtual void SetLineqFV(unsigned index, double f_hn);
41 
42  virtual double GetAPC(unsigned apctype);
43 
44  virtual double GetFVtoApcScaling();
45 
46  virtual void PrintLINEQDetails(unsigned id);
47 
48  virtual void SimulationStepUpdatePosition();
49 
50  static unsigned int GetNumberOfSetBits(unsigned int x);
51 
52 protected:
53 
54  CRobotAgent* robotAgent;
55 
56  static double NormalizedAffinity(unsigned int v1, unsigned int v2);
57  static double NegExpDistAffinity(unsigned int v1, unsigned int v2, double k);
58  double GetAf(unsigned int v1, unsigned int v2);
59 
60  virtual void UpdateState();
61 
62  virtual void Sense();
63 
64  virtual double GetWeight();
65 
66 
67 
68  double step_h; // internal step count of the LINEQ instance
69 
70  // For communication of hidden neuron activation levels between robots
71  double m_fTryExchangeProbability; // Probability of trying to exchange cells with other robots
72  //double m_fExchangeRange;
73 
74  double m_fMemory;
75  double m_fThreshold;
76 
77  double* m_pfLineqFV;
78  double* m_pfLineqFV_prev;
79 
80 
81 
82  double* m_pfAPCs;
83  //double** m_pfAffinities;
84  unsigned int m_unNumberOfReceptors;
85 
86  double m_fcross_affinity; /* the level of cross affinity*/
87  double m_fWeight;
88  double m_fFVtoApcscaling;
89 };
90 
91 /******************************************************************************/
92 /******************************************************************************/
93 
94 #endif // LINEQINROBOTAGENT_H