opencog::pln::ForwardChainer Class Reference

#include <ForwardChainer.h>

Collaboration diagram for opencog::pln::ForwardChainer:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ForwardChainer ()
 ~ForwardChainer ()
int fillStack (int number=FWD_CHAIN_MAX_FILL, bool random=false)
pHandleSeq fwdChainSeed (pHandle h, int maxRuleApps=1)
Handle fwdChainToTarget (Handle target=Handle::UNDEFINED, int maxRuleApps=FWD_CHAIN_MAX_APPS)
pHandleSeq fwdChainStack (int maxRuleApps=FWD_CHAIN_MAX_APPS)
pHandle getRandomArgument (const std::vector< Vertex > &args)
 Get a random handle from the seed stack or global atomspace.
RandGengetRNG ()
pHandleSeq getLocalLink (pHandle lh, const std::vector< Vertex > &args)
void printVertexVectorHandles (std::vector< Vertex > hs)

Public Attributes

ForwardChainerRuleProvider rp
std::deque< pHandleseedStack
float minConfidence
 minimum confidence to accept a result or for using an atom
float probStack
float probGlobal

Static Public Attributes

static RandGenrng = NULL


Detailed Description

Classes that manages forward chaining
Warning:
all Handles are PLN fake handles

Definition at line 40 of file ForwardChainer.h.


Constructor & Destructor Documentation

opencog::pln::ForwardChainer::ForwardChainer (  ) 

opencog::pln::ForwardChainer::~ForwardChainer (  ) 

Definition at line 45 of file ForwardChainer.cc.


Member Function Documentation

int opencog::pln::ForwardChainer::fillStack ( int  number = FWD_CHAIN_MAX_FILL,
bool  random = false 
)

In future perhaps support a higher chance for handles that have context specific information? Fill the seedStack with most important (high STI) atoms

Parameters:
max number of handles to put in stack
randomly add atoms instead of using importance
Returns:
actual number of handles put in stack

Definition at line 49 of file ForwardChainer.cc.

References GET_ASW, and seedStack.

pHandleSeq opencog::pln::ForwardChainer::fwdChainSeed ( pHandle  h,
int  maxRuleApps = 1 
)

Chain from a single seed Handle

Parameters:
maximum number of rule applications before ending
Returns:
return Handles that were created

Todo:
make link selection more efficient or exhaustive
Todo:
check rule for free input arity and then randomly

Todo:
sort based on strength and exponential random select

Definition at line 155 of file ForwardChainer.cc.

References opencog::pln::_v2h(), opencog::pln::Rule::compute(), GET_ASW, opencog::pln::Rule::getInputFilter(), getLocalLink(), getRNG(), opencog::pln::ForwardChainerRuleProvider::getSeedIndex(), minConfidence, opencog::pln::Rule::name, opencog::pln::ForwardChainerRuleProvider::nextRule(), NMPrinter::print(), printVertexVectorHandles(), opencog::RandGen::randfloat(), rp, opencog::pln::ForwardChainerRuleProvider::setSeed(), and opencog::pln::Rule::validate().

Here is the caller graph for this function:

Handle opencog::pln::ForwardChainer::fwdChainToTarget ( Handle  target = Handle::UNDEFINED,
int  maxRuleApps = FWD_CHAIN_MAX_APPS 
)

Chain to specific target

Parameters:
target Handle
maximum number of rule applications before ending
whether target was reached

Todo:
Do some intelligent stuff here until the target is reached.

Definition at line 68 of file ForwardChainer.cc.

References opencog::Handle::UNDEFINED.

pHandleSeq opencog::pln::ForwardChainer::fwdChainStack ( int  maxRuleApps = FWD_CHAIN_MAX_APPS  ) 

Chain till (current) entire stack has been processed

Parameters:
maximum number of rule applications before ending
Returns:
return Handles that were created

Definition at line 248 of file ForwardChainer.cc.

References fwdChainSeed(), NMPrinter::print(), and seedStack.

Here is the caller graph for this function:

pHandle opencog::pln::ForwardChainer::getRandomArgument ( const std::vector< Vertex > &  args  ) 

Get a random handle from the seed stack or global atomspace.

Definition at line 84 of file ForwardChainer.cc.

References opencog::pln::counter, opencog::Logger::error(), GET_ASW, getRNG(), opencog::logger(), PHANDLE_UNDEFINED, probStack, opencog::RandGen::randfloat(), seedStack, and v.

RandGen * opencog::pln::ForwardChainer::getRNG (  ) 

Definition at line 78 of file ForwardChainer.cc.

References rng.

Here is the caller graph for this function:

pHandleSeq opencog::pln::ForwardChainer::getLocalLink ( pHandle  lh,
const std::vector< Vertex > &  args 
)

void opencog::pln::ForwardChainer::printVertexVectorHandles ( std::vector< Vertex hs  ) 

Definition at line 140 of file ForwardChainer.cc.

References v.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 48 of file ForwardChainer.h.

Rules that have yet to be attempted for forward chaining on seed handle. Consists of all rules at the beginning.

Definition at line 52 of file ForwardChainer.h.

minimum confidence to accept a result or for using an atom

Definition at line 55 of file ForwardChainer.h.

Definition at line 56 of file ForwardChainer.h.

Definition at line 57 of file ForwardChainer.h.

Definition at line 86 of file ForwardChainer.h.


The documentation for this class was generated from the following files:

Generated on Fri Dec 4 23:24:52 2009 for OpenCog Framework by  doxygen 1.5.6