operator.h
Go to the documentation of this file.
00001 #ifndef OPERATOR_H
00002 #define OPERATOR_H
00003 
00004 #include <cassert>
00005 #include <iostream>
00006 #include <string>
00007 #include <vector>
00008 #include <stdio.h>
00009 #include <math.h>
00010 
00011 #include "globals.h"
00012 #include "state.h"
00013 
00014 class Operator
00015 {
00016         vector<Prevail> prevail_start; // var, val
00017         vector<Prevail> prevail_overall; // var, val
00018         vector<Prevail> prevail_end; // var, val
00019         vector<PrePost> pre_post_start; // var, old-val, new-val
00020         vector<PrePost> pre_post_end; // var, old-val, new-val
00021         vector<ModuleEffect> mod_effs_start;
00022         vector<ModuleEffect> mod_effs_end;
00023         int duration_var;
00024         string name;
00025 
00026         bool deletesPrecond(const vector<Prevail>& conds,
00027                 const vector<PrePost>& effects) const;
00028         bool deletesPrecond(const vector<PrePost>& effs1,
00029                 const vector<PrePost>& effs2) const;
00030         bool achievesPrecond(const vector<PrePost>& effects, const vector<
00031                 Prevail>& conds) const;
00032         bool achievesPrecond(const vector<PrePost>& effs1,
00033                 const vector<PrePost>& effs2) const;
00034         bool writesOnSameVar(const vector<PrePost>& conds,
00035                 const vector<PrePost>& effects) const;
00036 
00037         void sort_prevails(vector<Prevail> &prevails);
00038     public:
00039         Operator(std::istream &in);
00040         explicit Operator(bool uses_concrete_time_information);
00041         void dump() const;
00042         const vector<Prevail> &get_prevail_start() const {
00043             return prevail_start;
00044         }
00045         const vector<Prevail> &get_prevail_overall() const {
00046             return prevail_overall;
00047         }
00048         const vector<Prevail> &get_prevail_end() const {
00049             return prevail_end;
00050         }
00051         const vector<PrePost> &get_pre_post_start() const {
00052             return pre_post_start;
00053         }
00054         const vector<PrePost> &get_pre_post_end() const {
00055             return pre_post_end;
00056         }
00057         const vector<ModuleEffect> &get_mod_effs_start() const {
00058             return mod_effs_start;
00059         }
00060         const vector<ModuleEffect> &get_mod_effs_end() const {
00061             return mod_effs_end;
00062         }
00063         const int &get_duration_var() const {
00064             return duration_var;
00065         }
00066         const string &get_name() const {
00067             return name;
00068         }
00069 
00070         bool operator<(const Operator &other) const;
00071 
00073 
00077         double get_duration(const TimeStampedState* state, bool relaxed = false) const;
00078 
00080 
00084         bool is_applicable(const TimeStampedState & state, bool allowRelaxed = false,
00085             TimedSymbolicStates* timedSymbolicStates = NULL) const;
00086 
00087         bool isDisabledBy(const Operator* other) const;
00088 
00089         bool enables(const Operator* other) const;
00090 
00091         virtual ~Operator()
00092         {
00093         }
00094 };
00095 
00096 class ScheduledOperator : public Operator
00097 {
00098     public:
00099         double time_increment;
00100         ScheduledOperator(double t, const Operator& op) : Operator(op), time_increment(t)
00101         {
00102         }
00103         ScheduledOperator(double t) : Operator(true), time_increment(t)
00104         {
00105             if (time_increment >= HUGE_VAL) {
00106                 printf("WARNING: Created scheduled operator with time_increment %f\n", t);
00107             }
00108         }
00109 };
00110 
00111 #endif


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