GAMS  1.4.0
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:
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 
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 
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:
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_
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
#define GAMS_EXPORT
Definition: GamsExport.h:20
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Base class for algorithm factories that classes derived from.
A helper class for algorithm information.
Definition: Executor.h:75
madara::knowledge::KnowledgeMap args
arguments to the algorithm
Definition: Executor.h:84
double max_time
maximum time to run the algorithm
Definition: Executor.h:87
std::string id
the id of the algorithm to create
Definition: Executor.h:81
std::string precond
a KaRL precondition
Definition: Executor.h:78
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:95
A factory class for creating Executor algorithms.
Definition: Executor.h:175
virtual BaseAlgorithm * create(const madara::knowledge::KnowledgeMap &args, madara::knowledge::KnowledgeBase *knowledge, platforms::BasePlatform *platform, variables::Sensors *sensors, variables::Self *self, variables::Agents *agents)
Creates an Executor Algorithm.
An algorithm capable of executing other algorithms.
Definition: Executor.h:97
BaseAlgorithm * current_
current executing algorithm
Definition: Executor.h:162
int cycles_
tracks the number of cycles completed through algorithms
Definition: Executor.h:159
virtual int analyze(void)
Analyzes environment, platform, or other information.
int repeat_
number of times to repeat
Definition: Executor.h:153
bool precond_met_
indicates if the precondition has been met for current algorithm
Definition: Executor.h:165
virtual int plan(void)
Plans the next execution.
virtual int execute(void)
Executes the next step.
size_t alg_index_
current algorithm
Definition: Executor.h:156
AlgorithmMetaDatas algorithms_
for keeping track of algorithms
Definition: Executor.h:150
Executor(AlgorithmMetaDatas algorithms, int repeat, madara::knowledge::KnowledgeBase *knowledge=0, platforms::BasePlatform *platform=0, variables::Sensors *sensors=0, variables::Self *self=0, variables::Agents *agents=0)
Constructor.
madara::utility::EpochEnforcer< std::chrono::steady_clock > enforcer_
enforcer for time
Definition: Executor.h:168
void operator=(Executor &rhs)
Assignment operator.
The base platform for all platforms to use.
Definition: BasePlatform.h:113
A container for self referencing information.
Definition: Self.h:70
std::vector< AlgorithmMetaData > AlgorithmMetaDatas
helper typdef for collection of AlgorithMetaData
Definition: Executor.h:91
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Contains all GAMS-related tools, classes and code.