QSMM Changelog

What's new in QSMM 1.16

Jul 29, 2014
  • Backward-incompatible changes.:
  • To improve the robustness of package operation for long event histories, the type of field `fq' of structure `qsmm_cycle_s', fields `fq_goto_min' and `fq_action_min' of structure `qsmm_disasm_desc_s', and field `fq_min' of structures `qsmm_dump_mat_goto_desc_s' and `qsmm_dump_mat_action_desc_s' was changed from `int' to `long'.
  • Function `qsmm_get_node_array_prob_out' now will not set the first element of a buffer for retrieved elements of an array to -2 if the array is not found. Instead, the function will raise exception QSMM_ERR_NOTFOUND, to which new entity type QSMM_ENT_ARRAY_PROB is passed.
  • Changes for actor:
  • Added function `qsmm_get_actor_prob_action', using which a probability of the last signal returned by function `qsmm_get_actor_sig_action' can be obtained. The function operates quickly for small and large actors.
  • Added function `qsmm_set_actor_discrete_time' for setting discrete time tracked by an actor. That function can be used when restoring the state of the actor from a file.
  • Function `qsmm_actor_time_delta' now supports negative time increments. This feature can be used to restore continuous time when loading a state of the actor from a file. However, the function disallows to change continuous time tracked by the actor to a negative value.
  • Added type of relative probability function QSMM_RELPROB_BUILTIN3, which is analogous to type QSMM_RELPROB_BUILTIN2, but is simply the exponent, without addend +1 and divisor 2.
  • Added type of relative probability function QSMM_RELPROB_USER2. That type is to be used with a helper function of type `qsmm_relprob_user2_func_t', to which a signal that indicates a cycle direction, condition for the action choice state and statistics for the cycle type are passed.
  • Field `sig_cycle_next' was moved to the end of structure `qsmm_state_s', according to the order of fields that depends on their
  • types and is accepted in the package source code.
  • Changes for multinode model:
  • Added support for a mode when the instruction emitting engine (formerly referred to as an engine that produces optimal actions on the basis of current environment states) is represented by a large actor. This mode will be turned on when new field `is_large_opt' of structure `qsmm_desc_s' has a non-zero value. For certainty and full awareness of operating parameters of the engines, it is recommended to explicitly set all those parameters just after creating the model instance.
  • Function `qsmm_create' will return QSMM_ERR_INVAL if field `is_large_opt' of structure `qsmm_desc_s' is non-zero and, at the same time, field `use_flat_storage' of that structure is non-zero or field `is_determ_opt' is non-zero or field `dont_use_instr_class_weights' is zero or field `compat' is zero.
  • Added field `profile_pool_opt_sz' to structure `qsmm_desc_s', using which the size of the pool of probabilities lists in normal form of an instruction emitting engine represented by a large actor can be specified when creating a multinode model. Function `qsmm_create' will return QSMM_ERR_INVAL if the value of that field is negative.
  • A large environment state identification engine can now be used even when field `is_determ_opt' of structure `qsmm_desc_s' is set equal to 0, i.e. when both matrices--the state transiton matrix and the action emission matrix--specify non-deterministic choices.
  • Function `qsmm_node_call_default' now loads a default uniform probability profile into a node if the node does not have a probability profile set, the model contains multiple nodes, and one or both engines are represented by large actors. The profile is loaded using an implicitly generated assembler program. If the model has a look-ahead signal segment of positive length, then the loading cannot be performed and QSMM_ERR_UNSUPPLA will be raised.
  • The loading of default uniform probability profile is also supported when field `is_determ_opt' of structure `qsmm_desc_s' has a non-zero value and the number of instruction classes in the instruction class set of the node is equal to 1. If the number of instruction classes is greater than 1, then QSMM_ERR_NOPROF will be raised.
  • Added functions `qsmm_get_prob_goto' and `qsmm_get_prob_action' that return the probability of the last state transition performed and the probability of the last action produced. The functions can be called during processing an instruction invocation event by the event handler function of instruction meta-class.
  • Function `qsmm_set_node_nstate' will now raise QSMM_ERR_NOSYS if the environment state identification engine is represented by a large actor and the model contains a single node with identifier 0. Use function `qsmm_set_nstate_max' to set the number of states of that node.
  • Function `qsmm_time_delta' now supports negative time increments. However, the function disallows to change continuous time tracked by each of two actors upon which the multinode model is based to a negative value.
  • Added enumeration `qsmm_mat_e' with two elements that specifies the type of a matrix. Element QSMM_MAT_GOTO denotes a state transition matrix and element QSMM_MAT_ACTION denotes an action emission matrix.
  • Added element QSMM_ENT_ARRAY_PROB to enumeration `qsmm_ent_e'. That element denotes an output probabilities array with a specific name, which is the name of a location label assigned to a `casels' instruction or to a `choice' instruction block in an assembler program.
  • Added field `are_lines_around_multiline_param' to structure `qsmm_dump_prg_desc_s'. A non-negative value of that field specifies to insert empty lines before and after multiline user and `casels' instructions. The field should be used instead of deprecated field `are_lines_around_multiline_casels'.
  • Added field `margin_right_param' to structure `qsmm_dump_instr_desc_s'. A positive value of that field specifies a right margin column for lists of arguments of user and `casels' instructions. A non-positive value indicates not to split the lists into multiple lines based on a right margin column. The field should be used instead of deprecated field `margin_right_casels'.
  • Added field `nline_param' to structure `qsmm_dump_instr_desc_s'. The value of that field is set by function `qsmm_instr_str'. The number of lines of arguments list of an instruction printed is written here. The field should be used instead of deprecated field `nline_casels'.
  • Changes for assembler programs processing:
  • Fixed the bug that could cause the values of output probability variables retrieved by function `qsmm_get_node_var_prob_out', the values of elements of output probabilities arrays retrieved by function `qsmm_get_node_array_prob_out', and probabilities in `case' instructions (in a program disassembled using an assembler program template) to make the sum of probabilities of choice alternatives be greater than 1. Now the renormalized values are retrieved for which the sum of probabilities of choice alternatives is equal to 1.
  • When retrieving probabilities of type QSMM_PROB_FQ by functions `qsmm_get_node_var_prob_out' and `qsmm_get_node_array_prob_out' or by disassembling a node using an assembler program template, values proportional to observed frequencies will be fetched, not proportional to frequencies weighted by theirselves, as in the previous package release.
  • Function `qsmm_get_node_array_prob_out' now supports retrieving a remaining probability that corresponds to a choice alternative just after a `casels' instruction or a `choice' instruction block via accessing an element of output probabilities array with an index equal to the number of location labels in arguments of the `casels' instruction or to the number of `case' instructions in the `choice' instruction block.
  • Added functions `qsmm_get_node_var_prob_mat' and `qsmm_get_node_array_prob_mat' that retrieve the type of a matrix, to which an output probability variable or an output probabilities array of a node corresponds. A type of matrix is defined by an element of enumeration `qsmm_mat_e'. If the node is a user of a source probability profile provided by another node, then there will be retrieved a type of matrix of the output probability variable or the output probabilities array of the latter node.
  • Added functions `qsmm_get_node_var_prob_cycle' and `qsmm_get_node_array_prob_cycle', which retrieve aggregate statistics on cycle types that correspond to an output probability variable or an element of an output probabilities array of a node. The aggregate statistics is returned in an instance of structure `qsmm_cycle_s' and in an array of structures `qsmm_cspur_s'. If the node is a user of a source probability profile provided by another node, then information on how to retrieve the aggregate statistics will be taken from the latter node.
  • Got rid of the idea of a hint for reusing a Huffman tree by a large actor when the same probabilities list is referenced in another `casels' instruction in an assembler program. Now all lists of probabilities defined either explicitly by `probeq' and `probls' directives or implicitly by `jprob' instructions and `choice' instruction blocks are stored in the hash table and are reused automatically without any hints.
  • The list of arguments of a user instruction can now be splitted into multiple lines in an assembler program. To indicate that a line of arguments list is continued on the next line, terminate a line, which is continued, with a comma after an element of arguments list.
  • The assembler preprocessor now recognizes `line' directives. For every such directive, it adjusts current line number, adjusts current file name (optionally), and emits a corresponding `line' directive for the assembler.
  • Provided support for escape sequences `\xHH' in string literals. When preprocessing or parsing an assembler program, every such escape sequence will be replaced with a character that has hexadecimal code HH.
  • The assembler preprocessor now correctly converts expression "#__UNIQUE__" to a string literal.
  • Functions `qsmm_preprocess_asm_source_file' and `qsmm_parse_asm_source_file' now stop reading an input file when EOF is reached and do not use file length to determine the number of bytes to read.
  • Behavior of functions `qsmm_preprocess_asm_source_*' is now specfied when they return a buffer with a preprocessed program text of size greater than INT_MAX: those functions shall return INT_MAX as the size of the buffer.
  • Function `qsmm_reg_var_prob' will now raise QSMM_ERR_NOSYS only if both engines are represented by large actors.
  • Functions `qsmm_get_node_var_prob', `qsmm_set_node_var_prob', and `qsmm_node_var_realize' now do not raise QSMM_ERR_NOSYS.
  • Internationalization support:
  • Functions `qsmm_preprocess_asm_source_buf', `qsmm_preprocess_asm_source_file', and `qsmm_preprocess_asm_source_stream' now correctly preprocess assembler programs supplied in multibyte charsets, e.g. UTF-8. To accomplish this task, they internally convert an assembler program text to a wide string according to category LC_CTYPE of a current locale before the preprocessing, produce a preprocessed program text in the form of a wide string, and finally convert the preprocessed program text to a multibyte string according to the current locale.
  • Functions `qsmm_parse_asm_source_buf', `qsmm_parse_asm_source_file', and `qsmm_parse_asm_source_stream' now correctly parse assembler programs supplied in multibyte charsets, e.g. UTF-8. To accomplish this task, they internally convert an assembler program text to a wide string according to category LC_CTYPE of current locale.
  • Added new error code QSMM_ERR_ILSEQ, which indicates that an invalid byte sequence was encountered when converting a multibyte string to a wide string or when converting a wide string to a multibyte string according to category LC_CTYPE of current locale.
  • Functions `qsmm_preprocess_asm_source_buf', `qsmm_preprocess_asm_source_file', and `qsmm_preprocess_asm_source_stream' will now raise QSMM_ERR_ILSEQ when they fail to convert an assembler program text in the form of a multibyte string to the form of a wide string or vice versa.
  • Functions `qsmm_parse_asm_source_buf', `qsmm_parse_asm_source_file', and `qsmm_parse_asm_source_stream' will now raise QSMM_ERR_ILSEQ when they fail to convert an assembler program text in the form of a multibyte string to the form of a wide string.
  • Function `qsmm_get_node_state_name' can now raise QSMM_ERR_NOMEM or QSMM_ERR_ILSEQ when it fails to prepare a state name in the form of a multibyte string from a state name in the form of a wide string.
  • Function `qsmm_get_node_state_by_name' can now raise QSMM_ERR_NOMEM or QSMM_ERR_ILSEQ when it fails to prepare a state name in the form of a wide string from a state name in the form of a multibyte string.
  • Functions `qsmm_get_eh_instr_param_str' and `qsmm_get_instr_class_param_str' can now raise QSMM_ERR_NOMEM or QSMM_ERR_ILSEQ when they fail to prepare a textual representation of instruction parameters in the form of a multibyte string.
  • Function `qsmm_set_eh_instr_param_str_f' will now raise QSMM_ERR_ILSEQ when it fails to prepare a textual representation of instruction parameters in the form of a wide string.
  • Function `qsmm_get_instr_class_name' can now raise QSMM_ERR_NOMEM or QSMM_ERR_ILSEQ when it fails to prepare an instruction class name in the form of a multibyte string.
  • Functions `qsmm_find_instr_class_in_set_f', `qsmm_find_instr_class_in_set_fv', `qsmm_get_instr_class_weight_by_name_f', and `qsmm_set_instr_class_weight_by_name_f' will now raise QSMM_ERR_ILSEQ when they fail to produce a formatted instruction class name in the form of a wide string.
  • Function `qsmm_node_call_default' will now raise QSMM_ERR_ILSEQ if it fails to convert a textual representation of instruction parameters to a multibyte string when filling structure `qsmm_except_outcome_s'.
  • Changes for sample program `test':
  • The program now uses a pair of explicitly created actors instead of actor pair.
  • The program now supports finding an optimal cycle using an algorithm analogous to Viterbi one. A new value `c' of argument of option `-C, --ncycle-max' indicates to check the connectivity of a state graph of the automaton and to find an optimal cycle in the graph using that algorithm. Another supported value `cs' of the argument indicates to check the connectivity, to perform the simplification of the automaton, and to find an optimal cycle using that algorithm.
  • Argument `3' of option `-P, --relprob-type' is now supported. That argument corresponds to type of relative probability function QSMM_RELPROB_BUILTIN3.
  • Removed support for option `-a, --auto-spur'.
  • Changes for sample program `asm-disasm':
  • Option `-L, --large' now supports specification of the size of the pool of probabilities list in normal form for every engine of the model. The format of argument of the option is "PE|,PO|PE,PO", where PE denotes the size of the pool for the environment state identification engine and PO denotes the size of the pool for the instruction emitting engine. If the size of the pool is not specified, then a small actor will be used for the corresponding engine.
  • Added option `--prob-prec-var=INT' that specifies the number of digits after a decimal point to print for values of output probability variables and elements of output probabilities arrays. If an argument of the option is positive, then fixed-point notation will be used. If the argument is negative, then exponential notation will be used, and the number of digits will be equal to the absolute value of the argument. Zero argument specifies the default mode.
  • Removed support for option '-2, --nchoice-2', because this mode is now deprecated.
  • Changes for other sample programs:
  • Added program `labyr2', which is a new example of using the Actor API included in the package manual. The program uses the Curses library to show movements of agent in a labyrinth which picture is hard-coded in the program source text using a subset of ASCII characters that look like pseudographics.
  • Program `apsamp' now uses a pair of explicitly created actors instead of a `qsmm_actpair_t' object which API became internal one. Various schemes of use of the pair of actors are supported. A scheme is selected by defining one of macros MODE_XX_XX when building the program.
  • Program `asmat' now supports various schemes of use of a pair of engines that correspond to the multinode model. The schemes are analogous to those supported by program `apsamp'. A scheme is specified by defining one of macros MODE_XX_XX when building the program.
  • Program `maze' now uses large actors for the environment state identification engine and the instruction emitting engine. To make this
  • possible, the program now does not use instruction classes weights to prevent moving to obstacles. When the agent moves to an obstacle, a special outcome is returned by the `move' instruction and path length is not incremented. In a final path printed by the program, moves, which were not performed because of obstacles, are denoted by "x". Adjustment of temperatures of the engines is not supported.
  • Program `maze-mt' was rewritten and produces the same results as program `maze'.
  • Added program `maze-asm', which is a new example of working with an assembler program. An agent, which behavior is modeled by the sample program, solves the same task as in program `maze'. However, the picture of the labyrinth is hard-coded in the program source text as in program `labyr2'. Movements of the agent at the last visiting the labyrinth are shown using the Curses library. A profile assembler program `prg_maze' can be used to assist the agent in solving the task. At the end of its run, the sample program creates file `prg_disasm' with a learnt disassembled program that controls movements of the agent in the labyrinth.
  • Program `labyr' was modified to use two explicitly created actors instead of C function node classes and moved to the `tests' directory. Chapter "C Function Node Classes" was removed from the manual, so this program no longer demonstrates a special feature of the package.
  • Removed support for options `--trace-all' and `--trace-actpair' from program `fw-simple', because they would turn on the use of deprecated flags of model execution tracing.
  • Programs `optact-p' and `tohuff-test' now use M_SQRT2 instead of 1 as the maximum possible distance between two normalized vectors. This changes values printed in `% ef2' columns of test logs (amongst other values).
  • Program `optact-p' now supports argument `3' of option `-P, --relprob-type'. That argument corresponds to type of relative probability function QSMM_RELPROB_BUILTIN3.
  • Slightly changed a description of one of input vectors in program `optact'.
  • Program `optpath' now uses a relative probability function of type QSMM_RELPROB_BUILTIN3.
  • To make the source code of programs `optact', `optpath', `fw-simple', `parse-asm', `tohuff-test', and `optact-p' easier to understand, macro CHK_FAIL is now used where possible for checking for errors.
  • When multiple models are used by program `predict-test', a signal that has maximum value of weight[ii]*tmd/fq_in[ii] is selected as a resulting predicted signal. Here weight[ii] is the total number of times signal `ii' was predicted by all models at current step, `tmd' is the number of processed signals from an input sequence, and fq_in[ii] is the number of times signal `ii' did occur in the input sequence. As a rule, such method provides greater increase (compared to program `predict-test' included in the previous release of the package) in the number of correctly predicted signals when more models of the same structure are used by the program.
  • Added program `langlearn-test' which learns a symbol sequence produced using a probabilistic context-free grammar (PCFG) read from a file. To evaluate learning efficiency, the number of correctly predicted symbols is compared with an upper bound equal to the number of symbols that can be correctly predicted by any means. To learn a language, the program uses plain actors that operate concurrently. The greater is the number of actors, typically the greater is the number of correctly predicte signals. The algorithm is a slightly simplified version of algorithm of operation of program `predict-test' when it uses a uniform probability profile of type 0.
  • Removed program `asmenv'.
  • Changes for the `configure' script:
  • Removed options `--enable-debugging', `--enable-profiling', and `--enable-coverage'. Their functionality can now be achieved by passing appropriate values of argument CFLAGS=... to the `configure' script.
  • Added option `--disable-long-double'. That option disables the use of long double precision when calculating relative probabilities of output signals choice on systems that support such precision. The option can be used to obtain computation results on systems, which support long double precision, consistent with results obtained on systems that do not support it.
  • Added option `--without-curses'. That option disables building sample programs `labyr2' and `maze-asm' which use the Curses library. The option can be used when that library is not available.
  • Deprecated features:
  • The most of Actor Pair API was made the internal one. The API should not be used in your new programs, except for functions 'qsmm_get_actpair_actor_env' and 'qsmm_get_actpair_actor_opt'; those functions can be used to obtain handles of actors upon which the multinode model is based. The internal part of Actor Pair API was moved to file "internal.h", which is installed to a directory for header files set by the `configure' script. Currently, the internal part of the API cannot be removed from public header files, because of the need to preserve backward compatibility. The functionality of actor pair can be implemented in your programs using a multinode model or by direct creating a pair of actors.
  • The concept of C function node classes was made obsolete. Their functionality can be provided using assembler programs or directly created actors.
  • Structure `qsmm_except_weight_s' is now deprecated, because the corresponding exception could be raised only from within C function node classes which are now obsolete. Corresponding field `weight' of union `qsmm_except_u' is now deprecated for the same reason.
  • Field `unconfrm' of union `qsmm_except_u' is now deprecated too, because the corresponding exception could be raised only from within C function node classes which are now obsolete.
  • Functions `qsmm_get_nchoice_2', `qsmm_set_nchoice_2', `qsmm_get_node_nchoice_2', and `qsmm_set_node_nchoice_2' are now deprecated, because they control a rarely used feature, which is not very helpful.
  • Field `are_lines_around_multiline_casels' of structure `qsmm_dump_prg_desc_s' is now deprecated. Field `are_lines_around_multiline_param' that hands over more general information should be used instead of it.
  • Fields `margin_right_casels' and `nline_casels' of structure `qsmm_dump_instr_desc_s' are now deprecated. Fields `margin_right_param' and `nline_param' that hand over more general information should be used instead of them.

