ASDDecider: a modification of ASDParser that searches ASD grammar
networks used as decision networks
A fairly simple modification of ASDParser
permits ASD networks to be used as decision networks, to express
decision logic which might otherwise require long and deeply-nested if ... else logic. In
addition to replacing many lines of program code, such a network can
also be easier to modify than the equivalent program code would
be. An ASD network used as a decision network and the values used
in searching it have properties that distinguish them from a general
ASD grammar network and a phrase parsed with it:
- A decision network is acyclic
-- it contains no cycles.
- The string of values
used in searching a decision network is considered a flat unordered set -- the sequence of
the values is insignificant, and it has no implicit substructure,
unlike a phrase, which may be parsed as having subphrases..
Because of the second property, the algorithm used by ASDDecider for
searching a decision network is different from the algorithm used by
ASDParser for parsing with a grammar. Specifically, given a set
(string) of values with which to search, ASDDecider just tries to find
a path from an initial node
in a decision network to a final
node in the network such that the "word" in each non-dummy node on the
path matches one of the values in the given set.
An example of the use of ASDDecider appears in the method findReferents
of the class CardAgent1
in the package cards1a., the revision of CardWorld1 that uses a
decision network to replace some complicated if ... else logic.
The decision network used in that example is an ASD grammar file named
CardDecisionNet1.grm, which is the
result of merging two smaller
decision networks, CardDecisionNet1a.grm
and CardDecisionNet1b.grm.
Those
two decision network files can be opened and viewed with the demonstration
version of ASDEditor.
ASDDeciderTester in
package
asdx is a modification
of ASDTester that can be used for testing ASDDecider.
last modified 2010 Sep 4