Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

AILogic Class Reference

#include <AILogic.h>

List of all members.

Public Member Functions

 AILogic (AI_LOGIC_IDS LOGICID_, const int rulesmax_=-1)
AI_LOGIC_IDS getLOGICID () const
bool createDerivationRule (std::vector< AIPremise > theantecedents_, std::vector< int > num_of_params_in_antecs_to_check_, int consequentstateinput_, std::vector< int > timesfound_=std::vector< int >(), std::vector< bool > accept_only_new_since_state_change_=std::vector< bool >(), std::vector< float > secondsold_=std::vector< float >(), std::vector< AIPremise > consekbprems_=std::vector< AIPremise >(), std::vector< AIPremise > remkbprems_=std::vector< AIPremise >(), std::vector< bool > remall_=std::vector< bool >())
bool performLogic (AIState *&state_, AIKB *&kb_, AIFSM *&fsm_, float &timestamp_, bool includeglobalkb_=false)
 returns true if state_ changed, false otherwise

int serialize (std::ofstream &fout_) const
int assemble (std::ifstream &fin_)


Detailed Description

AILogic implements state transitions for AIWrapped objects. Specifically, it converts AIExceptions from an AIKB into state inputs according to predefined rules.


Constructor & Destructor Documentation

AILogic::AILogic AI_LOGIC_IDS  LOGICID_,
const int  rulesmax_ = -1
 

parameterized constructor

Parameters:
LOGICID_ the unique identifier for this logic processor
rulesmax_ -1 means an unlimited # of rules are allowed


Member Function Documentation

int AILogic::assemble std::ifstream &  fin_  ) 
 

assigns this object to one read from a binary file and returns the number of bytes read

Parameters:
fin_ the file stream to read from (opened for binary input)
See also:
serialize()

bool AILogic::createDerivationRule std::vector< AIPremise theantecedents_,
std::vector< int >  num_of_params_in_antecs_to_check_,
int  consequentstateinput_,
std::vector< int >  timesfound_ = std::vector< int >(),
std::vector< bool >  accept_only_new_since_state_change_ = std::vector< bool >(),
std::vector< float >  secondsold_ = std::vector< float >(),
std::vector< AIPremise consekbprems_ = std::vector< AIPremise >(),
std::vector< AIPremise remkbprems_ = std::vector< AIPremise >(),
std::vector< bool >  remall_ = std::vector< bool >()
 

a rule has this format: IF (antecedent1 AND antecedent2 AND ...), THEN (return the consequent state input, possibly add premises to the object's knowledge base, and possibly remove premises from the object's knowledge base)

Parameters:
theantecedents_ an antecedent is defined as an AIPremise plus other parameters such as allowing for the premise to expire
num_of_params_in_antecs_to_check_ the premise ID (params[0]) counts toward this number
consequentstateinput_ the input to send to the finite state machine if all antecedents are true
timesfound_ check for AT LEAST this many instances of the premise for the antecedent to be true (default will be once/prem)
accept_only_new_since_state_change_ if true, premises inserted into the AIKB before the last state change are ignored
secondsold_ premises in the AIKB older than this are ignored (-1 means that none expire)
consekbprems_ premises added to an object's knowledge base if all antecedents are true
remkbprems_ premises removed from an object's knowledge base if all antecedents are true
remall_ remove all instances of the remkbprems_ if they are found?

AI_LOGIC_IDS AILogic::getLOGICID  )  const [inline]
 

returns the LOGICID for this logic processor

bool AILogic::performLogic AIState *&  state_,
AIKB *&  kb_,
AIFSM *&  fsm_,
float &  timestamp_,
bool  includeglobalkb_ = false
 

returns true if state_ changed, false otherwise

changes a state according to AIRules

Parameters:
state_ the current state
kb_ the AIKB to use for finding AIExceptions
fsm_ (not currently used)
timestamp_ timestamp of last state change (updated if state is changed in this function)
includeglobalkb_ use the global AIKB?

int AILogic::serialize std::ofstream &  fout_  )  const
 

writes this object to a binary file and returns the number of bytes written

Parameters:
fout_ the file stream to write to (opened for binary output)
See also:
assemble()


The documentation for this class was generated from the following file:
Generated on Sun Apr 11 05:05:56 2004 for FSM_API by doxygen 1.3.6