#### 2.6.3 Spur Perception

Most of relative probability function formulas in Relative Probability Function Types contain the function C(h,z,i) equal to ratio between spur increment velocity and mean spur increment velocity. The method of computing C(h,z,i) depends on the way of spur perception for spur type i. The way of spur perception determines whether the ratio will be generally positive or negative for generally positive or negative spur increments supplied to the actor. There are two ways of spur perception: normal and inverse. The normal way of spur perception provides generally positive ratio for generally positive spur increments and generally negative ratio for generally negative spur increments. The inverse way of spur perception provides generally negative ratio for generally positive spur increments and generally positive ratio for generally negative spur increments.

The following enumeration specifies the way of perception of spur of a particular type.

Enumeration: qsmm_spur_perception_e

This enumeration specifies the way of spur perception for a spur type.

Below there are notations used in the descriptions of elements of this enumeration. In the descriptions of notations, a cycle of type <h,z> is the event history segment between an occurrence of action choice state h with emitting output signal z and a subsequent occurrence of h.

t

Discrete or continuous time for computing spur increment velocity.

E[i]

The value of spur of i type the actor accumulated.

H(h,z)[i]

The sum of increments of spur of i type over cycles of <h,z> type.

ω(h,z)

The sum of discrete or continuous cycle periods for cycles of <h,z> type.

The enumeration contains the following elements.

`QSMM_SPUR_PERCEPTION_NORMAL`

The value of C(h,z,i) is the ratio of spur increment velocity to the absolute value of mean spur increment velocity for a cycle type:

When spur increments over the event history are non-negative, C(h,z,i) increases as spur increment velocity increases. If spur increment velocity for a cycle type is positive and equal to mean spur increment velocity, C(h,z,i) is equal to 1.

`QSMM_SPUR_PERCEPTION_INVERSE`

The value of C(h,z,i) is the negative ratio of the absolute value of mean spur increment velocity to spur increment velocity for a cycle type:

When spur increments over the event history are negative, C(h,z,i) increases as spur increment velocity increases. If spur increment velocity for a cycle type is negative and equal to mean spur increment velocity, C(h,z,i) is equal to 1.

You can use the inverse way of spur perception to countervail negative spur with the other negative spur perceived as positive one because of inverse way of spur perception specified.

Use the following functions to query or set the way of spur perception for a spur type.

Function: int qsmm_get_actor_spur_perception (qsmm_actor_t actor, int spur_type, enum qsmm_spur_perception_e *spur_perception_p)
Function: int qsmm_set_actor_spur_perception (qsmm_actor_t actor, int spur_type, enum qsmm_spur_perception_e spur_perception)

If spur_perception_p is not `NULL`, the function `qsmm_get_actor_spur_perception` sets *spur_perception_p equal to the way of spur perception by an actor. The function `qsmm_set_actor_spur_perception` sets the way of spur perception by an actor to spur_perception. The values of spur_perception not matching to the elements of `qsmm_spur_perception_e` enumeration lead to undefined actor behavior.

The argument actor specifies an actor handle. The argument spur_type specifies a spur type and cannot be less than -1 or greater than or equal to the number of spur types returned by the function `qsmm_get_actor_nspur` for the actor. If the actor is the small one, specifying spur type -1 is incorrect.

If the actor is the large one, the functions query or set the way of spur perception for a corresponding spur type of a small actor associated with the large actor. Special spur type -1 of a large actor corresponds to the automatic spur of an associated small actor (i.e. its spur type 0).

On success, the functions return a non-negative value. On invalid spur_type, the functions return negative error code `QSMM_ERR_INVAL`. The value of spur_type is invalid in the following cases:

• – actor is the small one and spur_type is negative;
• spur_type is less than -1;
• spur_type is greater than or equal to the number of spur types specified in the field `nspur` of `qsmm_actor_desc_s` structure when creating the actor.

The function `qsmm_actor_create` initializes the ways of spur perception for all spur types of a newly created actor to `QSMM_SPUR_PERCEPTION_NORMAL`.