Overview

ContextGen is a simple tool to generate random contexts for test purposes. The density of the contexts can be increased gradually.

Synopsis

Usage: ./tool02_contextGen.sh <nbLines> <nbColumns> <minNbOfElems/line> <maxNbOfElems/line> [option]
where:
<nbLines> number of lines in the context
<nbColumns> number of columns in the context
<minNbOfElems/line> minimal number of elements/line
<maxNbOfElems/line> maximal number of elements/line
Options:
-of:output_file write result to output_file
(default: stdout)
-quit quit the program just after generating the context
(default: interactive mode)

It is recommended to use the program interactively.

Example

Let's suppose we want to generate a 5x5 random context in .rcf format. By default, ContextGen works with the .bool format, so we will have to switch to .rcf.

Launching the tool:

./tool02_contextGen.sh 5 5 1 5

That is: we want a context with 5 lines, 5 columns, and in a line we want at least 1 and at most 5 crosses.

Then:

with "h" you can get help (without quotes)

type "of:/tmp/test5x5.rcf" (without quotes) to specify the name of the output file (not yet written!)

Tip

When we implement an algorithm, often we would like to test some special cases that do not always occur with our test datasets. In these cases ContextGen can be handy. Create a sparse random context, write it to a file, do not quit ContextGen yet, open a new terminal and test your algorithm against the random context. If the special case is not present, switch back to ContextGen and increase the density. Write the result to the file, test it again with the alg., etc. This is an iterative process but sooner or later you will find what you are looking for.

So, how to increase the density? Here we continue the previous example:

the former density was 20%

just type "30%" (without quotes) to increase the density to 30%

type "w" (without quotes) to overwrite the file /tmp/test5x5.rcf (or specify a different filename if you want to keep the previously created file)