Module Big_json
Encoder
val big_to_json : ?minify:bool -> Bigraph.Big.t -> Stdlib.String.tbig_to_json minify bis a JSON encoder that outputs bigraphbto a string. Ifminifyistrue(default) the output is made as compact as possible, otherwise the output is indented. Below is an example output:{ "nodes": [ { "node_id": 0, "control": { "ctrl_name": "Park", "ctrl_params": [], "ctrl_arity": 3 } }, { "node_id": 1, "control": { "ctrl_name": "Hospital", "ctrl_params": [ { "ctrl_int": 12 }, { "ctrl_string": "Church Street" } ], "ctrl_arity": 0 } }, { "node_id": 2, "control": { "ctrl_name": "Park", "ctrl_params": [], "ctrl_arity": 3 } }, { "node_id": 3, "control": { "ctrl_name": "Bridge", "ctrl_params": [ { "ctrl_float": 3.6 } ], "ctrl_arity": 2 } } ], "place_graph": { "num_regions": 2, "num_nodes": 4, "num_sites": 2, "rn": [ { "source": 0, "target": 0 }, { "source": 1, "target": 1 } ], "rs": [], "nn": [ { "source": 0, "target": 2 }, { "source": 1, "target": 2 }, { "source": 1, "target": 3 } ], "ns": [ { "source": 2, "target": 0 }, { "source": 3, "target": 1 } ] }, "link_graph": [ { "inner": [], "outer": [], "ports": [ { "node_id": 0, "port_arity": 1 } ] }, { "inner": [], "outer": [], "ports": [ { "node_id": 0, "port_arity": 1 } ] }, { "inner": [], "outer": [], "ports": [ { "node_id": 0, "port_arity": 1 }, { "node_id": 2, "port_arity": 1 }, { "node_id": 3, "port_arity": 1 } ] }, { "inner": [], "outer": [], "ports": [ { "node_id": 2, "port_arity": 1 } ] }, { "inner": [], "outer": [], "ports": [ { "node_id": 3, "port_arity": 1 } ] }, { "inner": [], "outer": [ { "name": "x" } ], "ports": [ { "node_id": 2, "port_arity": 1 } ] } ] }
val react_to_json : ?minify:bool -> Bigraph.Brs.react -> Stdlib.String.tEncoder for reaction rules. Below is an example output:
{ "brs_lhs": { ... }, "brs_rhs": { ... }, "brs_eta": null }Note that in the following we will write
{ ... }in the example outputs to indicate the JSON encoding of a bigraph produced byBig_json.big_to_json. Optional memberbrs_etais encoded assbrs_etainBig_json.sreact_to_jsonwhen present.
val preact_to_json : ?minify:bool -> Bigraph.Pbrs.react -> Stdlib.String.tEncoder for probabilistic reaction rules. Below is an example output:
{ "pbrs_lhs": { ... }, "pbrs_rhs": { ... }, "pbrs_p": 0.476, "pbrs_eta": null }
val sreact_to_json : ?minify:bool -> Bigraph.Sbrs.react -> Stdlib.String.tEncoder for stochastic reaction rules. Below is an example output:
{ "sbrs_lhs": { ... }, "sbrs_rhs": { ... }, "sbrs_rate": 8.031000000000001, "sbrs_eta": [ { "x": 0, "y": 1 }, { "x": 1, "y": 1 } ] }
val nreact_to_json : ?minify:bool -> Bigraph.Nbrs.react -> Stdlib.String.tval occs_to_json : ?minify:bool -> Bigraph.Big.t list -> Stdlib.String.tval p_occs_to_json : ?minify:bool -> (Bigraph.Big.t * float) list -> Stdlib.String.tSimilar to
Big_json.occs_to_jsonbut for probabilistic reactive systems. Below is an example output:[ { "state": { ... }, "prob": 1 } ]
val s_occs_to_json : ?minify:bool -> (Bigraph.Big.t * float) list -> Stdlib.String.tSimilar to
Big_json.occs_to_jsonbut for stochastic reactive systems. Below is an example output:[ { "state": { ... }, "rate": 8.031000000000001 }, { "state": { ... }, "rate": 2.457580000000001 } ]
val n_occs_to_json : ?minify:bool -> (Bigraph.Big.t * (string * int * float)) list -> Stdlib.String.tval matches_to_json : ?minify:bool -> Bigraph.Solver.occ list -> Stdlib.String.tEncoder for bigraphical matches. Below is an example output:
[ { "iso_n": [ { "i": 0, "j": 0 }, { "i": 1, "j": 1 }, { "i": 2, "j": 2 }, { "i": 3, "j": 3 } ], "iso_e": [ { "i": 0, "j": 1 }, { "i": 1, "j": 0 }, { "i": 2, "j": 2 }, { "i": 3, "j": 3 }, { "i": 4, "j": 4 } ], "f_e": [ { "x": 5, "y": 5 } ] } ]
val ts_to_json : ?minify:bool -> Bigraph.Brs.graph -> Stdlib.String.tEncoder for transition systems generated by Bigraphical Reactive Systems.
val dtmc_to_json : ?minify:bool -> Bigraph.Pbrs.graph -> Stdlib.String.tEncoder for transition systems generated by Probabilistic Bigraphical Reactive Systems.
val ctmc_to_json : ?minify:bool -> Bigraph.Sbrs.graph -> Stdlib.String.tEncoder for transition systems generated by Stochastic Bigraphical Reactive Systems.
val mdp_to_json : ?minify:bool -> Bigraph.Nbrs.graph -> Stdlib.String.tEncoder for transition systems generated by Action Bigraphical Reactive Systems.
Decoder
val big_of_json : ?encoding:Jsonm.encoding -> Stdlib.String.t -> (Bigraph.Big.t, Stdlib.String.t) Stdlib.resultbig_of_json encoding jdecodesjwhich is a string expressing a bigraph in the JSON format specified byBig_json.big_to_json.encodingspecifies the character encoding of the data as in the Jsonm library.
val react_of_json : ?encoding:Jsonm.encoding -> Stdlib.String.t -> (Bigraph.Brs.react, Stdlib.String.t) Stdlib.resultSimilar to
Big_json.big_of_jsonbut for reaction rules.
val preact_of_json : ?encoding:Jsonm.encoding -> Stdlib.String.t -> (Bigraph.Pbrs.react, Stdlib.String.t) Stdlib.resultSimilar to
Big_json.big_of_jsonbut for probabilistic reaction rules.
val sreact_of_json : ?encoding:Jsonm.encoding -> Stdlib.String.t -> (Bigraph.Sbrs.react, Stdlib.String.t) Stdlib.resultSimilar to
Big_json.big_of_jsonbut for stochastic reaction rules.
val nreact_of_json : ?encoding:Jsonm.encoding -> Stdlib.String.t -> (Bigraph.Nbrs.react, Stdlib.String.t) Stdlib.resultSimilar to
Big_json.big_of_jsonbut for non-deterministic reaction rules.
Interface to the matching engine
val step : ?encoding:Jsonm.encoding -> ?minify:bool -> ?solver:Stdlib.String.t -> Stdlib.String.t -> Stdlib.String.tstep encoding solver jcomputes the set of states reachable in one rewriting step.solveris a string taking values"MSAT"and"MCARD"for MiniSAT and MiniCARD solvers, respectively.jis assumed to be in the following JSON format:{ "state": { ... }, "reacts": [ ... ] }where
reactsis an array of reaction rules andstatethe bigraph to which they are applied. Each element inreactsis in the format specified byBig_json.react_to_json. Namessreactsandpreactscan be used in place ofreactsto specify stochastic and probabilistic reactive systems, respectively.Output is as in the formats specified by
Big_json.occs_to_json,Big_json.p_occs_to_json, andBig_json.s_occs_to_jsondepending on the type of reaction rules contained in the input. When an error occurs, the output takes the following form:{ "error": "Not a probability" }Refer to
Bigraph.Brs.step,Bigraph.Pbrs.step andBigraph.Sbrs.step for more details on how reachable states are computed.
val big_match : ?minify:bool -> ?solver:Stdlib.String.t -> Stdlib.in_channel -> Stdlib.out_channel -> unitSimilar to
Big_json.stepbut input and output are channels.