OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <AttentionBank.h>
Public Member Functions | |
AttentionBank (AtomTable &) | |
~AttentionBank () | |
void | shutdown (void) |
AFCHSigl & | AddAFSignal () |
AFCHSigl & | RemoveAFSignal () |
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 |
Definition at line 47 of file AttentionBank.h.
AttentionBank::AttentionBank | ( | AtomTable & | atab | ) |
The table notifies us about AV changes
Definition at line 33 of file AttentionBank.cc.
References attentionalFocusBoundary, AVChanged(), AVChangedConnection, opencog::AtomTable::AVChangedSignal(), fundsLTI, fundsSTI, startingFundsLTI, and startingFundsSTI.
AttentionBank::~AttentionBank | ( | ) |
Definition at line 53 of file AttentionBank.cc.
|
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.
|
private |
Definition at line 56 of file AttentionBank.cc.
References AddAFSignal(), attentionalFocusBoundary, fundsSTI, RemoveAFSignal(), updateLTIFunds(), and updateSTIFunds().
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.
Definition at line 153 of file AttentionBank.cc.
References attentionalFocusBoundary.
long AttentionBank::getLTIFunds | ( | ) | const |
Get the LTI funds available in the AtomSpace pool.
Definition at line 101 of file AttentionBank.cc.
References fundsLTI, and lock_funds.
AttentionValue::sti_t AttentionBank::getMaxSTI | ( | bool | average = true | ) | const |
Get the maximum STI observed in the AtomSpace.
average | If true, return an exponentially decaying average of maximum STI, otherwise return the actual maximum. |
Definition at line 133 of file AttentionBank.cc.
References lock_maxSTI, and maxSTI.
AttentionValue::sti_t AttentionBank::getMinSTI | ( | bool | average = true | ) | const |
Get the minimum STI observed in the AtomSpace.
average | If true, return an exponentially decaying average of minimum STI, otherwise return the actual maximum. |
Definition at line 143 of file AttentionBank.cc.
References lock_minSTI, and minSTI.
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.
h | The attention value holder to get STI for |
average | Should the recent average max/min STI be used, or the exact min/max? |
clip | Should the returned value be clipped to -1..1? Outside this range can be return if average=true |
Definition at line 164 of file AttentionBank.cc.
References getAttentionalFocusBoundary(), getMaxSTI(), and getMinSTI().
float AttentionBank::getNormalisedSTI | ( | AttentionValuePtr | av | ) | const |
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.
h | The attention value holder to get STI for |
average | Should the recent average max/min STI be used, or the exact min/max? |
clip | Should the returned value be clipped to 0..1? Outside this range can be return if average=true |
Definition at line 199 of file AttentionBank.cc.
References getMaxSTI(), and getMinSTI().
long AttentionBank::getSTIFunds | ( | ) | const |
Get the STI funds available in the AtomSpace pool.
Definition at line 95 of file AttentionBank.cc.
References fundsSTI, and lock_funds.
long AttentionBank::getTotalLTI | ( | ) | const |
Get the total amount of LTI in the AtomSpace, sum of all LTI across atoms.
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.
Definition at line 83 of file AttentionBank.cc.
References fundsSTI, lock_funds, and startingFundsSTI.
|
inline |
Definition at line 91 of file AttentionBank.h.
References _RemoveAFSignal.
AttentionValue::sti_t AttentionBank::setAttentionalFocusBoundary | ( | AttentionValue::sti_t | s | ) |
Change the attentional focus boundary. Some situations may benefit from less focussed searches.
s | New threshold |
Definition at line 158 of file AttentionBank.cc.
References attentionalFocusBoundary.
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.
long AttentionBank::updateLTIFunds | ( | AttentionValue::lti_t | diff | ) |
Definition at line 114 of file AttentionBank.cc.
References fundsLTI, and lock_funds.
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.
m | New maximum STI |
Definition at line 121 of file AttentionBank.cc.
References lock_maxSTI, and maxSTI.
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.
m | New minimum STI |
Definition at line 127 of file AttentionBank.cc.
References lock_minSTI, and minSTI.
long AttentionBank::updateSTIFunds | ( | AttentionValue::sti_t | diff | ) |
Definition at line 107 of file AttentionBank.cc.
References fundsSTI, and lock_funds.
|
private |
Signal emitted when an atom crosses in or out of the AttentionalFocus
Definition at line 61 of file AttentionBank.h.
|
private |
Definition at line 62 of file AttentionBank.h.
|
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.
|
private |
The connection by which we are notified of AV changes
Definition at line 50 of file AttentionBank.h.
|
private |
Definition at line 73 of file AttentionBank.h.
|
private |
Definition at line 72 of file AttentionBank.h.
|
mutableprivate |
Definition at line 78 of file AttentionBank.h.
|
mutableprivate |
Definition at line 67 of file AttentionBank.h.
|
mutableprivate |
Definition at line 68 of file AttentionBank.h.
|
private |
Definition at line 64 of file AttentionBank.h.
|
private |
Definition at line 65 of file AttentionBank.h.
|
private |
Definition at line 76 of file AttentionBank.h.
|
private |
Definition at line 75 of file AttentionBank.h.