OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FCMemory.h
Go to the documentation of this file.
1 /*
2  * FCMemory.h
3  *
4  * Copyright (C) 2014 Misgana Bayetta
5  *
6  * Author: Misgana Bayetta <misgana.bayetta@gmail.com> 2015
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Affero General Public License v3 as
10  * published by the Free Software Foundation and including the exceptions
11  * at http://opencog.org/wiki/Licenses
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with this program; if not, write to:
20  * Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 #ifndef FCMEMORY_H_
24 #define FCMEMORY_H_
25 
28 
29 namespace opencog {
30 
31 struct Inference {
32  int iter_step;
36 };
37 
38 class FCMemory {
39 private:
41  vector<Rule*> _rules; /*<loaded rules*/
44 
45  HandleSeq _selected_sources; /*<selected sources on each forward chaining steps*/
46  HandleSeq _potential_sources; /*<list of inference products and premises to select source from*/
47  vector<Inference> _inf_history; /*<inference history*/
48 
50 public:
51  FCMemory(AtomSpace* as);
52  ~FCMemory();
53 
54  //Rules
55  vector<Rule*>& get_rules();
56  void set_rules(const vector<Rule*>& rules);
57 
58  // Quick hack to have the new UREConfigReader compatible with
59  // FCMemory. Warning: don't destroy that container as FCMemory
60  // isn't gonna make a copy of it.
61  void set_rules(vector<Rule>& rules);
62 
63  Rule* get_cur_rule();
64  void set_cur_rule(Rule* r);
65 
66  //Source
67  void set_source(Handle source);
70 
71  //Potential sources
75  Handle get_cur_source(void);
76 
77  //Attentional focus flag
78  void set_search_in_af(bool val);
79  bool is_search_in_af();
80 
81  //History
82  void add_rules_product(int iteration, HandleSeq product);
83  void add_inference(int iteration, HandleSeq product,
84  HandleSeq matched_nodes);
85  vector<Inference>& get_inf_history();
87  vector<Rule*> get_applied_rules(void);
88 
89 };
90 
91 } // ~namespace opencog
92 
93 #endif /* FCMEMORY_H_ */
HandleSeq get_potential_sources(void)
Definition: FCMemory.cc:74
void add_rules_product(int iteration, HandleSeq product)
Definition: FCMemory.cc:99
FCMemory(AtomSpace *as)
Definition: FCMemory.cc:29
HandleSeq matched_nodes
Definition: FCMemory.h:35
bool is_search_in_af()
Definition: FCMemory.cc:84
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
HandleSeq _selected_sources
Definition: FCMemory.h:45
vector< Rule * > get_applied_rules(void)
Definition: FCMemory.cc:170
Handle get_cur_source(void)
Definition: FCMemory.cc:123
Rule * applied_rule
Definition: FCMemory.h:33
Handle _cur_source
Definition: FCMemory.h:43
vector< Inference > _inf_history
Definition: FCMemory.h:47
Rule * _cur_rule
Definition: FCMemory.h:42
bool _search_in_af
Definition: FCMemory.h:40
vector< Inference > & get_inf_history()
Definition: FCMemory.cc:165
void set_rules(const vector< Rule * > &rules)
Definition: FCMemory.cc:51
bool isin_potential_sources(Handle h)
Definition: FCMemory.cc:133
bool isin_selected_sources(Handle h)
Definition: FCMemory.cc:128
HandleSeq get_selected_sources(void)
Definition: FCMemory.cc:69
vector< Rule * > _rules
Definition: FCMemory.h:41
void set_search_in_af(bool val)
Definition: FCMemory.cc:79
HandleSeq _potential_sources
Definition: FCMemory.h:46
void set_cur_rule(Rule *r)
Definition: FCMemory.cc:94
vector< Rule * > & get_rules()
Definition: FCMemory.cc:46
AtomSpace * _as
Definition: FCMemory.h:49
void update_potential_sources(HandleSeq input)
Definition: FCMemory.cc:38
Rule * get_cur_rule()
Definition: FCMemory.cc:89
void set_source(Handle source)
Definition: FCMemory.cc:63
HandleSeq inf_product
Definition: FCMemory.h:34
void add_inference(int iteration, HandleSeq product, HandleSeq matched_nodes)
Definition: FCMemory.cc:110
HandleSeq get_result()
Definition: FCMemory.cc:157