Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 869 Bytes

MaxEventInputs.md

File metadata and controls

18 lines (15 loc) · 869 Bytes

MaxEventInputs

MaxEventInputs and MinEventInputs are event-selection parameters that control the max and min numbers of input tokens allowed per event.

In addition to being useful for rules with variable numbers of inputs, MaxEventInputs is sometimes useful for optimization. By default, systems like MultisetSubstitutionSystem consider all subsets of tokens to find matches, which can be slow. However, if the range of match sizes is known ahead of time, one can set it explicitly. Compare:

In[] := First @ AbsoluteTiming @
  GenerateMultihistory[
      MultisetSubstitutionSystem[{a___} /; Length[{a}] == 4 :> {Total[{a}]}], {1, 2, 3, 4}, MaxEvents -> 20, #] & /@
    {{}, {MinEventInputs -> 4, MaxEventInputs -> 4}}
Out[] = {0.793215, 0.014419}