OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DefaultForwardChainerCB.h
Go to the documentation of this file.
1 /*
2  * DefaultForwardChainerCB.h
3  *
4  * Copyright (C) 2015 Misgana Bayetta
5  *
6  * Author: Misgana Bayetta <misgana.bayetta@gmail.com>
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 
24 #ifndef DEFAULTFORWARDCHAINERCB_H_
25 #define DEFAULTFORWARDCHAINERCB_H_
26 
28 #include "ForwardChainerCallBack.h"
29 
30 class DefaultForwardChainerCBUTest;
31 
32 namespace opencog
33 {
34 class FCMemory;
35 class Rule;
37 private:
38  friend class ::DefaultForwardChainerCBUTest;
42 
43  Handle gen_sub_varlist(const Handle& parent, const Handle& parent_varlist);
44  HandleSeq unify(Handle source,Handle target,Rule* rule);
45  HandleSeq subatom_unify(Handle source,Rule* rule);
46  bool is_valid_implicant(const Handle& h);
47 
48 public:
49  HandleSeq substitute_rule_part(AtomSpace& as, Handle hrule,const std::set<Handle>& vars,const std::vector<std::map<Handle,Handle>>& var_groundings);
52 
53  //callbacks
54  virtual vector<Rule*> choose_rules(FCMemory& fcmem);
55  virtual HandleSeq choose_premises(FCMemory& fcmem);
56  virtual Handle choose_next_source(FCMemory& fcmem);
57  virtual HandleSeq apply_rule(FCMemory& fcmem);
58 
59  // new_rules formed by substituting source to matching implicant
60  std::map<Handle,std::vector<Handle> > rule_derivations;
61 };
62 
63 } // ~namespace opencog
64 
65 #endif /* DEFAULTFORWARDCHAINERCB_H_ */
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
DefaultForwardChainerCB(AtomSpace &as, source_selection_mode ts_mode=TV_FITNESS_BASED)
virtual HandleSeq choose_premises(FCMemory &fcmem)
HandleSeq unify(Handle source, Handle target, Rule *rule)
HandleSeq subatom_unify(Handle source, Rule *rule)
virtual Handle choose_next_source(FCMemory &fcmem)
Handle gen_sub_varlist(const Handle &parent, const Handle &parent_varlist)
HandleSeq substitute_rule_part(AtomSpace &as, Handle hrule, const std::set< Handle > &vars, const std::vector< std::map< Handle, Handle >> &var_groundings)
virtual vector< Rule * > choose_rules(FCMemory &fcmem)
std::map< Handle, std::vector< Handle > > rule_derivations
virtual HandleSeq apply_rule(FCMemory &fcmem)