3.2 Structures for Accessing Storage

The following structure holds the condition of an action choice state.

Structure: qsmm_state_s

This structure holds the condition of an action choice state h (see Relative Probability Function Types, for formulas involving h). The structure contains the following fields.

Field: long tmd0

The discrete time of last occurrence of a cycle of <h,z> type in the event history, where the field sig_cycle_next of this structure specifies z. If the field tmd0 is non-negative, and sig_cycle_next is not QSMM_SIG_INVALID, tmd0 indicates the discrete time of last emitting output signal z in action choice state h. The function qsmm_actor_reg_sig_out records that discrete time. The default value of this field is −1.

Field: double nsig_ctrl

The nominal number of output signals for the probability profile of this action choice state. See Number of Output Signals, for the explanation of the concept of the nominal number of output signals for an action choice state.

If nsig_ctrl is positive, it specifies custom nominal number of output signals. If the field nsig_pos of this structure is greater than 1, nsig_ctrl must be greater than 1 and less than or equal to nsig_pos. If nsig_pos is negative, nsig_ctrl must be equal to 1. The field nsig_ctrl must not be positive if nsig_pos is 0.

If nsig_ctrl is 0, this condition means to use implicit nominal number of output signals equal to the number of cycle directions with positive profile probabilities held in nsig_pos.

The default value of this field is 0.

Field: qsmm_sig_t sig_cycle_next

An output signal indicating the direction of last cycle started at this action choice state and not yet processed. If the function qsmm_actor_reg_sig_out did not register a cycle started at this action choice state, or the function qsmm_actor_reg_ngram_in has already processed the cycle, then QSMM_SIG_INVALID. The default value is QSMM_SIG_INVALID.

Field: qsmm_ssig_t nsig_pos

This field contains information on the number of cycle types <h,x> (i.e. starting at this action choice state h) with positive profile probabilities assigned, where x is a possible cycle direction. Meanings of various values of this field are below.

0

The action choice state does not have a probability profile specified.

i>1

The number i of cycle directions with positive profile probabilities assigned.

i<0

A single cycle direction has a positive profile probability assigned, and −i−1 is equal to identifier x of an output signal only allowed by the probability profile.

1

Disallowed.

This field is read-only when using the functions qsmm_set_storage_state_stats and qsmm_get_storage_state_stats: qsmm_set_storage_state_stats ignores the field, and qsmm_get_storage_state_stats calculates its value based on the number of cycle directions with positive profile probabilities specified in the field profile of qsmm_cycle_s structure for cycle types starting at this action choice state.

If storage does not contain the condition of the action choice state, and storage has a set redirection function for retrieving the initial condition of an action choice state, qsmm_get_storage_state_stats calls the redirection function, and it should set nsig_pos to a correct value. See Specifying Redirection Functions, for more information on the redirection function.

The condition of an action choice state includes an array of instances of a structure holding an initial cycle-summed value recorded by the function qsmm_actor_reg_sig_out for the last cycle started at the action choice state. The number of elements in the array is equal to the number of cycle-summed value types supported by storage. The array begins with initial cycle-summed values for spur followed by initial cycle-summed values for continuous time.

The structure contains only one field but is a structure to simplify associating other information with an action choice state and cycle-summed value type for research purposes. When storage prepares a structure instance for first use, it initializes the instance with zeroes by the function memset, so fields you may have added will initially be zero.

The structure description is below.

Structure: qsmm_sspval_s

This structure holds condition associated with an action choice state and cycle-summed value type. The structure contains the following field.

Field: double val0

The current value of spur or continuous time recorded by the function qsmm_actor_reg_sig_out for the last cycle started at the action choice state when registering the emission of an output signal in the action choice state.

The following structure holds statistics on a cycle type.

Structure: qsmm_cycle_s

This structure holds statistics on a cycle type—a pair comprised of an action choice state and a cycle direction (i.e. an output signal emittable in the action choice state). In Spur Perception, the notation <h,z> is a cycle type for action choice state h and cycle direction z. The structure contains the following fields.

Field: long fq

The number of registered cycles of <h,z> type.

Field: long period_sum_d

The total length of registered cycles of <h,z> type measured in discrete time. In Spur Perception, the notation ω(h,z)  is that total length measured in discrete or continuous time.

Field: double profile

A profile probability—weight to multiply the relative probability of output signal z selectable in action choice state h. When using a probability profile, the sum of profile probabilities of all cycle types for action choice state h must be equal to 1. When not using a probability profile, the field must be equal to 0.

The statistics on a cycle type includes an array of instances of a structure holding an accumulated cycle-summed value incremented on registering a cycle of this type by the function qsmm_actor_reg_ngram_in. The number of elements in the array is equal to the number of cycle-summed value types supported by storage. The array begins with accumulated cycle-summed values for spur followed by accumulated cycle-summed values for continuous time.

The structure contains only one field but is a structure to simplify associating other information with a cycle type and cycle-summed value type for research purposes. When storage prepares a structure instance for first use, it initializes the instance with zeroes by the function memset, so fields you may have added will initially be zero.

The structure description is below.

Structure: qsmm_cspval_s

This structure holds statistics associated with cycle type <h,z> and a cycle-summed value type. The structure contains the following field.

Field: double delta_sum

The sum of increments of spur or continuous time over cycles of <h,z> type registered by the function qsmm_actor_reg_ngram_in. Each spur increment is the difference between a current spur or continuous time value at a moment of calling qsmm_actor_reg_ngram_in and a spur or continuous time value recorded at a cycle start and stored in the field val0 of qsmm_sspval_s structure.