Next: , Previous: , Up: Executing a Multinode Model   [Contents][Index]


4.3.7 Switching Adaptive or Random Behavior

A multinode model has either a random number generator provided via the field rng of qsmm_desc_s structure when creating the multinode model or an instance of default random number generator allocated automatically if that field was NULL. The environment state identification engine and instruction emitting engine use that random number generator. The purpose of the following function is to obtain the random number generator of a multinode model.

Function: qsmm_rng_t qsmm_get_rng (qsmm_t model)

This function returns the handle of a random number generator used by the environment state identification engine and instruction emitting engine of a multinode model. The function never returns NULL.

You can use the returned handle of a random number generator to seed the generator after creating the multinode model or model instance. See Random Number Generators, for how to seed a random number generator and perform other operations on it.

A useful approach to determine the amount of contribution of optimization mechanism provided by QSMM to the optimality of behavior of a multinode model is comparing a measure of optimality for this multinode model behaving adaptively versus a measure of optimality for this model behaving randomly. The greater the difference is between those values the more contribution the optimization mechanism provided by QSMM makes to the optimality of behavior of this multinode model.

Use the following function to switch the model instance to random or adaptive (normal) behavior mode.

Function: int qsmm_set_random (qsmm_t model, int flag)

This function switches the current mode of behavior of instance of a multinode model to random or adaptive (normal) mode. If flag is non-zero, the function switches the current mode to random mode. If flag is zero, the function switches the current mode to adaptive mode.

The function is a short cut to setting the current mode of behavior for the environment state identification engine and instruction emitting engine of model instance by the function qsmm_set_actor_random.

On success, the function returns a non-negative value. If the model instance does not exist, the function returns negative error code QSMM_ERR_UNTIMELY.

The function qsmm_engine_create initializes the current mode of behavior of model instance to adaptive (normal) mode.


Next: , Previous: , Up: Executing a Multinode Model   [Contents][Index]