Next: , Previous: , Up: Defining Instruction Class Sets   [Contents][Index]


4.2.3.5 Setting the Number of States

Every node of a multinode model has a certain number of states. One of those states is a current node state. It changes deterministically or stochastically by the environment state identification engine according to the input from the instruction emitting engine and instruction execution environment: the index of last invoked instruction, its outcome, and the look-ahead signal segment if the multinode model uses that segment.

A prerequisite for successful learning a state model by a node is that it has a sufficient number of states. On the other hand, the more states a node has, the more instructions the node generally needs to execute to learn a state model.

The number of states of a just created node is equal to the number of states specified for the node class (represented by an instruction class set) of this node. The number of states specified for the node class is the default number of states for newly created nodes and, at the same time, the maximum allowed number of states of nodes belonging to the node class. After creating a node, you can change its number of states to a value less than maximum allowed one.

Use the following functions to retrieve or set the maximum number of states for a node class.

Function: int qsmm_get_nstate_max_v2 (qsmm_t model, const char *node_class_name, int rez1, unsigned int flags, qsmm_sig_t *nstate_p)

This function retrieves the maximum allowed number of states of nodes belonging to a node class of a multinode model. That number is also the default number of states for newly created nodes belonging to the node class. An instruction class set named node_class_name represents the node class.

If flags contain bitmask QSMM_EXCEPT_NOTFOUND, and the instruction class set does not exist, the function reports QSMM_ERR_NOTFOUND. If flags contain bitmask QSMM_EXCEPT_TYPE, and an entity named node_class_name is not an instruction class set, the function reports QSMM_ERR_TYPE. Bitmask QSMM_EXCEPT_ALL includes QSMM_EXCEPT_NOTFOUND and QSMM_EXCEPT_TYPE.

The argument rez1 is for future use and must be equal to 0.

On success, the function returns a non-negative value and sets *nstate_p if nstate_p is not NULL. If an entity named node_class_name exists and is an instruction class set, the function sets *nstate_p to the maximum allowed number of states for the instruction class set. If the entity does not exist, and flags do not contain QSMM_EXCEPT_NOTFOUND, the function sets *nstate_p to QSMM_SIG_INVALID. If the entity exists but is not an instruction class set, and flags do not contain QSMM_EXCEPT_TYPE, the function sets *nstate_p to QSMM_SIG_INVALID.

On failure, the function returns a negative error code. Currently, the function can return the following error codes.

QSMM_ERR_NOTFOUND

The instruction class set node_class_name does not exist. The function reports this error if flags include bitmask QSMM_EXCEPT_NOTFOUND. Otherwise, the function sets *nstate_p to QSMM_SIG_INVALID (if nstate_p is not NULL) and returns a non-negative value.

QSMM_ERR_TYPE

An entity named node_class_name is not an instruction class set. The entity is an instruction meta-class. The function reports this error if flags include bitmask QSMM_EXCEPT_TYPE. Otherwise, the function sets *nstate_p to QSMM_SIG_INVALID (if nstate_p is not NULL) and returns a non-negative value.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.

Function: int qsmm_set_nstate_max (qsmm_t model, const char *node_class_name, qsmm_sig_t nstate)

This function sets to nstate the maximum allowed number of states of nodes belonging to a node class of a multinode model. That number is also the default number of states for newly created nodes belonging to the node class. An instruction class set named node_class_name represents the node class.

The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.

QSMM_ERR_INVAL

The argument nstate is less than 2.

QSMM_ERR_NOTFOUND

The instruction class set node_class_name does not exist.

QSMM_ERR_TYPE

An entity named node_class_name is not an instruction class set. The entity is an instruction meta-class.

QSMM_ERR_VIOLAP

The model instance exists, and nstate is greater than the number of states of the environment state identification engine. On creating the model instance, the function qsmm_engine_create creates that engine with the number of states equal to a maximum number among the maximum allowed numbers of states specified by qsmm_set_nstate_max for all instruction class sets in the multinode model.

QSMM_ERR_VIOLNODE

The argument nstate is less than the number of states of one or more already created nodes belonging to the node class.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.

The default number of states for newly registered instruction class sets is 2.


Next: , Previous: , Up: Defining Instruction Class Sets   [Contents][Index]