Next: , Previous: , Up: Example Programs   [Contents][Index]


7.10 optact-p

This program can be used to test operation of small and large actors in various modes. Here the goal of the operation of an actor is the maximization of the product of probabilities of output signals emitted by the actor. Probabilities of output signals of the actor for its every input signal are randomly generated at the beginning of program execution. That is, the goal of the operation of the actor is analogous to the goal of the operation of the tohuff-test program.

You should invoke the optact-p program with two arguments. The first argument specifies the number of input signals of the actor. The second argument specifies the number of output signals of the actor.

The program understands the following command-line options.

-a, --auto-spur

Use automatic spur. Its increment is performed every time the actor emits an output signal. In the description of test modes is denoted by ‘Automatic spur’.

--dump-prob=learnt|fq

Type of probabilities of output signals to dump.

learnt

QSMM_PROB_LEARNED: learned probabilities.

fq

QSMM_PROB_FQ: probabilities proportional to observed frequencies of emitting output signals (default mode).

This option takes effect when the option -t is not specified.

-i, --seed=INT

A seed to initialize the pseudorandom number generator. Default value is 0. In the description of test modes is denoted by ‘Random seed’.

--kt=FLOAT

The temperature (multiplied by some constant) of the actor. Default value is 1. In the description of test modes is denoted by ‘K*temp.’.

-L, --large[=INT]

Use a large actor with specified tree arity. Default value is 2. In the description of test modes is denoted by ‘Large’ and ‘Tree arity’.

-n, --nstep-pass=INT

The number of input signals to receive and output signals to emit during each test pass. Default value is 10000. In the description of test modes is denoted by ‘Steps per pass’.

-o FILE

A file to write program output to instead of stdout.

-P, --relprob-type=0|1|2|3

The type of a function that returns a relative probability of output signal choice.

0

QSMM_RELPROB_USER1 without a helper function provided.

1

QSMM_RELPROB_BUILTIN1.

2

QSMM_RELPROB_BUILTIN2 (default mode).

3

QSMM_RELPROB_BUILTIN3.

In the description of test modes is denoted by ‘R. prob. type’.

-t, --test=INT

Perform the test specified number of passes. In the description of test modes is denoted by ‘Passes’.

Like the tohuff-test program, the optact-p program can be invoked in two modes. In the first mode, when the option -t INT is not given to the program, a single test pass is performed, probabilities of emitting output signals and numbers indicating operating optimality are printed as a result of program invocation. In the second mode, when the option -t INT is given to the program, a specified number of test passes is performed, and numbers that indicate operating optimality are calculated for each test pass. In both modes, the program prints the following numbers related to operating optimality.

earned

Is equal to the logarithm of the product of probabilities of output signals emitted. Each time an output signal is emitted the product of probabilities is multiplied by a corresponding output signal probability (for specific input signal), which was randomly generated at the beginning of program execution.

random

Is the logarithm of the product of probabilities of output signals (see a description of ‘earned’ number) calculated for the situation when for every input signal total counts of all output signals emitted are equal.

maximal

Is the logarithm of the product of probabilities of output signals (see a description of ‘earned’ number) calculated for the situation when for every input signal an output signal with the maximum probability is always emitted.

distance

The sum of Euclidean distances between pairs of vectors for all input signals, where the first vector of pair is the vector of probabilities of output signals randomly generated at the beginning of program execution, and the second vector of pair is the vector of probabilities of output signals calculated on the basis of actual numbers of times those signals were emitted for an input signal.

ef1

Efficiency equal to (earned-random)/(maximal-random)*100%.

ef2

Efficiency equal to (1-distance/(nsigIn·√2))*100%,  where nsigIn is the number of input signals of the actor.

To perform a single test pass, do not give the option -t INT to the program. Sample program output for this method of program invocation is shown below.

$ ./optact-p -i1 -a -n40000 --dump-prob=learnt 5 8
 Input signals: 5
Output signals: 8
Steps per pass: 40000
         Large: off
 R. prob. type: 2
Automatic spur: on
       K*temp.: 1.000000000000000E+00
   Random seed: 1

