Generators are functions that create Multihistory objects. They take
rules for a computational system and additional parameters specifying how to perform
the evaluation.
In SetReplace, we split the states of computational systems into components which
we call tokens. Rewrites (which we call events) replace some of these tokens with others. SetReplace can evaluate
multiple branches of nondeterministic systems simultaneously. That is done by applying different events to the same
tokens and keeping events and tokens instead of states in Multihistory
objects. We can reconstruct the states from that information afterward.
There are parameters that control how this evaluation is done. Some of them control which events to select. Other parameters might control how to deduplicate identical tokens, etc. Different generators correspond to different settings of parameters. Additional parameters can be specified with a syntax similar to options.
Note that if the system does not terminate, it is necessary to specify some parameters, such as
MaxEvents or MaxGeneration.
For example, GenerateSingleHistory corresponds to
MaxDestroyerEvents -> 1 and thus does not produce nondeterministic branching:
In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & @
SetReplaceTypeConvert[WolframModelEvolutionObject] @
GenerateSingleHistory[MultisetSubstitutionSystem[{a_, b_} /; a < b :> {a + b}]] @ {1, 2, 3, 4}We can also use a more general GenerateMultihistory and specify
MaxDestroyerEvents manually.
In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & @
SetReplaceTypeConvert[WolframModelEvolutionObject] @
GenerateMultihistory[
MultisetSubstitutionSystem[{a_, b_} /; a < b :> {a + b}], MaxDestroyerEvents -> 2] @ {1, 2, 3, 4}The same generators support multiple systems. In addition to
MultisetSubstitutionSystem, other examples include
HypergraphSubstitutionSystem, StringSubstitutionSystem, etc. Many of these systems have shared parameters.
All generators take the form
Generator[System[rules], parameters...] @ initparameters can be specified either as a Sequence of
Rules, a
List of
Rules or an
Association. Keys supported
in such Rules depend on the system and can be looked up with
SetReplaceSystemParameters.
- Introspection:
$SetReplaceSystems— yields the list of all implemented systems$SetReplaceGenerators— yields the list of all generatorsSetReplaceSystemParameters— yields the list of parameters for a system
- Generators:
GenerateMultihistory— the universal generator for multihistoriesGenerateSingleHistory— setsMaxDestroyerEvents -> 1
- Parameters:
MaxDestroyerEvents— allows one to switch between single and multihistoriesMinEventInputsMaxEventInputsMaxEventsMaxGeneration— controls the depth of the evaluation
![Out[] = Graph[... {1, 2} -> {3 (* gen 1 *)}, {3 (* init *), 4} -> {7}, {3 (* gen 1 *), 7} -> {10} ...]](/maxitg/SetReplace/raw/87a92210f27ee7957b64f479e694711e84da8f06/Documentation/Images/MultisetSubstitutionSystemExample.png)
![Out[] = Graph[...
{1, 2} -> {3 (* gen 1 *)},
{1, 3 (* init *)} -> {4 (* gen 1 *)},
{2, 3 (* init *)} -> {5},
{3 (* gen 1 *), 4 (* init *)} -> {7},
{4 (* init *), 5} -> {9}
...]](/maxitg/SetReplace/raw/87a92210f27ee7957b64f479e694711e84da8f06/Documentation/Images/MultisetSubstitutionSystemPartialMultihistory.png)