globals.h
Go to the documentation of this file.
00001 #ifndef GLOBALS_H
00002 #define GLOBALS_H
00003 
00004 #include <iostream>
00005 #include <string>
00006 #include <vector>
00007 #include <set>
00008 #include <string>
00009 #include "module.h"
00010 #include <cmath>
00011 #include <limits>
00012 
00013 using namespace std;
00014 
00015 #define EPSILON 0.000001 // for comparing doubles
00016 #define EPS_TIME 0.001   // for separation of timepoints
00017 
00018 #include "causal_graph.h"
00019 
00020 class AxiomEvaluator;
00021 //class CausalGraph;
00022 class DomainTransitionGraph;
00023 class Operator;
00024 class Axiom;
00025 class LogicAxiom;
00026 class NumericAxiom;
00027 class TimeStampedState;
00028 class SuccessorGenerator;
00029 
00030 struct PlanStep
00031 {
00032     double start_time;
00033     double duration;
00034     const Operator* op;
00035     const TimeStampedState* pred;   
00036 
00037     PlanStep(double st, double dur, const Operator* o,
00038         const TimeStampedState* p) :
00039             start_time(st), duration(dur), op(o), pred(p)
00040     {
00041     }
00042 
00043         void dump() const;
00044 };
00045 
00046 typedef std::vector<PlanStep> Plan;
00047 typedef std::vector<TimeStampedState*> PlanTrace;
00048 
00049 inline bool double_equals(double a, double b)
00050 {
00051     return std::abs(a - b) < EPSILON;
00052 }
00053 
00054 const double REALLYBIG = numeric_limits<double>::max();
00055 const double REALLYSMALL = -numeric_limits<double>::max();
00056 
00057 void read_everything(istream &in);
00058 void dump_everything();
00059 void dump_DTGs();
00060 
00061 void check_magic(istream &in, string magic);
00062 
00063 enum variable_type
00064 {
00065     logical,
00066     primitive_functional,
00067     subterm_functional,
00068     comparison,
00069     module,
00070     costmodule
00071 };
00072 
00073 extern int g_last_arithmetic_axiom_layer;
00074 extern int g_comparison_axiom_layer;
00075 extern int g_first_logic_axiom_layer;
00076 extern int g_last_logic_axiom_layer;
00077 extern vector<string> g_variable_name;
00078 extern vector<int> g_variable_domain;
00079 extern vector<int> g_axiom_layers;
00080 extern vector<double> g_default_axiom_values;
00081 extern vector<variable_type> g_variable_types;
00082 extern TimeStampedState *g_initial_state;
00083 extern ObjectTypeMap g_objectTypes;
00084 extern vector<pair<int, double> > g_goal;
00085 extern vector<Operator> g_operators;
00086 extern vector<Axiom*> g_axioms;
00087 extern AxiomEvaluator *g_axiom_evaluator;
00088 extern SuccessorGenerator *g_successor_generator;
00089 extern vector<DomainTransitionGraph *> g_transition_graphs;
00090 extern CausalGraph *g_causal_graph;
00091 
00092 class PlannerParameters;
00093 extern PlannerParameters g_parameters;
00094 
00095 inline bool is_functional(int var)
00096 {
00097     const variable_type& vt = g_variable_types[var];
00098     return (vt == primitive_functional || vt == subterm_functional);
00099 }
00100 
00101 extern Operator *g_let_time_pass;
00102 extern Operator *g_wait_operator;
00103 
00104 enum assignment_op
00105 {
00106     assign = 0, scale_up = 1, scale_down = 2, increase = 3, decrease = 4
00107 };
00108 enum binary_op
00109 {
00110     add = 0,
00111     subtract = 1,
00112     mult = 2,
00113     divis = 3,
00114     lt = 4,
00115     le = 5,
00116     eq = 6,
00117     ge = 7,
00118     gt = 8,
00119     ue = 9
00120 };
00121 enum trans_type
00122 {
00123     start = 0, end = 1, compressed = 2, ax = 3
00124 };
00125 enum condition_type
00126 {
00127     start_cond = 0, overall_cond = 1, end_cond = 2, ax_cond
00128 };
00129 
00130 istream& operator>>(istream &is, assignment_op &aop);
00131 ostream& operator<<(ostream &os, const assignment_op &aop);
00132 
00133 istream& operator>>(istream &is, binary_op &bop);
00134 ostream& operator<<(ostream &os, const binary_op &bop);
00135 
00136 istream& operator>>(istream &is, trans_type &tt);
00137 ostream& operator<<(ostream &os, const trans_type &tt);
00138 
00139 istream& operator>>(istream &is, condition_type &fop);
00140 ostream& operator<<(ostream &os, const condition_type &fop);
00141 
00142 void printSet(const set<int> s);
00143 
00144 #endif


tfd_modules
Author(s): Maintained by Christian Dornhege (see AUTHORS file).
autogenerated on Mon Oct 6 2014 07:52:06