Next: Setting Instruction Classes Weights, Previous: Handling Instruction Invocation, Up: Executing a Multinode Model [Contents][Index]
Look-ahead signals are signals that along with an instruction class index and an instruction outcome take part in selecting the next node state after an instruction invocation. The adjective “look-ahead” indicates that in some situations those signals can convey look-ahead information. For example, when processing a sequence of symbols from left to right, a multinode model can analyze look-ahead symbols as look-ahead signals. In other situations, those signals can pass even look-back information to the model.
When creating a multinode model by the function qsmm_create
, the fields ngram_env_la_sz
, nsig_ngram_env_la
, and range_sig_env_la_p
of qsmm_desc_s
structure specify the length of the look-ahead signal segment of this model and the ranges of signals assignable to the elements of that segment.
You can retrieve those parameters later by the functions qsmm_get_ngram_env_la_sz
and qsmm_get_nsig_ngram_env_la
called for this multinode model and by the function qsmm_get_actor_range_sig
called for the environment state identification engine.
An important limitation imposed on a multinode model when its look-ahead signal segment has positive length is that the function qsmm_node_asm
cannot load assembler programs into the nodes of this model.
This limitation also prevents loading default uniform probability profiles into the nodes of this model using implicitly generated assembler programs when the highest reserved node identifier is positive, and the environment state identification engine or instruction emitting engine is a large actor—in this case, the model is unusable.
Therefore, if you need to use a look-ahead signal segment with positive length for a model with the environment state identification engine or instruction emitting engine represented by a large actor, use the model containing a single node with identifier 0.
Use the following functions to query or set signals in the look-ahead signal segment at specific positions.
If sigp is not NULL
, this function sets *sigp to an element of look-ahead signal segment of a multinode model at position pos.
On success, the function returns a non-negative value.
If pos is negative or greater than or equal to the length of look-ahead signal segment, the function returns negative error code QSMM_ERR_INVAL
.
This function sets an element of look-ahead signal segment of a multinode model at position pos to sig.
On success, the function returns a non-negative value.
If pos is negative or greater than or equal to the length of look-ahead signal segment, or sig does not belong to a range of allowed signal identifiers at position pos in the look-ahead signal segment, the function returns negative error code QSMM_ERR_INVAL
.
You can call the functions qsmm_get_la_sig
and qsmm_set_la_sig
at any point after creating a multinode model.
For example, you can call them while processing an event QSMM_EVT_NODE_ENTER
by the event handler of an instruction class set or an event QSMM_EVT_ACTIVATE
by the event handler of an instruction meta-class.
If the field range_sig_env_la_p
of qsmm_desc_s
structure is NULL
, the function qsmm_create
initializes the elements of look-ahead signal segment to 0.
If that field is not NULL
, qsmm_create
initializes the elements of look-ahead signal segment to the values of first
field in the corresponding elements of range_sig_env_la_p
array.
See the file tests/lookup2.c for an example program that uses the look-ahead signal segment.
Next: Setting Instruction Classes Weights, Previous: Handling Instruction Invocation, Up: Executing a Multinode Model [Contents][Index]