New in QSMM 1.15 Beta (Jun 5, 2013)

  • Backward-incompatible changes:
  • New implementation of functionality of STL `map' and `multimap' templates introduces a change, according to which when calling function qsmm_map_erase' to remove a key-value pair from a map, the key should be destroyed after calling that function, not before. It is because function `qsmm_map_erase' might call a key comparison function for the key of a key-value pair being removed and that key must be a valid object.
  • New implementation of functionality of STL `multimap' template does not provide storing key-value pairs with the same key in order, in which they were added to a multimap.
  • Added support for large actors that choose output signals quickly when the number of those signals is large.
  • Added field `large_desc_p' to structure `qsmm_actor_desc_s'. This field, if not 0, indicates that a large actor should be created and specifies additional parameters of that actor. Function qsmm_actor_create' will return QSMM_ERR_INVAL if (large_desc_p!=0 && use_flat_storage!=0) or if large_desc_p!=0 and parameters specified in large_desc_p are invalid.
  • Function `qsmm_get_actor_sig_action' can be (and normally should be) called for a large actor without prior calling function qsmm_actor_calc_action_prob'. There is no means to pass a specific range of signals to which a generated output signal should belong. Values of arguments `sig_beg' and `sig_end' of function qsmm_get_actor_sig_action' are only checked that they include the whole range of output signals of the large actor. If they do not include that range, then QSMM_ERR_INVAL will be returned. The use of different ranges of allowed output signals can be implemented in your programs with the help of functions `qsmm_actor_profile_add', qsmm_actor_permut_add', and `qsmm_set_actor_ngram_profile'.
  • Function `qsmm_actor_calc_action_prob' can now calculate probabilities of output signals of a large actor. However, the function should not be called too often for actors of that type, because it is slow. When you need to generate an output signal by a large actor, you may call function `qsmm_get_actor_sig_action' without prior calling function qsmm_actor_calc_action_prob'.
  • Functions `qsmm_get_actor_sig_weight', `qsmm_set_actor_sig_weight', qsmm_get_actor_spur_time', and `qsmm_set_actor_spur_time' will return QSMM_ERR_NOSYS when are called for a large actor.
  • Added function `qsmm_get_actor_large_model' that returns the handle of multinode model of a large actor or 0 when the actor is not the large one.
  • For a large actor, functions `qsmm_actor_spur_delta', qsmm_get_actor_spur', `qsmm_get_actor_spur_weight', qsmm_set_actor_spur_weight', `qsmm_get_actor_spur_perception', and qsmm_set_actor_spur_perception' support calls with argument spur_type' equal to -1, in which case they retrieve or modify parameters that correspond to automatic spur of a small actor associated with the large actor.
  • When creating a large actor, function `qsmm_actor_create' will return error code QSMM_ERR_BIGMDL if a multinode model upon which the actor is based is too complicated.
  • Added function `qsmm_actor_remove_ngram' that removes information from actor's memory about specific action choice n-gram. The function performs operation, which could be performed in previous package releases by function `qsmm_storage_remove_state' for actor's storage, but function `qsmm_actor_remove_ngram' also works with large actors.
  • Added function `qsmm_actor_enum_ngrams' that enumerates action choice state n-grams with specifed prefix, information on which is stored in actor's memory. The function performs operation, which could be performed in previous package releases by function qsmm_storage_enum_states' for actor's storage, but function qsmm_actor_enum_ngrams' also works with large actors. The function takes an argument of new type `qsmm_enum_ngrams_callback_func_t'.
  • For smaller memory footprint when using a large actor, to allow creating flat storage for n-grams of lengths greater than 2 and when input and output signals do not interleave in the event history, for smaller memory footprint of flat storage, there was introduced a possibility to specify precise ranges of signals in action choice state n-grams of actors.
  • Added field `range_sig_p' to structure `qsmm_actor_desc_s'. That field describes ranges of signals in action choice state n-grams. If range_sig_p==0, then it will be assumed that every signal of action choice state n-gram has an allowed range from 0 to `nsig' (exclusive), where `nsig' is the total number of signals of the actor. Function qsmm_actor_create' will return QSMM_ERR_INVAL if range_sig_p!=0 and range_sig_p[i].first>range_sig_p[i].second || range_sig_p[i].second>=nsig) for some valid `i'.
  • Added function `qsmm_get_actor_range_sig' that returns a read-only array of ranges of signals in action choice state n-grams of an actor. This function never returns 0.
  • Added field `range_sig_in_p' to structure `qsmm_actpair_desc_s'. This field describes ranges of signals in signal sequences passed to function `qsmm_actpair_in', excluding the first signal of sequence if field `nnode' of that structure has a value greater than 1. If range_sig_in_p==0, then it will be assumed that every signal has an allowed range from 0 to a value of field `nsig_in' (exclusive) of that structure. Function `qsmm_actpair_create' will return QSMM_ERR_INVAL if range_sig_in_p!=0 and range_sig_in_p[i].first>range_sig_in_p[i].second || range_sig_in_p[i].second>=nsig_in) for some valid `i'.
  • Added field `range_sig_env_la_p' to structure `qsmm_desc_s'. That field describes ranges of signals in the look-ahead signal segment of multinode model. If range_sig_env_la_p==0, then it will be assumed that every signal of the look-ahead signal segment has an allowed range from 0 to a value of field `nsig_ngram_env_la' (exclusive) of that structure. Function `qsmm_create' will return QSMM_ERR_INVAL if range_sig_env_la_p!=0 and range_sig_env_la_p[i].first>range_sig_env_la_p[i].second || range_sig_env_la_p[i].second>=nsig_ngram_env_la) for some valid `i'.
  • Function `qsmm_actor_reg_sig_in' will return QSMM_ERR_NGRAM if the contents of current action choice state n-gram contradicts with a value of field `range_sig_p' of structure `qsmm_actor_desc_s' specified when creating the actor.
  • Function `qsmm_actpair_in' will return QSMM_ERR_INVAL if the contents of input signal sequence contradicts with a value of field range_sig_in_p' of structure `qsmm_actpair_desc_s' specified when creating the actor pair.
  • Function `qsmm_set_la_sig' will raise QSMM_ERR_INVAL if a look-ahead signal does not belong to a range specified using field range_sig_env_la_p' of structure `qsmm_desc_s' when creating the multinode model.
  • To support using various n-ary trees by a large actor to quickly choose output signals, there has been introduced the concept of a pool of ordered lists of probabilities for output signals and a pool of permutations for output signals. An ordered list of probabilities for output signals corresponds to a Huffman tree, which can be large enough and therefore consume considerable amount of memory. To reduce the amount of memory needed, the same Huffman tree may represent more than one probability profile when those profiles are actually different reorderings of the same ordered list of probabilities of tree leaves. These reorderings are called permutations of output signals. That is, a probability profile is represented by an ordered list of probabilities and a permutation, using which that list can be converted to a list of profile probabilities of output signals of the actor.
  • The concept of a pool of ordered lists of probabilities for output signals and a pool of permutations for output signals is supported not only for large actors, but also for small ones.
  • Added field `profile_pool_sz' to structure `qsmm_actor_desc_s'. That field specifies the maximum number of ordered output signal probabilities lists, which can be loaded into an actor. Function qsmm_actor_create' will return QSMM_ERR_INVAL if the value of this field is negative or if the actor is large and the number of possible action choice state n-grams plus the value of this field plus 1 exceeds INT_MAX.
  • Added function `qsmm_get_actor_profile_pool_sz' that retrieves a value of field `profile_pool_sz' of structure `qsmm_actor_desc_s' specified when creating the actor.
  • Added error code QSMM_ERR_MPROF, which indicates that a new ordered probabilities list is to be registered, but there is no room in the pool for that. Added field `mprof' to union `qsmm_except_u'. That field hands over the size of the pool when error QSMM_ERR_MPROF is raised during execution of a multinode model API function.
  • Added function `qsmm_actor_profile_add', which returns an index of ordered probabilities list and an index of output signals permutation that correspond to a list of probabilities of output signals of an actor. The function can return error QSMM_ERR_MPROF.
  • Added function `qsmm_actor_permut_add' that adds a permutation of actor's output signals to the pool and returns the index of a newly added permutation, or returns the index of an existing permutation if it is already contained in the pool.
  • Added functions `qsmm_get_actor_ngram_profile' and qsmm_set_actor_ngram_profile' for retrieving and setting up a correspondence between an action choice state n-gram and a preloaded probability profile represented by an index of ordered probabilities list and an index of output signals permutation.
  • A preloaded probability profile specified for an action choice n-gram of a small actor using function `qsmm_set_actor_ngram_profile' will be implicitly loaded by function `qsmm_actor_calc_action_prob' in an internal array, which holds weights of output signals of the actor and which can be accessed by functions `qsmm_get_actor_sig_weight' and qsmm_set_actor_sig_weight'.
  • Flat storage now supports n-grams of arbitrary length and arbitrary contents. Main memory for the storage is allocated on the basis of the number of possible n-grams that can be held in the storage, which is calculated using a value of field `range_sig_p' of structure qsmm_actor_desc_s' specified when creating the actor.
  • Added field `use_flat_storage' to structure `qsmm_actor_desc_s'. That field specifies whether flat storage should be used by the actor. The field can be set to a non-zero value disregarding of the n-gram length and whether input and output signals interleave in the event history. Field `use_flat_storage' (of structure `qsmm_actor_sig_spec_in_out_s'), to which those limitations were pertinent, is now deprecated.
  • Field `use_flat_storage' of structure `qsmm_actpair_desc_s' can now be set to a non-zero value disregarding of n-gram length.
  • Added field `use_flat_storage' to structure `qsmm_desc_s'. That field specifies whether flat storage should be used by an actor pair, which corresponds to the multinode model.
  • Flat storage now supports retrieving and setting redirection functions using calls to `qsmm_get_storage_state_stats_redir',
  • qsmm_set_storage_state_stats_redir', qsmm_get_storage_cycle_stats_redir', qsmm_set_storage_cycle_stats_redir', qsmm_get_storage_cycle_next_redir',
  • qsmm_set_storage_cycle_next_redir'.
  • Flat storage now supports state enumeration using function qsmm_storage_enum_states', state removal using function qsmm_storage_remove_state', and retrieving the next type of cycles, which start at specified state, using function qsmm_get_storage_cycle_next'.
  • Main memory for flat storage is now allocated upon creating the storage, not upon the first write operation to the storage.
  • Function `qsmm_actor_create' will now return QSMM_ERR_INVAL if flat storage is used and the number of possible action choice state n-grams exceeds INT_MAX.
  • Additional changes for actor:
  • Function `qsmm_get_actor_last_discrete_cycle_period' was renamed to qsmm_get_actor_discrete_cycle_period_last'. The deprecated old function is still available via an alias.
  • Added function `qsmm_get_actor_discrete_cycle_period_mean' that returns the mean discrete cycle period of an actor. The function could be called, e.g. from a user-supplied function specified using a call to qsmm_set_actor_relprob_helper' (see below).
  • Added field `compat' to structure `qsmm_actor_desc_s'. That field specifies a compatibility level of algorithms used by an actor. If the field has value 1, then the mean discrete cycle period will be additionally multiplied by a value returned by function qsmm_get_actor_naction_per_evt' (and possibly by 2) when calculating a relative probability of output signal choice, and a simpler formula for automatic spur increment will be used. Setting value of field `compat' to 1 is recommended for your new programs. Function `qsmm_actor_create' will return QSMM_ERR_INVAL if the value of this field is not 0 and 1.
  • Added function `qsmm_get_actor_compat' that returns a value of field compat' of structure `qsmm_actor_desc_s' specified when creating the actor.
  • Added functions `qsmm_get_actor_relprob_type' and qsmm_set_actor_relprob_type' for retrieving and setting the type of a function that returns a relative probability of output signal choice.
  • Possible types: QSMM_RELPROB_BUILTIN1 - utilize the standard function; QSMM_RELPROB_BUILTIN2 - utilize the alternative function; QSMM_RELPROB_USER1 - utilize a user-defined helper function, to which a cycle period is passed, which returns a multiplier for the exponent of relative probability of output signal choice.
  • Added functions `qsmm_get_actor_relprob_helper' and qsmm_set_actor_relprob_helper' for retrieving and setting a pointer to a helper function, which is used when calculating the relative probability of output signal choice, and for retrieving and setting a user parameter of that function. The helper function will be used when the type of a function, which returns a relative probability of output signal choice, is set to QSMM_RELPROB_USER1.
  • Functions `qsmm_get_actor_discrete_cycle_period_mlt' and qsmm_set_actor_discrete_cycle_period_mlt' are now deprecated. If you need to use a discrete cycle period multiplier or change the formula, which gives a relative probability of output signal choice, in some other way, then set the type of a function, which returns a relative probability of output signal choice, to QSMM_RELPROB_USER1, and specify a necessary helper function using a call to qsmm_set_actor_relprob_helper'.
  • Added function `qsmm_get_actor_nsig' that returns the total number of signals of an actor.
  • Added function `qsmm_get_actor_nsig_out' that returns the number of output signals of an actor.
  • Function `qsmm_get_actor_discrete_time' is now allowed to return negative values.
  • Functions `qsmm_actor_reg_sig_in', `qsmm_actor_reg_sig_action', qsmm_actor_calc_action_prob', `qsmm_get_actor_profile_nsig_ctrl', and qsmm_get_actor_sig_action' (when is called for a large actor) will now return QSMM_ERR_NGRAM if the actor window contains an invalid action choice state n-gram.
  • Additional changes for actor pair:
  • Added field `compat' to structure `qsmm_actpair_desc_s'. That field specifies a compatibility level of algorithms used by actors, which comprise the actor pair. Additionally, if the field has value 1, then the actor pair will multiply a discrete cycle period of the opposite actor of the actor pair by 2*qsmm_get_actor_naction_per_evt( actor_opposite). Setting value of field `compat' to 1 is recommended for your new programs. Function `qsmm_actpair_create' will return QSMM_ERR_INVAL if the value of this field is not 0 and 1.
  • Added field `is_large_env' to structure `qsmm_actpair_desc_s'. The field, if not 0, specifies that a large actor should be created for the environment state identification engine. It is only allowed when field use_flat_storage' is equal to 0 and field `compat' is equal to 1. Otherwise, function `qsmm_actpair_create' will return QSMM_ERR_INVAL.
  • The value of field `nspur' of structure `qsmm_actpair_desc_s' passed to function `qsmm_actpair_create' can now be equal to 1, which means that the environment state identification engine shall use only one spur type, which is normally automatic spur, and an engine, which produces optimal actions on the basis of current environment states, shall not use spur at all (this makes sense when the latter engine generates actions deterministically).
  • Added field `profile_pool_env_sz' to structure `qsmm_actpair_desc_s'. That field specifies the size of a pool of ordered probabilities lists used by the environment state identification engine. Function qsmm_actpair_create' will return QSMM_ERR_INVAL if the value of the field is negative.
  • Function `qsmm_set_actpair_work_nsig_out' can now set the working number of output signals equal to 1.
  • Function `qsmm_set_actpair_work_nstate' will return QSMM_ERR_NOSYS if the environment state identification engine is a large actor.
  • Function `qsmm_actpair_spur_delta' supports a call with argument spur_type' equal to -1 when the environment state identification engine is represented by a large actor, in which case the function increments the value of automatic spur of a small actor associated with the large actor.
  • Function `qsmm_get_actpair_cycle_period_mlt_opt' is now deprecated. The current standpoint is that a discrete cycle period multiplier of an actor, which produces optimal actions on the basis of current environment states, should not be modified outside of the actor pair.
  • Additional changes for multinode model:
  • Fixed a bug in passing a user parameter to an event handler function of C function node class via argument `qsmm_param_p' on events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and
  • QSMM_EVT_ENGINE_DONE.
  • The type of argument `desc_p' of function `qsmm_create' was changed from (struct qsmm_desc_s *) to (const struct qsmm_desc_s *).
  • Added field `compat' to structure `qsmm_desc_s'. That field specifies a compatibility level of algorithms used by the actor pair. Additionally, if the field has value 1, then the multinode model engine will not reset to 1 a discrete cycle period multiplier of an actor, which produces optimal actions on the basis of current environment states, when that actor is used independently of the actor pair. Setting value of field `compat' to 1 is recommended for your new programs. Function qsmm_create' will return QSMM_ERR_INVAL if the value of this field is not 0 and 1.
  • Added field `is_determ_opt' to structure `qsmm_desc_s'. If that field has a non-zero value, then the action emission matrix of every node will be restricted to define only deterministic action choices. In this mode the value of field `nspur' can be equal to 1; additionally, when loading assembler programs into nodes, states are assumed to begin just before user and mixed type instructions, and there is no need to mark the states by `stt' instructions. Setting field `is_determ_opt' to a non-zero value is only allowed when field dont_use_instr_class_weights' (see below) also has a non-zero value; otherwise, function `qsmm_create' will return QSMM_ERR_INVAL.
  • Function `qsmm_reg_program' will raise QSMM_ERR_NOSYS when is called for a multinode model created with field `is_determ_opt' of structure qsmm_desc_s' set to a non-zero value.
  • Added field `is_large_env' to structure `qsmm_desc_s'. If that field has a non-zero value, then a large actor will be created for the environment state identification engine of actor pair. It is only allowed when field `is_determ_opt' also has a non-zero value, field use_flat_storage' is equal to 0, and field `compat' is equal to 1. Otherwise, function `qsmm_create' will return QSMM_ERR_INVAL.
  • Added field `profile_pool_env_sz' to structure `qsmm_desc_s'. That field specifies the size of a pool of ordered probabilities lists used by the environment state identification engine of actor pair. Function qsmm_create' will return QSMM_ERR_INVAL if the value of the field is negative.
  • Added field `rng' to structure `qsmm_desc_s'. That field specifies a random number generator to use for the model. If the field has zero value, then default preudorandom number generator will be allocated by function `qsmm_create' and destroyed upon model destruction.
  • Function `qsmm_spur_delta' supports a call with argument `spur_type' equal to -1 when the environment state identification engine is represented by a large actor, in which case the function increments the value of automatic spur of a small actor associated with the large actor.
  • Added field `dont_use_instr_class_weights' to structure `qsmm_desc_s'. If this field has a non-zero value, then the multinode model engine will not set weights of output signals of the actor pair equal to instruction classes weights that can be specified for a node. This makes the multinode model to execute faster, especially when a sparse probability profile is specified for the action emission matrix of a node, and the number of instruction classes in the instruction class set of the node is large.
  • Added function `qsmm_get_use_instr_class_weights' that will return a positive value if field `dont_use_instr_class_weights' of structure qsmm_desc_s' has zero value when creating a multinode model, and will return 0 otherwise.
  • Functions `qsmm_set_instr_meta_class_weight', qsmm_get_instr_class_weight', `qsmm_set_instr_class_weight', qsmm_get_instr_class_weight_by_name_f', and qsmm_set_instr_class_weight_by_name_f' will raise QSMM_ERR_NOSYS when are called for a multinode model created with field dont_use_instr_class_weights' of structure `qsmm_desc_s' set to a non-zero value.
  • Instruction class sets are now allowed to contain only one instruction class. The description of error QSMM_ERR_NOIC has been changed accordingly.
  • Function `qsmm_node_create' now supports calls with argument `node' equal to -1, in which case the function tries to find an unused identifier for a new node. Upon successful completion, the function now returns the identifier of created node.
  • Added error code QSMM_ERR_MNODE, which indicates that an unused identifier for a new node cannot be found by function qsmm_node_create'. Added field `mnode', which corresponds to this error, to union `qsmm_except_u'; that field hands over information on the maximum allowed number of nodes in the model.
  • Added field `instr_param_str_p' to structure `qsmm_except_outcome_s' that corresponds to error code QSMM_ERR_OUTCOME. The field contains a textual representation of parameters of an instruction for which an invalid outcome was set. Field `instr_meta_class_name' of this structure now correctly hands over the name of meta-class of that instruction.
  • Function `qsmm_node_unload' can now be called for a node that belongs to a C function node class, in which case the function unloads statistics from storage of an actor that produces optimal actions on the basis of current environment states.
  • Added function `qsmm_node_destroy' for dynamic node destruction.
  • Functions `qsmm_reg_var_prob', `qsmm_node_var_realize', qsmm_get_node_var_prob', and `qsmm_set_node_var_prob' will raise QSMM_ERR_NOSYS if a large actor is used for the environment state identification engine of the actor pair.
  • Error code QSMM_ERR_PROFNOLD was replaced with QSMM_ERR_NOPROF. Error code QSMM_ERR_NOPROF means that a node does not have a probability profile loaded using function `qsmm_node_asm', cloned using function qsmm_node_profile_clone', or set using function qsmm_set_node_profile_source'. Added field `noprof' to union qsmm_except_u'. This field should be used instead of field `profnold' which is now marked as deprecated one.
  • Function `qsmm_node_call_default' will return QSMM_ERR_NOPROF if a non-zero value is specified in field `is_determ_opt' of structure qsmm_desc_s' when creating the multinode model, the node belongs to a
  • node class represented by an instruction class set, but does not have a probability profile loaded.
  • Function `qsmm_get_eh_instr_class_set_name' now correctly returns the
  • name of an instruction class set when is called from the event handler
  • function of the instruction class set.
  • Events QSMM_EVT_ENGINE_DONE are sent to entities in order, reverse to the order in which events QSMM_EVT_ENGINE_INIT were sent. Events QSMM_EVT_ENGINE_INIT are sent to entities in alphabetical order of entity names. Events QSMM_EVT_ENGINE_DONE are sent to entities in reverse alphabetical order of entity names.
  • Added field `prob_prec' to structures `qsmm_dump_mat_goto_desc_s' and qsmm_dump_mat_action_desc_s' that specifies the number of digits aftera decimal point to print for probabilities. A positive value corresponds to fixed-point notation. A negative value corresponds to exponential notation, and the number of digits is equal to the absolute value of the field. Zero value specifies the default mode.
  • Function `qsmm_mat_goto_dump' now dumps names of instruction classes that correspond to actions. If node states have names assigned to them by arguments of `stt' instructions, then now those state names will be dumped after state indices.
  • Function `qsmm_mat_action_dump', when possible, dumps names of instruction classes that correspond to actions and dumps names assigned to node states by arguments of `stt' instructions.
  • Functions `qsmm_mat_goto_dump' and `qsmm_mat_action_dump' now dump information in aligned fields. Fields of the same type have equal lengths.
  • Functions `qsmm_get_ptr' and `qsmm_set_ptr' now support arbitrary pointer indices, because pointer values are now stored in a map, not in a contiguous memory block.
  • Added functions `qsmm_set_node_ptr' and `qsmm_get_node_ptr', using which abritrary pointers can be associated with specific model nodes and then retrieved.
  • Changes for assembler programs processing:
  • Added support for `#' operator to the assembler preprocessor. That operator converts a symbol value to a string literal, as in C preprocessor. For example, sequence of tokens "prefix_" #sym "_suffix" will be converted to string literal "prefix_INFIX_suffix" if `sym' is defined to INFIX.
  • Added support for an optional argument of `stt' instruction that specifies a state name. State names of a node must be unique. Added function `qsmm_get_node_state_name' that retrieves the name of a node state specified by its index. Added function qsmm_get_node_state_by_name' that retrieves the index of a node state specified by its name. When the node uses a probability profile provided by another node, functions `qsmm_get_node_state_name' and qsmm_get_node_state_by_name' will return information on a state of a node that acts as the source of probability profile.
  • Added flag QSMM_NODE_CLONE_STATE_NAMES that can be passed to function qsmm_node_profile_clone' to clone node state names along with a node probability profile.
  • When used with an environment state identification engine represented by a large actor, function `qsmm_node_asm' will raise error QSMM_ERR_MPROF if there is no room in the pool to store a probability profile for an action choice state.
  • Functions `qsmm_node_asm' and `qsmm_get_prg_nstate' now take argument "unsigned int flags" (was reserved argument "int rez1") that specifies modes of their operation.
  • Added flag QSMM_ASM_DETERM_OPT that can be passed to functions qsmm_node_asm' and `qsmm_get_prg_nstate' via argument `flags'. The flag specifies that the action emission matrix defines only deterministic action choices. In this mode states begin just before user and mixed type instructions, and there is no need to mark unnamed states by `stt' instructions.
  • When it is specified that the action emission matrix defines only deterministic action choices, unreachable user and mixed type instructions will be detected when assembling a node. Information on unreachable instructions will be recorded in the message list.
  • Added flag QSMM_ASM_TEMPLATE that can be passed to function qsmm_node_asm' via argument `flags'. If this flag is specified, then a program to be assembled will be stored in the node as a template program. The template program will be used when disassembling the node by function `qsmm_node_disasm': a disassembled program will be a template program, in which profile probabilities in `jprob' and `case' instructions are replaced with calculated probabilities.
  • When calling function `qsmm_node_disasm' to disassemble a node, which was assembled with the QSMM_ASM_TEMPLATE flag, only values of fields do_calc_prob', `prob_goto_min', `prob_action_min', and `prob_type' of structure `qsmm_disasm_desc_s' will be taken into account, values of other fields will be ignored. Fields `prob_goto_min' and prob_action_min' specify minimum probabilities in `jprob' and `case' instructions, which must be retained in a disassembled program: instructions in a template program, to which lesser probabilities of type `prob_type' correspond, will not appear in the disassembled program.
  • When dumping an assembler program generated by function qsmm_node_disasm' for a node assembled with the QSMM_ASM_TEMPLATE flag, `jprob' instructions, which are used in ambiguous contexts, will have "?" printed for their probabilities.
  • If a node uses a probability profile provided by another node and the latter node was assembled with the QSMM_ASM_TEMPLATE flag, then when disassembling the former node, an assembler program template will be taken from the latter node.
  • Added flag QSMM_NODE_CLONE_TEMPLATE that can be passed to function qsmm_node_profile_clone' to clone a template program along with a node probability profile.
  • Introduced the concept of output probability variables, using which learnt probabilities in `jprob' and `case' instructions can be retrieved for a node. Every output probability variable should appear only once in `jprob' or `case' instructions and should be used in unambiguous context.
  • Added flag QSMM_ASM_VAR_OUT, which can be passed to functions collecting
  • information on output probability variables in a program being assembled. Output probability variables are also supported for a multinode model which environment state identification engine is represented by a large actor, and they need not be registered by function `qsmm_reg_var_prob'.
  • If flag QSMM_NODE_CLONE_VARS is passed to function qsmm_node_profile_clone', then the function will also clone information on output probability variables of a node if they exist.
  • Added function `qsmm_get_node_var_prob_out' that fetches the value of an output probability variable with specified name of a node. The type of a probability to fetch is specified using enumeration `qsmm_prob_e'. If a node uses a probability profile provided by another node and the latter node has output probability variables declared, then values of those probability variables can be retrieved by this function for a former node.
  • Added function `qsmm_enum_var_prob_out', which enumerates output probability variables of a node that appear in `jprob' and `case' instructions. If a node uses a probability profile provided by another node and the latter node has output probability variables declared, then those probability variables can be enumerated by this function for a former node.
  • Added flag QSMM_ASM_VAR_AUX that can be passed to functions qsmm_node_asm' and `qsmm_get_prg_nstate' via argument `flags'. The flag removes a restriction that every probability variable used in an assembler program must either be registered in its instruction class set by function `qsmm_reg_var_prob' or be an output probability variable. When this flag is specified, auxiliary probability variables may be defined in an assembler program, which will be replaced with their actual values at the time of loading the assembler program into a node. Auxiliary probability variables cannot be accessed after loading the assembler program into the node.
  • Introduced the concept of a probabilities list that can be declared in an assembler program. When the environment state identification engine is a small actor, a probabilities list is only a syntactical construction that can reduce the number of lines in an assembler program. But when the engine is a large actor, referencing the same probabilities list in the assembler program is a direct indication that a Huffman tree, which corresponds to that list, should be reused. This greatly speeds up loading an assembler program into a large actor, because otherwise the following time-consuming operation is performed: a new Huffman tree is created and analyzed whether it represents a probabilities list already contained in the pool.
  • Introduced the `probeq' directive, which declares a probabilities list of specified length `nn' that contains equal probabilities. The second optional argument of the directive specifies this equal probability and
  • can be a probability variable. If the second argument is not specified, then all elements of the list will be set equal to 1.0/(nn+1). The directive must be coded in a `.data' section of assembler program.
  • Introduced the `probls' directive, which declares a custom list of probabilities. Each probability can be a number or a variable. The directive must be coded in a `.data' section of assembler program.
  • Introduced the `casels' instruction (of type QSMM_INSTR_CASELS), which defines probabilistic jump locations that correspond to elements of probabilities list. The first instruction argument is the name of a probabilities list, and subsequent arguments are jump labels that correspond to elements of that list.
  • Function `qsmm_node_var_realize' will now raise error QSMM_ERR_PSUMGT1 if the sum of elements of a probabilities list used by a `casels' instruction exceeds 1. The description of the error has been made more general.
  • Introduced the concept of output probabilities arrays, using which probabilities that correspond to jump labels of `casels' instructions and to `case' instructions within `choice' instruction blocks can be retrieved for a node. Output probabilities arrays are referenced using location labels assigned to `casels' instructions and to `choice' instruction blocks.
  • Added function `qsmm_get_node_array_prob_out'. This function fetches a segment of elements of output probabilities array that correspond to jump labels of a `casels' instruction or to `case' instructions in a choice' instruction block. The `casels' instruction or the `choice' instruction block are specified by their location labels. The type of probabilities to fetch is specified using enumeration `qsmm_prob_e'. If a node uses a probability profile provided by another node and the latter node has output probabilities arrays declared, then the contents of those probabilities arrays can be retrieved by this function for a former node.
  • Added function `qsmm_node_var_out_forget' that destroys the cache of output probabilities, which is used to speed up fetching values of output probability variables and elements of output probabilities arrays of a node. That function is called implicitly when unloading a probability profile from the node, when executing function qsmm_node_call_default' for the node, after disassembling the node if it is assembled with the QSMM_ASM_TEMPLATE flag, and when destroying the model instance.
  • Added function `qsmm_get_instr_nlabel' that returns the number of location labels of an assembler instruction (which are printed before the instruction).
  • Added function `qsmm_get_instr_label' that returns a location label with specified index of an assembler instruction (which is printed before the instruction).
  • Added function `qsmm_get_instr_ls_name' that returns the name of a probabilities list associated with an assembler instruction.
  • Added function `qsmm_get_prg_ls_nprob' that returns the number of elements in a probabilities list with specified name of an assembler program.
  • Added field `do_print_state_name' to structure qsmm_dump_instr_desc_s'. If the field has a non-zero value, then state names, where they are present in `stt' instructions, will be printed with those instructions. The default is to print.
  • Added field `is_line_after_multiline_comment_right' to structure qsmm_dump_instr_desc_s'. A field with that name in structure qsmm_dump_prg_desc_s' was marked as deprecated one. A mode controlled by that field became a property of instruction, not a program, because there could be multiline `casels' instructions, where each line has a separate multiline comment to the right.
  • Negative values of field `prob_prec' of structure qsmm_dump_instr_desc_s' are now supported. They specify printing probabilities in `jprob' and `case' instructions in exponential notation. The number of digits after a decimal point is equal to the absolute value of the field. In fact, in all package releases, probabilities for `jprob' and `case' instructions in an assembler program could be specified in exponential notation.
  • Added field `margin_right_casels' to structure qsmm_dump_instr_desc_s'. That field specifies a right margin for lists in arguments of `casels' instructions.
  • Added field `nline_casels' to structure `qsmm_dump_instr_desc_s'. The number of lines of a `casels' instruction printed by function qsmm_instr_str' is written there.
  • Added field `are_lines_around_multiline_casels' to structure qsmm_dump_prg_desc_s'. The field specifies whether to insert an empty line before and after a multiline `casels' instruction.
  • Added field `margin_right_ls' to structure `qsmm_dump_prg_desc_s'. The field specifies a right margin for elements of probabilities lists in list declarations using `probls' directives.
  • Added field `do_print_comment_tail' to structure qsmm_dump_prg_desc_s'. The field specifies whether to print a comment at the end of an assembler program if the program has that comment. In the previous package releases that comment would always printed if it were present.
  • Functions `qsmm_parse_asm_source_stream' and qsmm_preprocess_asm_source_stream' now correctly support reading an assembler program from `stdin' when the text of the assembler program is typed on the console.
  • The assembler preprocessor now supports up to 65535 nested macro expansions.
  • Changes for the implementation of functionality of STL `map' template:
  • The implementation was completely rewritten in C. The dependency of the package on a C++ compiler and a C++ linker has been removed.
  • Added map and multimap constructors `qsmm_map_create_sz' and qsmm_map_multi_create_sz' that take key size and value size in bytes as additional arguments. If value size is zero, then the map or the multimap will represent a set or a multiset. If key size and/or value size are negative, then it will be assumed that keys and/or values are untyped pointers. If key size and/or value size are positive, then it will be assumed that keys and/or values are memory blocks of specified sizes in bytes.
  • For conserving memory, it is recommended to specify positive key and/or value sizes, in which case room for keys and/or values is automatically reserved at the end of memory blocks that correspond to key-value pairs. This typically decreases the required number of memory block allocations/deallocations, thereby reducing memory blocks management overhead: the footprint of memory management structures and time spent for memory management operations.
  • When key size and/or value size are positive, function qsmm_map_insert' copies memory blocks, pointed by arguments `keyp' and/or `valp', to an area at the end of a newly allocated key-value pair object. If value size is positive and valp==NULL, then the value in the key-value pair will be initialized with zero bytes.
  • When key size and/or value size are positive, functions qsmm_map_iter_key' and/or `qsmm_map_iter_val' return pointers to key and/or value memory blocks located in an area at the end of a key-value pair object addressed by the iterator.
  • When value size is positive, function `qsmm_map_iter_set_val' copies a memory block, pointed by `valp' argument (if valp!=NULL), to the area at the end of a key-value pair object addressed by the iterator.
  • Added functions `qsmm_map_key_sz' and `qsmm_map_val_sz' that return the size of map keys and map values. When the size is negative, keys or values are untyped pointers (the only supported mode in previous package releases). When the size is positive, it is the size in bytes of memory blocks for map keys or map values located at the end of key-value pair objects. When value size is zero, the map or the multimap represents a set or a multiset.
  • Added functions `qsmm_map_key_compar_func' and qsmm_map_key_compar_param' that return a pointer to a key comparison function and to its parameters specified when creating the map or the multimap.
  • Added functions `qsmm_map_iter_end', `qsmm_map_iter_rbegin', qsmm_map_iter_rend', and `qsmm_map_iter_prev' that mimic the functionality of methods `end', `rbegin', and `rend' of `map' and multimap' templates, and of `operator--' of iterators.
  • The return type of function `qsmm_map_size' was changed to `size_t'.
  • Changes for sample program `tohuff-test':
  • Program `tohuff-test' now internally generates assembler programs that provide deterministic choice of assembler instructions by an engine, which produces optimal actions on the basis of current assembler program states. Option `--kt-opt', which specifies the temperature of that engine, was removed.
  • The type of relative probability function of the environment state identification engine was set to QSMM_RELPROB_BUILTIN2.
  • Now the model uses 3 spur types. Spur of type 1 is incremented blogarithms of probabilities of pairs encountered during model execution. Spur of type 0 of the environment state identification engine (which is automatic spur) and spur of type 1 both have weights 0.5 and countervail spur of type 2, which has weight 1, an inverse way of perception, and is equal to the sum of logarithms of probabilities (which were randomly generated at program start) of output signals emitted during model execution.
  • The program can now internally build n-ary, not only binary trees. Tree arity can be specified using option `-A, --tree-arity=INT'.
  • The program now uses a compatibility level of algorithms equal to 1.
  • The program now works differently with a pseudorandom number generator. The generator is created and seeded once and then set for a multinode model (using new field 'rng' of structure `qsmm_desc_s') at each test pass.
  • Efficiency `efa' was renamed to `ef1'. Additional efficiency `ef2' is calculated and printed in the test log. Efficiency `ef2' depends on thesum of Euclidean distances between vectors of random probabilities, generated at program start, and vectors of actual probabilities of output signals emitted during model execution. Efficiency `ef2' will be 100% when the sum of distances between those vectors is zero, and will be 0% when the sum of distances is equal to the number of input signals. The sum of distances is printed in column `distance' of test log.
  • Changes made for program `tohuff-test' now allow to achieve moderate efficiency `ef1' without tuning the temperature of the environment state identification engine using option `--kt-env'. The efficiency could be achieved when the number of steps in a test pass is sufficient.
  • Because of the changes made, the program now prints different results compared to its version included in the previous package release.
  • Additional changes for sample program `test':
  • Added option `-c, --compat=INT'. That option allows to specify a compatibility level of algorithms used by the program in a mode when a single actor is used, i.e. no environment state tracking is performed. The level can be 0 or 1. Default value is 0.
  • Added option `-L, --large[=INT]'. If this option is given to the program and a single actor is used, i.e. no environment state tracking is performed, then that actor will be created as the large one. Tree arity can be specified as an argument of the option. By default, a binary tree is created.
  • Added option `-a, --auto-spur'. This option turns on the use of automatic spur by a single actor, i.e. when no environment state tracking is performed.
  • Added option `-P, --relprob-type=0|1|2'. This option allows to specify the type of a function that returns a relative probability of output signal choice by a single actor, i.e. when no environment state tracking is performed. Value 0 corresponds to function e^(C/T), default value 1 corresponds to a function used in previous package releases, and value 2 corresponds to an alternative function introduced in this package release.
  • Added options `--kt=FLOAT', `--kt-env=FLOAT', and `--kt-opt=FLOAT', which allow to specify the temperature of the single actor or actors that comprise the actor pair. Default temperature is 1.
  • Changes for sample program `asm-disasm':
  • Added option `--use-stt'. That option turns on generation of `stt' instructions in a disassembled program.
  • Added option `-D, --determ-mat-action'. That option controls which value is assigned to field `is_determ_opt' of structure `qsmm_desc_s' and specifies whether the action emission matrix must define only deterministic action choices.
  • Added option `-L, --large=INT'. That option can be used in conjuction with option `-D' to indicate that the environment state identification engine must be represented by a large actor. An argument of option `-L' specifies the size of the pool of ordered probabilities lists, which should be large enough to hold all those lists explicitly and/or implicitly defined in an assembler program.
  • Added option `--template'. That option turns on generating a disassembled program using a template which is a program to assemble.
  • Added option `--prob-goto-min=FLOAT'. When option `--template' is not given, this option specifies the minimum probability of state transition; transitions with lesser probabilities will be discarded when disassembling the node. When option `--template' is given, this option specifies the minimum probability in `jprob' and `case' instructions that correspond to the state transition matrix; instructions with lesser probabilities will be removed when disassembling the node.
  • Added option `--prob-action-min=FLOAT'. When option `--template' is not given, this option specifies the minimum probability of invocation of user or mixed type instruction; instructions with lesser probabilities will be discarded when disassembling the node. When option `--template' is given, this option specifies the minimum probability in `jprob' and case' instructions that correspond to the action emission matrix; these instructions with lesser probabilities will be removed when disassembling the node.
  • Added option `--prob-prec-mat=INT' that specifies the number of digits after a decimal point to print for probabilities in the state transition matrix and in the action emission matrix. If an argument of the option is positive, then fixed-point notation will be used. If the argument is negative, then exponential notation will be used, and the number of digits will be equal to the absolute value of the argument. Zero argument specifies the default mode.
  • Added option `--dump-var-out[=FILE]' that makes the program to dump values of output probability variables.
  • Added option `--dump-var-choice', which makes the program to dump output probabilities arrays that correspond to `choice' instruction blocks with location labels assigned. When option `--template' is specified, all `casels' instructions encountered in an assembler program (in fact, except for `casels' instructions with only one jump label in their arguments) will be converted to `choice' instruction blocks, and output probabilities, which correspond to `case' instructions in these blocks, can be dumped using this option.
  • Added option `--no-nop' that disables registering instruction class nop'.
  • Added option `--dont-reg-vars' that suppresses registering controlled probability variables using macro QSMM_REG_VAR_PROB.
  • Added option `-S, --storage' that specifies a type of storage used by the program. The default storage type is `map'.
  • The program now does not prepend a dump of action emission matrix with indices and names of instruction classes, because the new format of the dump provides output of instruction class names after action indices.
  • Changes for sample program `parse-asm':
  • Added option `--prob-prec=INT', using which the number of digits after a decimal point to print for probabilities can be specified. A non-negative argument of the option specifies fixed-point notation. A negative argument specifies exponential notation, and the number of digits is equal to the absolute value of the argument. The option is ignored when option `-E' is specified.
  • Added option `--no-preprocess' that turns off calling the assembler preprocessor before parsing an assembler program. The option is ignored when option `-E' is specified.
  • Added option '--strip-comments' that suppresses printing comments in an assembler program. The option is ignored when option `-E' is specified.
  • Added option `--no-space-after-comma'. If that option is specified, then spaces after commas not within comments and string literals will not be printed in the reformatted text of assembler program. The option is ignored when option `-E' is specified.
  • Changes for sample program `asmenv':
  • The program can now perform multiple test passes. The number of test passes is specified by option `-t, --test=INT' (the default value is
  • 1). For each test pass there are printed values of spur accumulated by the system when it behaves normally and when it behaves (almost) completely randomly. At the end of the table with test results there are printed the sums and the standard deviation of those values.
  • Added option `-o FILE' that specifies a file for dumping the program output. The output includes test parameters and a table with test results.
  • The number of steps in each test pass (a step is interchange of a signal between the system and the environment in both directions) is now specified by option `-n, --nstep-pass=INT', which replaces option n, --nstep'. The default number of steps is 10000.
  • The program supports the use of a profile assembler program of the system. The name of a file with the profile assembler program can be specified using option `-I, --in-prg-sys=FILE'.
  • The program supports the special situation when a profile assembler program specifies an action emission matrix that defines deterministic action choices. When option `-D, --determ-mat-action' is given to the program, no warnings about missing `stt' instructions will be generated.
  • When option `-D, --determ-mat-action' is given to the program, option P, --relprob-type=0|1|2' can be specified, which sets the type of a function that returns a relative probability of output signal choice. Default type 1 corresponds to a function described in the accompanying paper.
  • A letter for option `--prg-env=FILE' was changed from `-P' to `-p',
  • because letter `-P' is now used for option `--relprob-type=0|1|2', as
  • in other sample programs.
  • When option `-D, --determ-mat-action' is given to the program, option L, --large=INT' can be specified, which makes the system to use a large actor for the environment state identification engine. An argument of option `-L' specifies the size of the pool of ordered probabilities lists, which should be large enough to hold all those lists explicitly and/or implicitly defined in a profile assembler program.
  • Added option `--template'. That option turns on generating a disassembled program of the system and dumping it to a file, specified by option `-O, --out-prg-sys=FILE', using a template, which is a profile assembler program read from a file specified by option `-I, in-prg-sys=FILE'.
  • Added option `--determ-prg-sys' that turns on generating a completely deterministic assembler program of the system. The option has an effect when option `-O, --out-prg-sys=FILE' is specified and option template' is not given.
  • Added option `--dump-var-out=FILE', which makes the program to dump values of output probability variables and arrays of the node. Probabilities, which correspond to jump labels of `casels' instructions, will be dumped only when option `--template' is not specified.
  • Changes for other sample programs:
  • Program `optact' now uses a compatibility level of actor algorithms equal to 1. This does not change results printed by the program, but is the correct approach that could help when the program is modified for research purposes.
  • Program `apsamp' now uses a compatibility level of actor pair algorithms equal to 1. Because of this change, the program now prints different results compared to its version included in the previous package release.
  • Program `labyr' now uses a compatibility level of multinode model algorithms equal to 1. In practice, this does not change results printed by the program, but is the correct approach that could help nwhen the program is modified for research purposes.
  • Programs `maze' and `maze-mt' now use flat storage for storing statistics, which increases the speed of operation of those programs.
  • Programs `maze' and `maze-mt' now use a compatibility level of algorithms of the multinode model equal to 1. To compensate shortening the length of discrete cycle period used when calculating a relative probability of output signal choice, the default system temperature was decreased from 0.05 to 0.025. Because of these changes, the programs now print different results compared to their versions included in the previous package release.
  • Program `maze-mt' now does not output the text of disassembled program, because the disassembled program cannot be used directly to control movement of the agent in the labyrinth. Sets of allowed movement directions at labyrinth nodes are determined by the agent on the basis of input from the environment (labyrinth) every time the agent has to choose a movement direction and are not reflected in the disassembled program.
  • Program `fw-simple' now uses a compatibility level of multinode model algorithms equal to 1. Because of this change, the program now produces different results compared to its version included in the previous package release.
  • Program `fqtab' now does not use a multimap to sort words in descending order by frequency, because in the current implementation a multimap does not store key-value pairs in order, in which they were added to the multimap, and the program would print unstable results.
  • Program `asmat' now internally generates much shorter assembler program. At the end of execution, learnt probabilities in the state transition matrix and in the action emission matrix of the node are fetched from the node using function `qsmm_get_node_array_prob_out' and dumped to file "var_out".
  • Program `asmat' now uses a compatibility level of algorithms of the multinode model equal to 1. Because of this change, the program now prints different results compared to its version included in the previous package release.
  • Program `tohuff' was removed from the set of sample programs, because its function is performed by a more general program `tohuff-test'.
  • Added sample program `optpath' that demonstrates how to code state transition networks using assembler programs and perform the search of optimal path in those networks.
  • Added sample program `optact-p', which performs a function similar to program `tohuff-test', but creates an actor (which can be large one), not a multinode model. The program can be used to compare operating efficiency of small and large actors for various values of their parameters.
  • Added sample program `predict-test', which learns a state model that corresponds to a symbol sequence. The program uses the alternative form of relative probability function, which supports learning a state model without using increments in spur that have to be explicitly provided by an opposite interaction party. The symbol sequence has to be specified in the form of a deterministic probabilistic finite automaton. Several types of probability profiles for the state transition matrix can be used. An actor, which learns a state model, can be large one.
  • Other changes:
  • Added option `--enable-coverage' to the `configure' script. That option configures the package for using `gcov', a coverage testing tool.
  • Significantly decreased the number of allocated memory blocks when adding information about a state or a cycle type to map storage. This was made possible by using new function `qsmm_map_create_sz' for creating maps used by the storage. Now state and cycle type information is stored directly in memory blocks of key-value pair objects. This reduces the memory footprint of map storage.
  • Storage API functions `qsmm_storage_enum_states', qsmm_storage_remove_state', `qsmm_get_storage_state_stats',
  • qsmm_set_storage_state_stats', `qsmm_get_storage_cycle_stats', qsmm_set_storage_cycle_stats', and `qsmm_get_storage_cycle_next' may now return QSMM_ERR_NGRAM if an n-gram passed to them has invalid contents.
  • Added function `qsmm_rng_create_custom' that creates a random number generator based on a user-supplied function.
  • Added functions `qsmm_get_rng_default' and `qsmm_set_rng_default' that retrieve and set a user-supplied function, on the basis of which random number generators will be created by function `qsmm_rng_create'.
  • Added function `qsmm_vec_clone' that creates a copy of a vector.
  • The number of elements actually stored in an ordinary vector may be less than the number of vector dimensions if the vector is a copy of another vector created by function `qsmm_vec_clone'. In this case only a range of elements that includes elements, which values were set, may be copied from a source vector. Therefore, for an ordinary vector, function `qsmm_get_vec_npos' may return a number less than the number of vector dimensions, and to access elements of the vector, functions qsmm_get_vec_pos_by_idx' and `qsmm_get_vec_elm_by_pos' should be used, as for a sparse vector.
  • Added function `qsmm_vec_destroy' that can be used to destroy a copy of vector created by function `qsmm_vec_clone'.
  • Model execution trace log and side trace log now have a compact and readable format.
  • Side API functions were renamed to conform to the established naming scheme: `qsmm_side_get_name' to `qsmm_get_side_name', qsmm_side_get_trace_flags' to `qsmm_get_side_trace_flags', qsmm_side_get_trace_stream' to `qsmm_get_side_trace_stream', qsmm_side_set_trace_flags' to `qsmm_set_side_trace_flags', qsmm_side_set_err_handler' to `qsmm_set_side_err_handler', qsmm_side_get_err_handler' to `qsmm_get_side_err_handler', qsmm_side_set_trace_stream' to `qsmm_set_side_trace_stream'. The deprecated old functions are still available via aliases.

