00001 #ifndef IRI_RULE_LEARNER_TRANSITIONS_H 00002 #define IRI_RULE_LEARNER_TRANSITIONS_H 1 00003 00004 #include <iri_rule_learner/RuleLearnerConfig.h> 00005 #include <fstream> 00006 #include <symbols.h> 00007 #include <predicates.h> 00008 00009 00010 class Transition 00011 { 00012 public: 00013 std::string prev_state_, next_state_; 00014 Symbol action_; 00015 00016 Transition(std::string prev_state, Symbol action, std::string next_state) : 00017 prev_state_(prev_state), 00018 next_state_(next_state), 00019 action_(action) 00020 { } 00021 00022 bool is_continuation(std::string last_state) const { 00023 return (last_state == this->prev_state_); 00024 } 00025 00026 void remove_unused_predicates(); 00027 00028 friend std::ostream& operator<<(std::ostream &out, const Transition &s); 00029 }; 00030 00031 typedef std::vector<Transition> TransitionList; 00032 std::ostream& operator<<(std::ostream &out, const TransitionList &s); 00033 00034 // other 00035 TransitionList remove_unused_predicates(const TransitionList transitions); 00036 00037 // write/read to file 00038 void write_transitions_to_file(TransitionList transitions, std::string file_path); 00039 TransitionList read_transitions_from_file(std::string file_path); 00040 00041 #endif