-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-lstar.sh
executable file
·31 lines (23 loc) · 978 Bytes
/
run-lstar.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
# Example usage of how to run lstar against a non-interactive teacher. This
# script will create two fifos for the learner and teacher to communicate over.
# The communication is not visible, only output to stderr will be shown in
# the terminal
# safety flags, remove x if you don't like all the output
set -euxo pipefail
# create temporary directory, and names for the fifo queues (not files)
tempdir=$(mktemp -d run-lstar.temp.XXXXXX)
queryfifo="$tempdir/queries"
answerfifo="$tempdir/answers"
# find the binary for the learner and teacher.
# The haskell project must be built beforehard (cabal build all)
lstar=$(cabal list-bin ons-hs-lstar)
teacher=$(cabal list-bin ons-hs-teacher)
# make the connection for the processes
mkfifo $queryfifo $answerfifo
# run the teacher in the background
$teacher "$@" < $queryfifo > $answerfifo &
# run the learning algorithm, measuring its time
time $lstar > $queryfifo < $answerfifo
# clean up
rm -r $tempdir