New in QSMM 1.14 Beta (Jul 30, 2012)

  • Fixed a bug: function `qsmm_actor_calc_action_prob' could sometimes
  • generate positive probabilities of output signals choice when
  • corresponding profile probabilities were zero. In some circumstances,
  • this could break proper execution of an assembler program loaded into a
  • node.
  • Changed a type of `qsmm_sig_t' from (unsigned short) to (unsigned int),
  • which allows to work with huge numbers of signals, nodes, and states.
  • Implemented a possibility to use sparse vectors by an actor for storing
  • probabilities of output signals choice. This allows fast execution of
  • an assembler program that specifies sparse probability profiles for a
  • state transition matrix and an action emission matrix and contains
  • thousands of states. Before this improvement, execution of such an
  • assembler program, which contained merely a hundred of states, was
  • extremely slow.
  • Added field `sparse_fill_max' to structures `qsmm_desc_s',
  • qsmm_actor_desc_s', and `qsmm_actpair_desc_s'. This field specifies
  • the maximum fill ratio for vectors that hold probabilities of action
  • signals choice, on the basis of which the actor decides when to use
  • sparse vectors instead of ordinary vectors. Value 0 indicates that
  • ordinary vectors must always be used; value 1 indicates that sparse
  • vectors must always be used; values between 0 and 1 indicate the
  • maximum fill percentage (divided by 100) of sparse vectors. Added
  • function `qsmm_get_actor_sparse_fill_max' that returns a value of
  • field `sparse_fill_max', specified when creating the actor.
  • Introduced a vector handle of type `qsmm_vec_t' that corresponds to an
  • ordinary or a sparse vector.
  • Added functions `qsmm_get_vec_npos', `qsmm_get_vec_pos_by_idx', and
  • qsmm_get_vec_elm_by_pos', which can be used to access elements of an
  • ordinary or a sparse vector, specified by its handle.
  • Added function `qsmm_get_actor_choice_sig_prob_vec' that returns a
  • handle of a vector that holds probabilities of output signals choice.
  • The returned handle can be used to get the contents of a sparse array
  • of probabilities calculated by function `qsmm_actor_calc_action_prob'.
  • Added function `qsmm_actor_choice_sig_prob_release'. Function
  • qsmm_get_actor_choice_sig_prob' now locks the vector with
  • probabilities of output signals choice, so the vector will be an
  • ordinary, not a sparse vector until function
  • qsmm_actor_choice_sig_prob_release' is called. Function
  • qsmm_get_actor_choice_sig_prob' returns a pointer to the contents of
  • that ordinary vector, using which the vector can be inspected or
  • modified.
  • Added type `qsmm_get_cycle_next_func_t' for a redirection function,
  • which returns the next type of cycles that start at specified state;
  • added functions `qsmm_get_storage_cycle_next_redir' and
  • qsmm_set_storage_cycle_next_redir', which retrieve and set that
  • redirection function for storage. The redirection function became
  • necessary for proper execution of nodes, which use other nodes as a
  • source of probability profile. For the former nodes, the redirection
  • function provides correct enumeration of cycle types, which have
  • profile probabilities specified, when determining which elements to
  • store in a sparse vector that holds probabilities of output signals
  • choice.
  • Functions `qsmm_mat_goto_dump' and `qsmm_mat_action_dump' now do not
  • output rows that correspond to transition target states and actions,
  • information on which is absent is storage. This reduces the length of
  • output when dumping sparse matrices.
  • Function `qsmm_node_var_realize' now updates fields `nsig_pos' and
  • nsig_ctrl' of structure `qsmm_state_s', which holds conditions for
  • action choice states, after changing profile probabilities.
  • Function `qsmm_get_storage_msglist' now may not return 0.
  • Added function `qsmm_get_actor_sig_action' that should be used instead
  • of function `qsmm_actor_get_sig_action'. The deprecated old function is
  • still available.
  • Added function `qsmm_get_storage_state_stats_redir' that should be used
  • instead of function `qsmm_get_storage_state_redir'; added function
  • qsmm_set_storage_state_stats_redir' that should be used instead of
  • function `qsmm_set_storage_state_redir'. The deprecated old functions
  • are still available.
  • Added function `qsmm_get_storage_cycle_stats_redir' that should be used
  • instead of function `qsmm_get_storage_cycle_redir'; added function
  • qsmm_set_storage_cycle_stats_redir' that should be used instead of
  • function `qsmm_set_storage_cycle_redir'. The deprecated old functions
  • are still available.
  • Added option "-T, --ktemperature=FLOAT" to program `asmenv'. That
  • option allows to specify the temperature of the system. The
  • specification may be necessary to achieve efficient operation of the
  • system for certain kinds of the environment.
  • Added sample program `tohuff-test', which performs a function similar
  • to a function performed by sample program `tohuff', but dynamically
  • creates a binary tree of arbitrary height. By default, sparse vectors
  • are used to store optimal probabilities of output signals choice, which
  • allows fast execution of the assembler program. Program `tohuff_test'
  • supports arguments for specifying temperatures of actors that comprise
  • the actor pair. Specification of temperatures less than 1 is needed to
  • achieve efficient operation of the assembler program for tall binary
  • trees.
  • Added sample program `maze', which implements an agent that walks in a
  • labyrinth, already hard-coded in sample program `labyr'. But in program
  • maze' the agent receives limited information about the labyrinth and
  • has to learn its configuration on its own. This sample program is
  • described in section "Example of Using an Instruction Class Set" of the
  • manual.
  • Added sample program `maze-mt', which performs the same function as
  • sample program `maze', but is multithreaded one and uses the QSMM Side
  • API. The program is described in subsection "Example Program that
  • Exchanges Data Packets" of the manual.