GAMS  1.2.2
Executor.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ALGORITHMS_EXECUTOR_H_
55 #define _GAMS_ALGORITHMS_EXECUTOR_H_
56 
57 #include "gams/variables/Sensor.h"
61 #include "gams/variables/Self.h"
65 #include "madara/utility/EpochEnforcer.h"
66 
67 namespace gams
68 {
69  namespace algorithms
70  {
75  {
76  public:
78  std::string precond;
79 
81  std::string id;
82 
84  madara::knowledge::KnowledgeMap args;
85 
87  double max_time;
88  };
89 
91  typedef std::vector <AlgorithmMetaData> AlgorithmMetaDatas;
92 
97  {
98  public:
109  Executor (
110  AlgorithmMetaDatas algorithms,
111  int repeat,
112  madara::knowledge::KnowledgeBase * knowledge = 0,
113  platforms::BasePlatform * platform = 0,
114  variables::Sensors * sensors = 0,
115  variables::Self * self = 0,
116  variables::Agents * agents = 0);
117 
121  ~Executor ();
122 
127  void operator= (Executor & rhs);
128 
133  virtual int analyze (void);
134 
139  virtual int execute (void);
140 
145  virtual int plan (void);
146 
147  protected:
148 
150  AlgorithmMetaDatas algorithms_;
151 
153  int repeat_;
154 
156  size_t alg_index_;
157 
159  int cycles_;
160 
163 
166 
168  madara::utility::EpochEnforcer<std::chrono::steady_clock> enforcer_;
169  };
170 
175  {
176  public:
191  virtual BaseAlgorithm * create (
192  const madara::knowledge::KnowledgeMap & args,
193  madara::knowledge::KnowledgeBase * knowledge,
194  platforms::BasePlatform * platform,
195  variables::Sensors * sensors,
196  variables::Self * self,
197  variables::Agents * agents);
198  };
199  }
200 }
201 
202 #endif // _GAMS_ALGORITHMS_EXECUTOR_H_
Base class for algorithm factories that classes derived from.
Copyright (c) 2014 Carnegie Mellon University.
An algorithm capable of executing other algorithms.
Definition: Executor.h:96
int cycles_
tracks the number of cycles completed through algorithms
Definition: Executor.h:159
madara::utility::EpochEnforcer< std::chrono::steady_clock > enforcer_
enforcer for time
Definition: Executor.h:168
Copyright (c) 2014 Carnegie Mellon University.
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
A helper class for algorithm information.
Definition: Executor.h:74
BaseAlgorithm * current_
current executing algorithm
Definition: Executor.h:162
The base platform for all platforms to use.
Definition: BasePlatform.h:190
Copyright (c) 2014 Carnegie Mellon University.
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Copyright (c) 2014 Carnegie Mellon University.
int repeat_
number of times to repeat
Definition: Executor.h:153
double max_time
maximum time to run the algorithm
Definition: Executor.h:87
A factory class for creating Executor algorithms.
Definition: Executor.h:174
AlgorithmMetaDatas algorithms_
for keeping track of algorithms
Definition: Executor.h:150
Contains all GAMS-related tools, classes and code.
size_t alg_index_
current algorithm
Definition: Executor.h:156
A container for self referencing information.
Definition: Self.h:69
std::string id
the id of the algorithm to create
Definition: Executor.h:81
#define GAMS_EXPORT
Definition: GamsExport.h:20
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:94
Copyright (c) 2014 Carnegie Mellon University.
bool precond_met_
indicates if the precondition has been met for current algorithm
Definition: Executor.h:165
Copyright (c) 2014 Carnegie Mellon University.
madara::knowledge::KnowledgeMap args
arguments to the algorithm
Definition: Executor.h:84
Copyright (c) 2014 Carnegie Mellon University.
std::string precond
a KaRL precondition
Definition: Executor.h:78
std::vector< AlgorithmMetaData > AlgorithmMetaDatas
helper typdef for collection of AlgorithMetaData
Definition: Executor.h:91