OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <URECommons.h>
Public Member Functions | |
URECommons (AtomSpace &as) | |
Handle | create_bindLink (Handle himplicant, bool is_quoted=false) throw (opencog::InvalidParamException) |
bool | exists_in (Handle &hlink, Handle &h) |
string | get_unique_name (Handle &h) |
Handle | replace_nodes_with_varnode (Handle &himplication_link, Type t=VARIABLE_NODE) |
Handle | change_node_types (Handle &h, map< Handle, Handle > &replacement_map) |
void | get_root_links (Handle h, HandleSeq &parents) |
template<class Type > | |
Type | tournament_select (map< Type, float > tfitnes_map) |
float | tv_fitness (Handle h) |
Public Attributes | |
const float | FITNESS_PARAM = 0.9 |
Private Attributes | |
AtomSpace & | _as |
Reusable functions in the PLN module
Definition at line 40 of file URECommons.h.
URECommons::URECommons | ( | AtomSpace & | as | ) |
Definition at line 31 of file URECommons.cc.
create a copy of the handle with a different variable name passed in
var_uniq_var | map input |
Definition at line 106 of file URECommons.cc.
References _as, opencog::AtomSpace::add_link(), opencog::AtomSpace::get_outgoing(), opencog::AtomSpace::get_TV(), opencog::AtomSpace::get_type(), opencog::LinkCast(), opencog::NodeCast(), and opencog::Atom::setTruthValue().
Handle URECommons::create_bindLink | ( | Handle | himplicant, |
bool | is_quoted = false |
||
) | |||
throw | ( | opencog::InvalidParamException | |
) |
creates a BindLink instance that could be passed to to PatternMatching module
himplicant | - an implicant part of the BindLink must have a variable node. |
Definition at line 33 of file URECommons.cc.
References opencog::get_outgoing_nodes(), and opencog::LinkCast().
checks if a handle already exists in a HandleSeq
Definition at line 86 of file URECommons.cc.
References _as, opencog::AtomSpace::get_outgoing(), and opencog::LinkCast().
Get top level parent of the handle
Definition at line 134 of file URECommons.cc.
References _as, and opencog::AtomSpace::get_incoming().
string URECommons::get_unique_name | ( | Handle & | h | ) |
Definition at line 76 of file URECommons.cc.
References _as, opencog::AtomSpace::get_incoming(), and opencog::AtomSpace::get_name().
Handle URECommons::replace_nodes_with_varnode | ( | Handle & | himplication_link, |
Type | t = VARIABLE_NODE |
||
) |
create a copy of the given implicatoin link with unique variables
Definition at line 62 of file URECommons.cc.
References _as, opencog::AtomSpace::add_node(), change_node_types(), opencog::get_outgoing_nodes(), and get_unique_name().
|
inline |
Randomly pick about half of the elements, and amongst those return the fittest (higher is better). If tfitness_map is empty, then return the default value (build with Type()).
Definition at line 91 of file URECommons.h.
float URECommons::tv_fitness | ( | Handle | h | ) |
Calculates fitness values in source_list_atom_space (or target_list_atom_space for the BC) using the formula
F = s^x * c^(2-x)
where s is strength,c is confidence and x is some fixed value
h | - a handle |
Definition at line 151 of file URECommons.cc.
References _as, FITNESS_PARAM, and opencog::AtomSpace::get_TV().
|
private |
Definition at line 41 of file URECommons.h.
const float opencog::URECommons::FITNESS_PARAM = 0.9 |
Definition at line 44 of file URECommons.h.