Buffer/Table

Introduction

A buffer is an information store. It is a place where information
can be put for later retrieval. Buffers are appropriate for both short
term storage (as in modelling working memory, for example) and long
term storage (as in large knowledge bases). They can be configured,
through sub-classes and properties, so as to behave in a variety of
different ways (allowing, for example, decay of elements or capacity
restrictions).

Table Buffers have specialised characteristics allowing them to
behave as two-dimensional tabular representations. Like Table Sinks, Table Buffers expect to
receive messages of the form:

data(Row, Col, Value)

Such messages are interpreted as indicating that the table entry indexed by
the values of Row and Col is Value. This new value
will supersede any previous value associated with Row and
Col.

Properties

The precise behaviour of a buffer is determined by the values of a number
of properties. Table buffers have extra access options permitting
Left->Right, Right->Left, Top->Bottom and
Bottom->Top access, similar to the access options in Analogue Buffers, and like propositional buffers, there are properties
controlling decay, capacity limitations and access order.
Tabular buffers have the following properties:

Initialise (possible values: Each Trial/Each Block/Each Subject/Each Experiment/Each Session;
default: Each Trial)
The timing of buffer initialisation is determined by this property. When the
value is Each Trial, the buffer will automatically initialise itself at the
beginning of each trial. When the value is Each Block, the buffer will
initialise itself at the beginning of each block of trials (i.e., contents
will be preserved across trials within a block). Similarly, when the value is
Each Subject, contents will be preserved across simulated blocks, when the
value is Each Experiment, contents will be preserved across simulated subjects
and when the value is Each Session, the contents will be preserved across
experiments.

Decay (possible values: None/Half-Life/Linear/Fixed; default:
None)
This property specifies whether the elements of a buffer decay with time, and
if so what pattern of decay is observed.
When the value is None, elements will remain in a buffer until they are either
explicitly deleted or are forced out by the buffer overflowing.
When the value is Half-Life, elements decay in a random fashion, but with the
probability of decay begin constant on each cycle. This probability is
specified in terms of a half life (specified by the Decay Constant property).
The half life is the number of cycles it takes on average for half of the
elements to decay.
When the value is Linear, elements decay in a probabilistic fashion, but with
the probability of an element decay increasing linearly with each cycle it
remains in the buffer. The maximum number of cycles an element can spend in
the buffer is given by the value of the Decay Constant property. (So if decay
is Linear and the decay constant is 10, the probability of an element decaying
on the first cycle will be 0.1, the probability of it decaying within two
cycles will be 0.2, and so on, with the probability of it decaying in 10
cycles being 1.0.)
When the value is Fixed, elements remain in the buffer for a fixed number of
cycles (specified by the Decay Constant property).

Decay Constant (possible values: 1 -- 9999; default: 20)
This property determines the decay rate if decay is specified for the buffer.
In the case of Half-Life decay, the constant specifies the half-life (in
cycles) of buffer elements. A larger number will result in a longer half-life
and so a slower decay. In the case of Linear decay, the constant specifies the
maximum number of cycles an element may remain in the buffer. In the case of
Fixed decay, the constant specifies the number of cycles an element will
remain present in the buffer after the element is added to the buffer
(provided it is not ``refreshed'' via Duplicates: No, as discussed above).
Again, a larger number will lead to slower decay.

Limited Capacity (possible values: on/off; default: off)
This property determines whether the buffer has limited or unlimited
capacity. If the value is Yes then the buffer's capacity is limited to the
value specified by the Capacity property, and its behaviour when that capacity
is exceeded is governed by the On Excess property; if the value is No, these
two properties are ignored.

Capacity (possible values: 1 -- 9999; default: 7)
This property specifies the capacity of a buffer in terms of the number of
items it may hold. If Limited Capacity is not selected, this property has no
effect.

On Excess (possible values: Random/Youngest/Oldest/Ignore; default:
Random)
The value of this property determines how the buffer behaves when its
capacity is exceeded. If the value is Random, then a random element will be
deleted from the buffer to make way for the new element. If the value is
Youngest, then the most recently added element will be deleted to make way for
the new element. If the value is Oldest, then the least recently added element
will be deleted to make way for the new element. If the value is Ignore, then
the new element will be discarded and the buffer contents will not be altered.
If Limited Capacity is not selected, this property has no effect.

Grounded (Boolean; default: TRUE)
If this property is set, attempts to add ungrounded terms (i.e., terms
containing variables) to the buffer will result in an error message. The
rationale for this property is that in most applications adding ungrounded
terms to a buffer is probably results from a bug in the model, so flagging
such occurrences is useful. In some applications, however, it may be
reasonable to have ungrounded terms in buffers (e.g., where the terms
represent production-like rules). In these cases, the property should
not be set.

Access (possible values: Random/FIFO/LIFO/Left->Right/Right->Left/Top->Bottom/Bottom->Top; default: Random)
This property dictates the order of access to a buffer's elements when the
buffer is ``matched''. If access is Random, then match will instantiate its
argument to an element from the buffer selected at random (provided that
element unifies with the argument of match). If access is FIFO (First In,
First Out), then match will return the oldest element which unifies with its
argument. If access is LIFO (Last In, First Out), then match will return the
youngest element which unifies with its argument. The directional options such
as Left->Right and Top->Bottom will return elements in orders dependent on the
Column and Row indices respectively, so for example, with a setting of
Top->Bottom, elements from the top of the table will be returned before those
from the bottom, and so on.

Column Label: (values: an arbitrary character string; default: "Columns")
The value of this property is used as the label for the table's columns when the table
is viewed in "Current Table" mode.

Row Label: (values: an arbitrary character string; default: "Rows")
The value of this property is used as the label for the table's rows when the table is
viewed in "Current Table" mode.

Cell Width: (values: a positive integer; default: 70)
The value of this property specifies the width of each column (in pixels) when the table
is viewed in "Current Table" mode.

Cell Height: (values: a positive integer: default: 25)
The value of this property specifies the height of each row (in pixels) when the table
is viewed in "Current Table" mode.

Sort (possible values: Alpha/Reverse Alpha/Primacy/Recency; default: Alpha)
This property is used when drawing the table to determine the order of
rows and columns. When it is set to Alpha, for example, rows
and columns are ordered alphabetically by row/column labels, whereas when
it is set to Primacy rows and columns are ordered with the first
created row/column at the top left, and the last created row/column at the
bottom right.

The Table View

Table Buffers may be viewed as tables by selecting the appropriate page on
their notebook. Each element is used to construct an entry within a row and
column labelled with the values of "Row" and "Col" for which the element was
specified. The standard printing procedures may be used to print these
tables.

Recall that all information must be represented in COGENT via Prolog terms. Buffer elements are no
exception, but they are perhaps the simplest sorts of box elements in COGENT.
This is reflected in the simplicity of the buffer element editor. Apart from
the comment line, it contains a single text field into which the buffer
element should be typed. The contents of this field should be a valid Prolog term. If not, however, COGENT does
automatic syntax checking (and attempted correction) of editor elements, and
so any error will be noted and (possibly) corrected.