Skip to content

Commit 49e1e88

Browse files
authored
Merge pull request #2 from zajer/v1.0.0
V1.0.0
2 parents 26dea00 + f15cdcc commit 49e1e88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1263
-834
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*.cmxa
1010
*.opam
1111

12+
# Ignoring the results produced by scripts in the example directory
13+
exmp_*
14+
1215
# ocamlbuild working directory
1316
_build/
1417

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
# trs-ssp-bridge
1+
# SSP-Bridge
2+
3+
A library with facade executables to convert an output from Tracking_bigraph.
4+
5+
It can normalize a TTS system and transform it into a state space accpeted by SSP library. Tools provided by this package are also capable of dynamically generating simple programs for generating behavior policies using SSP library.
6+
7+
## Usage
8+
9+
Having exported results from `Tracking_bigraph` library, use either all of the executables from the ``bin`` folder except the `all_in_one.exe` (as it was shown in ``/examples/ex1`` folder) or just the `all_in_one.exe` (as in ``/examples/ex2``).
10+
11+
The first method allows for easier debugging if anything goes wrong (by saving all partial results and knowing exactly at which step an error has happened). The second method is faster (it does keep all of the partial results in memory and does certain operations only once since it can keep results until the very end) but more error-prone.

bin/all_in_one.ml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
open Ssp_bridge
2+
let help () =
3+
print_endline
4+
"
5+
This program transforms an output of Tracking_bigraph library into a program generating behavior policy as a walk in the state space constructed from that output.
6+
7+
If you see this message it means that you did not provide necessary number of arguments.
8+
Arguments required for this program are:
9+
Arg1 - the name of a file containing discovered states (generated by Trackign_bigraph library).
10+
Arg2 - the name of a file with transitions (generated by Trackign_bigraph library).
11+
Arg3 - a csv file containing patterns to be found among states (created manually).
12+
Arg4 - the number of agents in the modelled system.
13+
Arg5 - the name of a file with reaction rules associated with time they require (created manually).
14+
Arg6 - the name of a file with control types of agents (created manually).
15+
Arg7 - the name of the file with states with detected patterns (output of this program).
16+
Arg8 - the name of the file with transition functions (output of this program).
17+
Arg9 - the name of the source code file (output of this program).
18+
Arg10 - (optional) the name of a file with template of the source code, if not provided the default file is \"ssp_template.txt\".
19+
"
20+
let () =
21+
if Array.length Sys.argv >= 10 then
22+
let states_file = Sys.argv.(1)
23+
and trans_file = Sys.argv.(2)
24+
and patterns_file = Sys.argv.(3)
25+
and noa = Sys.argv.(4) |> int_of_string
26+
and trans2timeshift_file = Sys.argv.(5)
27+
and ctrls_file = Sys.argv.(6)
28+
and out_dest_states_file = Sys.argv.(7)
29+
and out_ssp_input_file = Sys.argv.(8)
30+
and out_ssp_source_code_file = Sys.argv.(9)
31+
and template_file = if Array.length Sys.argv = 11 then Sys.argv.(10) else "ssp_template.txt" in
32+
Facade.all_in_one
33+
~in_states_file:states_file
34+
~in_patterns_file:patterns_file
35+
~in_trans_file:trans_file
36+
~in_react_times_file:trans2timeshift_file
37+
~in_ctrls_file:ctrls_file
38+
~number_of_agents:noa
39+
~in_template_file:template_file
40+
~out_dest_states_file
41+
~out_ssp_input_file
42+
~out_ssp_source_code_file
43+
else
44+
help ()

bin/dune

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
(executables
3-
(names transform_multi_files transform_single_file find_dest_states )
4-
(libraries trs_bridge )
3+
(names normalize_tts transform_normed_tts gen_ssp_source find_dest_states all_in_one)
4+
(libraries ssp_bridge )
55
(modes native )
66
)

bin/find_dest_states.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Trs_bridge
1+
open Ssp_bridge
22

33
let help () =
44
print_endline

bin/gen_ssp_source.ml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
let help () =
2+
print_endline
3+
"
4+
This program generates a source code for generating a walk from an initial state to a desired state.
5+
6+
If you see this message it means that you did not provide necessary number of arguments.
7+
Arguments required for this program are:
8+
Arg1 - the name of a file containing discovered states (generated by Trackign_bigraph library).
9+
Arg2 - a number of agents in the system.
10+
Arg3 - the name of the source code file (output of this program).
11+
Arg4 - (optional) the name of a file with template of the source code.
12+
"
13+
let () =
14+
if Array.length Sys.argv >= 4 then
15+
let states_file = Sys.argv.(1)
16+
and noa = Sys.argv.(2) |> int_of_string
17+
and output_file = Sys.argv.(3)
18+
and template_file = if Array.length Sys.argv = 5 then Sys.argv.(4) else "ssp_template.txt" in
19+
Ssp_bridge.Facade.gen_ssp_source ~states_file ~template_file ~source_file:output_file noa
20+
else
21+
help ()

bin/main.ml

-10
This file was deleted.

bin/main2.ml

-13
This file was deleted.

bin/main3.ml

-7
This file was deleted.

bin/normalize_tts.ml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
let help () =
2+
print_endline
3+
"
4+
This program normalizes an output of Tracking_bigraph library.
5+
Normalization unifies the output state of a transition with it's correspinding state in discovered states.
6+
They are not only isomorphic to each other, they are identical.
7+
8+
If you see this message it means that you did not provide necessary number of arguments.
9+
Arguments required for this program are:
10+
Arg1 - the name of a file containing discovered states (generated by Trackign_bigraph library).
11+
Arg2 - the name of a file with transitions (generated by Trackign_bigraph library).
12+
Arg3 - the name of the normalized transitions file (output of this program).
13+
"
14+
let () =
15+
if Array.length Sys.argv = 4 then
16+
let states_file = Sys.argv.(1)
17+
and trans_file = Sys.argv.(2)
18+
and output_file = Sys.argv.(3) in
19+
Ssp_bridge.Facade.normalize_tts ~states_file ~trans_file ~norm_trans_file:output_file
20+
else
21+
help ()

bin/result_trans.csv

-81
This file was deleted.

bin/result_trans_norm.csv

-80
This file was deleted.

bin/t2ts.csv

-2
This file was deleted.

bin/transform_multi_files.ml

-27
This file was deleted.

bin/transform_normed_tts.ml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
open Ssp_bridge
2+
3+
let help () =
4+
print_endline
5+
"
6+
This program transforms a normalized result of Tracking_bigraph library into an input for SSP library.
7+
8+
If you see this message it means that you did not provide necessary number of arguments.
9+
Arguments required for this program are:
10+
Arg1 - the name of a file containing discovered states (generated by Trackign_bigraph library).
11+
Arg2 - the name of a file with normalized transitions (generated by this library).
12+
Arg3 - the name of a file with reaction rules associated with time they require (created manually).
13+
Arg4 - the name of a file with control types of agents (created manually).
14+
Arg5 - the name of the file with transition functions (output of this program).
15+
"
16+
let () =
17+
if Array.length Sys.argv = 6 then
18+
let states_file = Sys.argv.(1)
19+
and norm_trans_file = Sys.argv.(2)
20+
and trans2timeshift_file = Sys.argv.(3)
21+
and ctrls_file = Sys.argv.(4)
22+
and output = Sys.argv.(5) in
23+
Facade.transform_tts ~states_file ~norm_trans_file ~react_times_file:trans2timeshift_file ~ctrls_file ~ss_file:output
24+
else
25+
help ()

0 commit comments

Comments
 (0)