OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
opencog::AttentionBank Class Reference

#include <AttentionBank.h>

Public Member Functions

 AttentionBank (AtomTable &)
 
 ~AttentionBank ()
 
void shutdown (void)
 
AFCHSiglAddAFSignal ()
 
AFCHSiglRemoveAFSignal ()
 
long getTotalSTI () const
 
long getTotalLTI () const
 
long getSTIFunds () const
 
long getLTIFunds () const
 
long updateSTIFunds (AttentionValue::sti_t diff)
 
long updateLTIFunds (AttentionValue::lti_t diff)
 
AttentionValue::sti_t getAttentionalFocusBoundary () const
 
AttentionValue::sti_t setAttentionalFocusBoundary (AttentionValue::sti_t s)
 
AttentionValue::sti_t getMaxSTI (bool average=true) const
 
AttentionValue::sti_t getMinSTI (bool average=true) const
 
void updateMinSTI (AttentionValue::sti_t m)
 
void updateMaxSTI (AttentionValue::sti_t m)
 
float getNormalisedSTI (AttentionValuePtr, bool average, bool clip) const
 
float getNormalisedSTI (AttentionValuePtr) const
 
float getNormalisedZeroToOneSTI (AttentionValuePtr, bool average, bool clip) const
 

Private Member Functions

void AVChanged (Handle, AttentionValuePtr, AttentionValuePtr)
 

Private Attributes

boost::signals2::connection AVChangedConnection
 
AttentionValue::sti_t attentionalFocusBoundary
 
AFCHSigl _AddAFSignal
 
AFCHSigl _RemoveAFSignal
 
opencog::recent_val
< AttentionValue::sti_t
maxSTI
 
opencog::recent_val
< AttentionValue::sti_t
minSTI
 
std::mutex lock_maxSTI
 
std::mutex lock_minSTI
 
long fundsSTI
 
long fundsLTI
 
long startingFundsSTI
 
long startingFundsLTI
 
std::mutex lock_funds
 

Detailed Description

Definition at line 47 of file AttentionBank.h.

Constructor & Destructor Documentation

AttentionBank::AttentionBank ( AtomTable atab)
AttentionBank::~AttentionBank ( )

Definition at line 53 of file AttentionBank.cc.

Member Function Documentation

AFCHSigl& opencog::AttentionBank::AddAFSignal ( )
inline

Provide ability for others to find out about atoms that cross in or out of the AttentionalFocus

Definition at line 90 of file AttentionBank.h.

References _AddAFSignal.

+ Here is the caller graph for this function:

void AttentionBank::AVChanged ( Handle  h,
AttentionValuePtr  old_av,
AttentionValuePtr  new_av 
)
private

Definition at line 56 of file AttentionBank.cc.

References AddAFSignal(), attentionalFocusBoundary, fundsSTI, RemoveAFSignal(), updateLTIFunds(), and updateSTIFunds().

+ Here is the caller graph for this function:

AttentionValue::sti_t AttentionBank::getAttentionalFocusBoundary ( ) const

Get attentional focus boundary, generally atoms below this threshold won't be accessed unless search methods are unsuccessful on those that are above this value.

Returns
Short Term Importance threshold value

Definition at line 153 of file AttentionBank.cc.

References attentionalFocusBoundary.

+ Here is the caller graph for this function:

long AttentionBank::getLTIFunds ( ) const

Get the LTI funds available in the AtomSpace pool.

Returns
LTI funds available

Definition at line 101 of file AttentionBank.cc.

References fundsLTI, and lock_funds.

+ Here is the caller graph for this function:

AttentionValue::sti_t AttentionBank::getMaxSTI ( bool  average = true) const

Get the maximum STI observed in the AtomSpace.

Parameters
averageIf true, return an exponentially decaying average of maximum STI, otherwise return the actual maximum.
Returns
Maximum STI

Definition at line 133 of file AttentionBank.cc.

References lock_maxSTI, and maxSTI.

+ Here is the caller graph for this function:

AttentionValue::sti_t AttentionBank::getMinSTI ( bool  average = true) const

Get the minimum STI observed in the AtomSpace.

Parameters
averageIf true, return an exponentially decaying average of minimum STI, otherwise return the actual maximum.
Returns
Minimum STI

Definition at line 143 of file AttentionBank.cc.

References lock_minSTI, and minSTI.

+ Here is the caller graph for this function:

float AttentionBank::getNormalisedSTI ( AttentionValuePtr  av,
bool  average,
bool  clip 
) const

Change the Very-Long-Term Importance of an attention value holder Retrieve the doubly normalised Short-Term Importance between -1..1 for a given AttentionValue. STI above and below threshold normalised separately and linearly.

Parameters
hThe attention value holder to get STI for
averageShould the recent average max/min STI be used, or the exact min/max?
clipShould the returned value be clipped to -1..1? Outside this range can be return if average=true
Returns
normalised STI between -1..1

Definition at line 164 of file AttentionBank.cc.

References getAttentionalFocusBoundary(), getMaxSTI(), and getMinSTI().

+ Here is the caller graph for this function:

float AttentionBank::getNormalisedSTI ( AttentionValuePtr  av) const
See Also
getNormalisedSTI()

Definition at line 190 of file AttentionBank.cc.

References getAttentionalFocusBoundary(), getMaxSTI(), and getMinSTI().

float AttentionBank::getNormalisedZeroToOneSTI ( AttentionValuePtr  av,
bool  average,
bool  clip 
) const

