This repository hosts code accompanying Learning Moore Machines from Input-Output Traces and related publications.
This project was forked to be used in the research into database assisted state machine learning. (TODO add those links when published.)
This fork contains changes so that it works on Linux by using the JSON interfaces and not the binary interfaces.
It also comes with a script to convert the moore traces to abbadingo traces. Random end points are chosen from the Moore trace. See moore2trace.py
for how this works.
Usage:
./generate --mid out/fsmtest_200_1.json --tid /dev/stdout --rs 222 --sz 1000000000 | python moore2trace.py | head -n 1040000 > out/fsmtest_200_222.dat
A very large --sz
is set to keep continuing making data until enough lines are made and closing the pipe.
There is also a branch no-uniform-sampling
which enhances the gen_moore.py
script to give each transition a weight and a modified generate_impl.d file which uses these weight to generate traces that have a non-uniform distribution on what transitions it is using. (The old version deliberately tried to make the distribution as uniform as possible by keeping track of the frequenceies of the visisted nodes.)
In order to run the random and benchmark Moore machine learning experiments presented in the paper, you will need a D compiler (dmd or ldc should be fine), as well as a Python 2.7 interpreter (this is temporary though -- we are in the process of porting all Python code to D). In order to run the performance comparison experiments you will also need LearnLib, flexfringe and their dependencies.
We ran all experiments on 64 bit Windows (it is possible to compile flexfringe under Cygwin with very little effort), but it should be possible to run everything on Linux or OS X without much modification. We used dmd 2.086.0 for the random and benchmark learning experiments and ldc 1.15.0 for the performance comparison experiments.
$ dmd -m64 -i -O -release -inline -boundscheck=off generate.d
$ dmd -m64 -i -O -release -inline -boundscheck=off run_rand_fsm_experiments.d
$ run_rand_fsm_experiments.exe
Results will be stored in o/all-results.txt. Note that the process stops when detecting high memory usage and you have to restart it (all results are cached -- no experiment is repeated).
$ dmd -m64 -i -O -release -inline -boundscheck=off generate.d
$ dmd -m64 -i -O -release -inline -boundscheck=off run_real_fsm_experiments.d
$ run_real_fsm_experiments.exe
Results will be stored in o2/all-results.txt
$ ldmd2 -m64 -i -O -release -inline -boundscheck=off mealy_learn_opt.d
$ mealy_learn_opt.exe perfcomp/train30ff.txt 3 ff
-
Set up a new maven project following the instructions here. For convenience we provide a pom file which also includes the shade plugin, required to bundle everything into a single jar (see
perfcomp/pom.xml
). -
As the source code for the project use the provided
perfcomp/ExampleMealy.java
(edit to make sure the correct path is used for the training set). -
Build and run the project:
$ mvn package
$ java -cp path/to/project.jar org.example.learnlib.ExampleMealy
-
Checkout commit b44cfadf0a28530dd8da72cef439a8fe0f96b462 from here
-
Before building you may want to...
-
comment out print statements inside
random_greedy_bounded_run
(random_greedy.cpp) andget_possible_refinements
(state_merger.cpp) -
measure execution time of
id.read_abbadingo_file(input_stream);
(main.cpp),id.add_data_to_apta(the_apta);
(main.cpp), andrandom_greedy_bounded_run(&merger);
(dfasat.cpp) using e.g. this
-
-
Build it following the instructions in the repository
- Note that to build on Windows under Cygwin, you may
need to change
-std=c++11
to-std=gnu++11
in the makefile.
- Note that to build on Windows under Cygwin, you may
need to change
-
Run it using the
perfcomp/batch-mealy.ini
file we provide:
$ ./start.sh batch-mealy.ini path/to/train30ff
Coming soon, stay tuned...