Hi,
I'm looking for practical info about organizing the structure of an
expert system in Delphi.
It's more than 2 weeks I'm searching the net and reading about expert
sytems. So more or less I know the theory. But I didn't find anything
practical.
I have about 300 variables (working data area) and a about 200 rules
(maybe more later).
Variables can be of several types: strings, numeric, date, boolean, etc.
Rules are formed as
"if Cond1, Cond2,..., CondN then Action1 else Action2"
Conditions are formed as
"Left Hand Side Operator Right Hand Side" and evalute to TRUE or FALSE
Sides can e a Variable (especially LHS) or a constant.
What is the best structure for each of these elements?
1) Variable Definition (Name, Description and Type) - I thought about a
simple record. No objects or interfaces as it is just a definiton
2) Variable (Variable definition + Value) once a value is assigned it
can be used in the rules - here I could use everything, a record
(managed by a container component) an object or an interface
3) Variable Container - an object containing a list of records or a list
of objects pointing to the variables
4) Rule Atomic Condition - (LHS Operator RHS) Record or Object?
5) Rule Condition - {negate} RuleAtomicCondition {LogicOperator
RuleAtomicCondition} a tree structure seems quite appropriate also for
evaluating purpouses.
6) Rule Action - indeed a list of AtomicActions so simply using a list
(maybe with weights)
7) AtomicAction - I think about objects here as each kind of action will
have its own methods (execute, setValue, DisplayMessage, etc)
8) Rules - objects?
The variables and the rules should have a fast access for the inference
engine to evaluate and easy to access to their data for UI.
Any suggestion?
Thanks,
Enrico


|