Retrieve the linearly normalised Short-Term Importance between 0..1 for a given AttentionValue.

Parameters
hThe attention value holder to get STI for
averageShould the recent average max/min STI be used, or the exact min/max?
clipShould the returned value be clipped to 0..1? Outside this range can be return if average=true
Returns
normalised STI between 0..1

Definition at line 199 of file AttentionBank.cc.

References getMaxSTI(), and getMinSTI().

+ Here is the caller graph for this function:

long AttentionBank::getSTIFunds ( ) const

Get the STI funds available in the AtomSpace pool.

Returns
STI funds available

Definition at line 95 of file AttentionBank.cc.

References fundsSTI, and lock_funds.

+ Here is the caller graph for this function:

long AttentionBank::getTotalLTI ( ) const

Get the total amount of LTI in the AtomSpace, sum of all LTI across atoms.

Returns
total LTI in AtomSpace

Definition at line 89 of file AttentionBank.cc.

References fundsLTI, lock_funds, and startingFundsLTI.

long AttentionBank::getTotalSTI ( ) const

Get the total amount of STI in the AtomSpace, sum of STI across all atoms.

Returns
total STI in AtomSpace

Definition at line 83 of file AttentionBank.cc.

References fundsSTI, lock_funds, and startingFundsSTI.

AFCHSigl& opencog::AttentionBank::RemoveAFSignal ( )
inline

Definition at line 91 of file AttentionBank.h.

References _RemoveAFSignal.

+ Here is the caller graph for this function:

AttentionValue::sti_t AttentionBank::setAttentionalFocusBoundary ( AttentionValue::sti_t  s)

Change the attentional focus boundary. Some situations may benefit from less focussed searches.

Parameters
sNew threshold
Returns
Short Term Importance threshold value

Definition at line 158 of file AttentionBank.cc.

References attentionalFocusBoundary.

+ Here is the caller graph for this function:

void AttentionBank::shutdown ( void  )

This must be called before the AtomTable is destroyed. Which means that it cannot be in the destructor (since the AtomTable is probably gone by then, leading to a crash. XXX FIXME yes this is a tacky hack to fix a design bug.

Definition at line 48 of file AttentionBank.cc.

References AVChangedConnection.

+ Here is the caller graph for this function:

long AttentionBank::updateLTIFunds ( AttentionValue::lti_t  diff)

Definition at line 114 of file AttentionBank.cc.

References fundsLTI, and lock_funds.

+ Here is the caller graph for this function:

void AttentionBank::updateMaxSTI ( AttentionValue::sti_t  m)

Update the maximum STI observed in the connected AtomSpace. Min/max are not updated on setSTI because average is calculate by lobe cycle, although this could potentially also be handled by the cogServer.

Warning
Should only be used by attention allocation system.
Parameters
mNew maximum STI

Definition at line 121 of file AttentionBank.cc.

References lock_maxSTI, and maxSTI.

+ Here is the caller graph for this function:

void AttentionBank::updateMinSTI ( AttentionValue::sti_t  m)

Update the minimum STI observed in the connected AtomSpace. Min/max are not updated on setSTI because average is calculate by lobe cycle, although this could potentially also be handled by the cogServer.

Warning
Should only be used by attention allocation system.
Parameters
mNew minimum STI

Definition at line 127 of file AttentionBank.cc.

References lock_minSTI, and minSTI.

+ Here is the caller graph for this function:

long AttentionBank::updateSTIFunds ( AttentionValue::sti_t  diff)

Definition at line 107 of file AttentionBank.cc.

References fundsSTI, and lock_funds.

+ Here is the caller graph for this function:

Member Data Documentation

AFCHSigl opencog::AttentionBank::_AddAFSignal
private

Signal emitted when an atom crosses in or out of the AttentionalFocus

Definition at line 61 of file AttentionBank.h.

AFCHSigl opencog::AttentionBank::_RemoveAFSignal
private

Definition at line 62 of file AttentionBank.h.

AttentionValue::sti_t opencog::AttentionBank::attentionalFocusBoundary
private

Boundary at which an atom is considered within the attentional focus of opencog. Atom's with STI less than this value are not charged STI rent

Definition at line 58 of file AttentionBank.h.

boost::signals2::connection opencog::AttentionBank::AVChangedConnection
private

The connection by which we are notified of AV changes

Definition at line 50 of file AttentionBank.h.

long opencog::AttentionBank::fundsLTI
private

Definition at line 73 of file AttentionBank.h.

long opencog::AttentionBank::fundsSTI
private

Definition at line 72 of file AttentionBank.h.

std::mutex opencog::AttentionBank::lock_funds
mutableprivate

Definition at line 78 of file AttentionBank.h.

std::mutex opencog::AttentionBank::lock_maxSTI
mutableprivate

Definition at line 67 of file AttentionBank.h.

std::mutex opencog::AttentionBank::lock_minSTI
mutableprivate

Definition at line 68 of file AttentionBank.h.

opencog::recent_val<AttentionValue::sti_t> opencog::AttentionBank::maxSTI
private

Definition at line 64 of file AttentionBank.h.

opencog::recent_val<AttentionValue::sti_t> opencog::AttentionBank::minSTI
private

Definition at line 65 of file AttentionBank.h.

long opencog::AttentionBank::startingFundsLTI
private

Definition at line 76 of file AttentionBank.h.

long opencog::AttentionBank::startingFundsSTI
private

Definition at line 75 of file AttentionBank.h.


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