Type of probabilities (multiplied by 100) after slashes: QSMM_PROB_LEARNED

 0: .09/010 .22/023 .16/015 .21/020 .00/000 .03/004 .07/007 .22/022
 1: .06/007 .10/010 .04/004 .16/015 .08/007 .16/016 .14/012 .27/028
 2: .09/009 .20/022 .12/011 .18/019 .09/008 .07/007 .15/014 .11/009
 3: .05/006 .11/010 .23/024 .06/006 .01/002 .14/016 .17/014 .23/022
 4: .11/010 .12/010 .14/015 .11/012 .04/005 .24/026 .05/006 .20/016

  earned: -77632.7
  random: -98287.4
 maximal: -58330.1

distance: 2.95844925E-01

     ef1: 51.7 %
     ef2: 95.8 %

The program output begins with a description of test modes used. After the description there goes a table, where each row represents an input signal and starts with its index followed by number pairs that correspond to output signals. The first element of every pair is an output signal probability randomly generated at the beginning of program execution. According to that probability a spur increment is made when the corresponding output signal is emitted upon receiving the input signal. The second element of every pair is the output signal probability (in percentage terms) of type QSMM_PROB_LEARNED or QSMM_PROB_FQ (see the option --dump-prob=learnt|fq). The sum of percentages in each row of the table is ≈100%. Numbers that indicate operating optimality are printed after the table.

As it can be seen from the table above, in the selected mode of program invocation, learned probabilities of emitting output signals are approximately equal to random probabilities of output signals generated at the beginning of program execution.

To perform a test consisting of test passes, give the option -t INT to the program and specify the number of test passes as the argument of that option. Below is sample program output for this method of program invocation.

$ ./optact-p -i1 -t10 -a -n80000 4 64
 Input signals: 4
Output signals: 64
        Passes: 10
Steps per pass: 80000
         Large: off
 R. prob. type: 2
Automatic spur: on
       K*temp.: 1.000000000000000E+00
   Random seed: 1

pass   earned   random  maximal       distance   % ef1   % ef2
---- -------- -------- -------- -------------- ------- -------
   1  -318992  -360993  -277032 1.84619024E-01    50.0    96.7
   2  -318230  -358924  -279535 1.80716868E-01    51.3    96.8
   3  -320984  -351922  -281495 1.83816822E-01    43.9    96.8
   4  -319879  -355205  -277930 1.90002813E-01    45.7    96.6
   5  -318188  -354105  -275123 1.96099943E-01    45.5    96.5
   6  -317712  -357724  -273396 1.82284303E-01    47.4    96.8
   7  -321754  -355919  -281390 1.78340284E-01    45.8    96.8
   8  -321543  -353646  -282737 1.80150290E-01    45.3    96.8
   9  -320502  -358849  -279461 1.64751281E-01    48.3    97.1
  10  -319621  -356046  -279534 1.72587057E-01    47.6    96.9

TOTL -3197405 -3563333 -2787633 1.81336868E+00    47.2    96.8

stddev ef1:   2.3
stddev ef2:   0.2

The output begins with a description of test modes used. After the description there goes a table containing numbers that indicate operating optimality of the actor at every test pass, with a summary row. Values ‘earned’, ‘random’, ‘maximal’, and ‘distance’ in the summary row are equal to sums of those values in preceding rows of the table. Values ‘% ef1’ and ‘% ef2’ in the summary row are calculated based on other values in that row. At the end of the output the standard deviation of values ‘% ef1’ and ‘% ef2’ is printed.

Reference results of program invocation are represented below. Values of ‘% ef1’ and ‘% ef2’ were taken from summary rows of test logs.

Options                      % ef1  % ef2
===========================  =====  =====
-i1 -t100 -a -n10000  4  64   40.7   94.0
-i1 -t100 -a -n20000  4  64   44.4   95.0
---------------------------  -----  -----
-i1 -t100 -a -n10000  8  64   30.6   91.9
-i1 -t100 -a -n20000  8  64   35.2   93.4
-i1 -t100 -a -n40000  8  64   38.4   94.7
---------------------------  -----  -----
-i1 -t100 -a -n10000  4 128   37.1   94.4
-i1 -t100 -a -n20000  4 128   40.7   95.4
---------------------------  -----  -----
-i1 -t100 -a -n10000  4 256   31.4   95.2
-i1 -t100 -a -n20000  4 256   36.7   95.9
-i1 -t100 -a -n40000  4 256   40.7   96.6
===========================  =====  =====

In comparison with results represented in the table at the end of tohuff-test, in the table above the value of ‘% ef2’ increases as the number of steps at a test pass increases.


Next: , Previous: , Up: Example Programs   [Contents][Index]