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


4.15 Controlling Random Behavior

A random number generator used by a multinode model, either supplied when creating the model or, if not supplied, an instance of a default random number generator allocated automatically, can be obtained using the following function.

Function: qsmm_rng_t qsmm_get_rng (qsmm_t model)

This function returns the handle of a random number generator used by actors constituting the instance of a multinode model specified by handle model. The function never returns NULL.

The handle of a random number generator returned is typically used to seed the generator after creating the multinode model or the model instance. For information on how to seed a random number generator and perform other operations on it, see Random Number Generators.

A useful approach to determine the amount of contribution of the optimization mechanism provided by the QSMM framework to overall operating optimality of a multinode model is to compare a measure of optimality calculated for the model during its normal operation with a measure of optimality calculated when this optimization mechanism is switched off. The greater the difference is between those values the more optimization is provided by the QSMM framework thus increasing overall operating optimality of the model.

Use the following function to switch the model instance to nonoptimal or normal behavior mode.

Function: int qsmm_set_random (qsmm_t model, int flag)

This function switches the current mode of behavior of the instance of a multinode model specified by handle model to nonoptimal or optimal (normal) mode. If flag is non-zero, then the current mode will be switched to nonoptimal mode. If flag is zero, then the current mode will be switched to optimal mode. In the nonoptimal mode, actors constituting the instance of the multinode model use equal probabilities for choosing output signals. To those probabilities profile probabilities and output signal weights are applied if applicable.

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

The above function is actually the short cut to setting the current mode of behavior of all actors constituting the instance of a multinode model. The function qsmm_set_actor_random sets the current mode of behavior of an actor. The function qsmm_get_actor_random retrieves the current mode of behavior of an actor.

The function qsmm_engine_create initializes the current mode of behavior of a model instance to optimal (normal) mode. That is, the function qsmm_engine_create initializes to this mode the current mode of behavior of all actors constituting the model instance.


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