[ Home | What's New | Contents | Overview | Contributors | Distribution | Examples | Documentation | Manual | Publications | Mailing List Archive | Problems ] This page was last updated by Axel Belinfante on 2006-06-30
TorX Test Tool Information
Prev   Next

iochooser(1) - suggest by probabilities to stimulate or observe

Table of Contents


iochooser - suggest by probabilities to stimulate or observe


iochooser [ -s seed ] [ -debug ] [ bound:value [ :... ] ]


iochooser can be used as a filter between the TorX Driver and a TorX Primer, to use probabilities in the decision between stimulating and observing. The iochooser program intercepts the C_IOKIND commands send from Driver to Primer, and, when such a command does not have a ``suggestion'' already (which means that the Driver leaves the decision to the Primer), the iochooser adds a ``suggestion'', using probabilities.


The following command line options are supported:
-s seed
specify the seed for the random number generator (default value: 0)
generate debugging output
specify the possible suggestion values, and their probabilities. This argument is a single string of colon (:) separated fields. There should always be an even number of fields. Two subsequent fields specify a bound and a suggestion value. The bound values should be between 0.0 and 1.0, and should increase from left to right. iochooser uses this argument as follows: When a suggestion value has to be generated, iochooser generates a random number between 0.0 and 1.0. It then compares the generated number with the bounds, from left to right, and uses the value field of the first bound in the argument that is greater or equal to the generated number. (default value: 0.5:iokind=input:1.0:iokind=output )


Below we show a sh(1) shell script that demonstrates how iochooser can be put as filter between the Driver and a Primer. The shell script should be specified as explorer/primer program in a torx-config(4) configuration (i.e. as value of a SPEC line). It assumes that the probability of doing an input, and the ``real'' explorer/primer program are specified as SPECFLAGS value in the torx-config(4) configuration file.

## We assume that we specify the probability and the primer program
## as values of SPECFLAGS in the torx-config(4) configuration file,
## as in:
##     SPECFLAGS 0.3 /my/path/to/my/real/primer
## which means they will be the last values in the argument list
## given to this script.
## We store those two values in variables PROB resp. PRIMER,
## and then strip them from the list of arguments with which
## we invoke the primer.
## NOTE there should be (hopefully is) a better way to do the
## command line argument dance below.
# use: number of arguments we consume here
if [ $# -lt $use ]
    echo "usage: script [ primer-args... ] prob primer" 1>&2
    exit 1
## construct command (cmd) to re-set the positional parameters
## to the list of n that we want to pass to the primer, like:
##        set "$1"  "$2" ... "$n"
## and set PROB and PRIMER
n=`expr $# - $use`
while [ $i -le $n ]
    cmd="$cmd \"\$$i\""
    i=`expr $i + 1`
eval PROB=\$$i
i=`expr $i + 1`
eval PRIMER=\$$i
i=`expr $i + 1`
## only eval the command to re-set the positional parameters
## if there are positional parameters to be set
## otherwise, unset the positional parameters using shift
## (old bourne shells do not allow an argument to shift)
if [ $# -gt $use ]
    eval $cmd
    while [ $i -le $use ]
        i=`expr $i + 1`
## ready to start the real work
## xtorx will make sure that iochooser is in its PATH
if [ -n "$PROB" ]
    iochooser -s 0 $bounds_values | $PRIMER "$@"
    $PRIMER "$@"

See Also

torx-intro(1), torx(1), torx-primer(5), torx-config(4), sh(1)


By Email: <torx_support@cs.utwente.nl>


This manual page documents version 3.9.0 of torx.

Table of Contents

Prev Table of Contents Next
Appendix D: TorX Manual Pages: intersector(1) - combine multiple torx primers Valid HTML 4.01! Appendix D: TorX Manual Pages: pui(1) - simple primer user interface