next up previous contents index
Next: Batchman Example Programs Up: SNNS Function Calls Previous: Pattern Function Calls

Special Functions

There are four miscelaneous functions for the use in batchman

The function call pruneNet() is pruning a net equivalent to the pruning in the graphical user interface. After all functions and parameters are set with the call setPruningFunc the pruneNet() function call can be executed. No parameters are necessary:


An interface to the Unix operation system can be created by using the function execute. This function call enables the user to start a program at the Unix command line and redirect its output to the batch program. All Unix help programs can be used to make this special function a very powerful tool. The format is:

execute (instruction, variable1, variable2.....)

where `instruction' is a Unix instruction or a Unix program. All output, generated by the Unix command has to be separated by blanks and has to be placed in one line. If this is not done automatically please use the Unix commands AWK or grep to format the output as needed. Those commands are able to produce such a format. The output generated by the program will be assigned, according to the order of the output sequences, to the variables variable1, variable2.. The data type of the generated output is automatically set to one of the four data types of the batch interpreter. Additionally the exit state of the Unix program is saved in the system variable EXIT_CODE. An example for execute is:

execute ("date", one, two, three, four)
print ("It is ", four, " o'clock")

This function call calls the command date and reads the output "Fri May 19 16:28:29 GMT 1995" in the four above named variables. The variable `four' contains the time. The batch interpreter produces:

It is 16:28:29 o'clock

The execute call could also be used to determine the available free disk space:

execute ("df .| grep dev", dmy, dmy, dmy, freeblocks)
print ("There are ", freeblocks, "Blocks free")

In this examples the Unix pipe and the grep command are responsible for reducing the output and placing it into one line. All lines, that contain dev, are filtered out. The second line is read by the batch interpreter and all information is assigned to the named variables. The first three fields are assigned to the variable dmy. The information about the available blocks will be stored in the variable freeblocks. The following output is produced:

There are 46102 Blocks free

The examples given above should give the user an idea how to handle the execute command. It should be pointed out here that execute could as well call another batch interpreter which could work on partial solutions of the problem. If the user wants to accomplish such a task the command line option -q of the batch interpreter could be used to suppress output not caused by the print command. This would ease the reading of the output.


The last special function call is exit. This function call leaves the batch program immediately and terminates the batch interpreter. The parameter used in this function is the exit state, which will be returned to the calling program (usually the Unix shell). If no parameter is used the batch interpreter returns zero. The format is:

exit (state)

The integer state ranges from -128 to +127. If the value is not within this range the value will be mapped into the valid range and an error message displayed. The following example will show the user how this function call could be used:

if freeblocks < 1000 then
print ("Not enough disk space")
exit (1)

The function setseed sets a seed value for the random number generator used by the initialization functions. If setseed is not called before initializing a network, subsequent initializiations yield the exact same initial network conditions. Thereby it is possible to make an exact comparison of two training runs with different learning parameters.


Setseed may be called with an integer parameter as a seed value. Without a parameter it uses the value returned by the shell command `date' as seed value.

next up previous contents index
Next: Batchman Example Programs Up: SNNS Function Calls Previous: Pattern Function Calls
Tue Nov 28 10:30:44 MET 1995