BioinstSim  2
 All Classes Functions Variables
robotagent.h
1 #ifndef ROBOTAGENT_H_
2 #define ROBOTAGENT_H_
3 
4 /******************************************************************************/
5 /******************************************************************************/
6 
7 class CRobotAgent;
8 
9 /******************************************************************************/
10 /******************************************************************************/
11 
12 class CRMinRobotAgent;
13 
14 /******************************************************************************/
15 /******************************************************************************/
16 
17 class CTRNNinRobotAgent;
18 
19 /******************************************************************************/
20 /******************************************************************************/
21 
22 class LINEQinRobotAgent;
23 
24 /******************************************************************************/
25 /******************************************************************************/
26 
27 
28 #include "common.h"
29 #include "agent.h"
30 #include "behavior.h"
31 #include "crminrobotagent.h"
32 #include "ctrnninrobotagent.h"
33 #include "lineqinrobotagent.h"
34 
35 /******************************************************************************/
36 /******************************************************************************/
37 
38 class CRobotAgent : public CAgent
39 {
40 public:
41  CRobotAgent(const char* pch_name, unsigned int un_identification, CArguments* pc_agent_arguments, CArguments* pc_model_arguments, TBehaviorVector vec_behaviors);
42  virtual ~CRobotAgent();
43 
44  // This method is called if the agent moves to a new arena square.
45  // Useful to calculate distances to other agents, update physical
46  // links etc.
47  virtual void SimulationStepUpdatePosition();
48  virtual void SetBehaviors(TBehaviorVector vec_behaviors);
49  virtual TBehaviorVector GetBehaviors();
50 
51  virtual EAgentType GetType();
52 
53  // Gets the number of feature vectors of different types
54  // into m_pfFeaturesSensed.
55  virtual float* GetFeaturesSensed() const;
56 
57  virtual CRobotAgent* GetRandomRobotWithWeights(double f_range);
58  virtual CRobotAgent* GetRandomRobotWithWeights(unsigned int u_nearestnbrs);
59 
60  virtual CRMinRobotAgent* GetCRMinRobotAgent();
61  virtual CTRNNinRobotAgent* GetCTRNNinRobotAgent();
62  virtual LINEQinRobotAgent* GetLINEQinRobotAgent();
63 
64  virtual void SetWeight(double f_weight);
65  virtual double GetWeight() const;
66  virtual const CFeatureVector* GetFeatureVector() const;
67  virtual void Sense(unsigned int u_nearestnbrs);
68  virtual void FVsOfWcFeature(const CFeatureVector* pc_feature_vector, unsigned int *fv1, unsigned int *fv2);
69  virtual double GetFVSenseRange() const;
70  virtual unsigned int GetColor();
71  virtual unsigned int GetSelectedNumNearestNbrs();
72 
73  virtual void SetMostWantedList(unsigned unFeatureVector, unsigned int state);
74  virtual unsigned int* GetMostWantedList();
75 
76  virtual void CheckNeighborsResponseToMyFV(unsigned int* pun_number_of_toleraters, unsigned int* pun_number_of_attackers, unsigned int* pun_number_of_unconverged, bool b_logs);
77 
78  virtual void PrintDecidingAgentDetails(CFeatureVector* m_pcFV, CRMinRobotAgent* model_crminagent, CTRNNinRobotAgent* model_ctrnninagent, LINEQinRobotAgent* model_lineqinagent, float* FeatureVectorsSensed);
79 
80  virtual unsigned int Attack(CFeatureVector* pc_feature_vector);
81 
82 protected:
83  virtual double CountWeightsInAgentListList(TAgentListList* ptlist_agent_list_list, double f_range);
84 
85  double m_fFVSenseRange;
86  CFeatureVector* m_pcFeatureVector;
87  TBehaviorVector m_vecBehaviors;
88  CRMinRobotAgent* crminAgent;
89  CTRNNinRobotAgent* ctrnninAgent;
90  LINEQinRobotAgent* lineqinAgent;
91 
92  double m_fWeight;
93  double m_fBitflipProbabililty;
94 
95  float* m_pfFeaturesSensed; //2^n
96  unsigned int* m_pbMostWantedList; //2^n
97 
98  double m_fResponseRange;
99  unsigned int m_uSelectedNumNearestNbrs;
100 
101 };
102 
103 /******************************************************************************/
104 /******************************************************************************/
105 
106 #endif // ROBOTAGENT_H_
107 
108 /******************************************************************************/
109 /******************************************************************************/