To process a stream with our reconfigurator prototype, you need to supply both the encoding as well as the stream. The encoding is supplied via stdin and will automatically be grounded. For this reason, gringo
needs to be in your path. The prototype then creates a FIFO named reconfigurate
in the working directory, into which you can then write the stream. Using standard UNIX tools you can redirect a network socket to this FIFO or write a log file to it. In the following example, we concentrate on the latter.
Using instances from our N-Queens instance set, we first start the reconfigurator
wasp < enc-18
This will cause the reconfigurator to process the encoding, and set up all internal data structures. It will produce the FIFO in the current working directory
Using the cat
tool in a separate terminal, we can pass an instance log to the reconfigurator.
cat log-18 > reconfigurate
This will prompt the reconfigurator to process all instances contained in the file (each delimited by a newline character) and compute answer sets.
Alternatively, you can use cat to specify the stream manually,
cat > reconfigurate
By doing so, you will find yourself in the cat tool and you can supply an instance manually, e.g. q(1,1);+
. Upon pressing enter, the instance will be processed by the reconfigurator.
In order to take input from the network, you could use netcat. Note that this is mostly untested.
nc -l > reconfigurate
The prototype accepts all command line arguments that WASP accepts. Please refer to WASP for further details.
The learning rate can be set via the environment variable LEARNING_RATE
. When no learning rate is set, it will default to 0.1.