[comp.lang.ada] zzz Expert Systems and Ada

SAHARBAUGH@ROO.FIT.EDU (06/22/91)

I was too late for the summarized posting so here is some
more information, last on the list so you can skip it easily.
---
Here are some items regarding Expert Systems and Ada:

---

Regarding CLIPS/Ada here are some excerpts from a 
note from CSC, the organization that distributes 
CLIPS for NASA.  It may be no longer true.

April 11, 1990

Dear CLIPS User:
Regarding CLIPS Ada for MS DOS...

We cannot get a reliable executable of CLIPS Ada created
 for the MS DOS environment, even with
 the latest versions of Alsys (4.3) and Meridian (3.0)
compilers.  Consequently, we cannot provide an 
MS DOS Ada executable and will not pursue 
the matter further until the next release of CLIPS Ada.
<stuff left out>
Alternately, you may copy the Ada source code to a
UNIX workstation or a VAX and recompile it there 
where it should work fine.

16511 Space Center Boulevard
Houston, Texas 77058
713.486.8153

-----------

Following are excerpts from an ISI project report which may 
help you to get started on "Expert Systems written in Ada".  
If you are interested in Beta testing AFES or in 
learning more about it and/or the research project, 
please contact me. 

We chose the AFES fuzzy expert system because it 
allows reasoning about inexact situations, such as "fuel 
is low" and "threat is high", and thereby would be a 
more realistic demonstration.  Only Ada based expert 
systems were considered.

AFES is a fuzzy, rule-based, expert system shell written 
in Ada.  AFES is a fuzzy expert system, performs forward 
reasoning, accepts sensor inputs and has a blackboard 
and a rules editor.  AFES is a full capacity expert 
system shell that can be used interactively or can be 
called from within a running application program.

Two other expert systems were considered for use, a 
system from Software Artistry and a system from Louis 
Baker [BAKER].  

[BAKER] "Artificial Intelligence with Ada", 1st edition (1989)
Louis Baker, McGraw-Hill, ISBN 0-07-003350-1

It was difficult to get consistent information about the 
Software Artistry system(St. Louis, MO, circa 1989).  
Their brochure said it was 
written in Ada but upon inquiry it seemed that it would 
be written in Ada only if someone agreed to pay the 
$5000.00 asking price.  It also was not forward 
reasoning.  It used a linked-list data structure and 
little recursion; however, it did not utilize dynamic 
memory management and was judged unsuitable for an 
embedded real-time system 
ication.

The system in Louis Baker's book performs both 
forward and backward reasoning.  We obtained the source 
code from Dr. Baker and found it to be as "ugly" as Dr. 
Baker said it was.  The code uses recursion and the Ada 
keyword "new" to allocate dynamic memory but it does not 
use "unchecked_deallocation" to tell the memory manager 
when it can reclaim storage.

AFES was chosen for use because it performed fuzzy 
logic, was designed to be an embeddable component, the 
authors were available locally and we were able to 
influence the Ada code as it was being converted from 
Pascal.

AFES employs a matrix of bits to 
determine if a rule is a concluding rule.  

A list of all factual data called the blackboard is 
maintained by the shell.  The blackboard contains 
clauses in a compressed format to facilitate comparison.  

The certainty factor is a measure of how well a fact on 
the blackboard satisfies the premise of a clause.  The 
certainty factor is computed from the overlap of the 
ranges of two clauses 

Every clause on the blackboard has a certainty factor, 
expressed as a real number between 0 and 1.  AFES 
follows the conventions of fuzzy logic as defined by 
Lofti Zadeh.  The logical functions "and" and "or" are 
evaluated left to right unless the order of operations 
is changed by parentheses.  The logical "and" accepts 
two operands (the certainty factor on the right and the 
certainty factor on the left) and returns a minimum of 
the two values.  

Conversely, the logical "or" returns a maximum of the 
two certainty factors.

The logical "not" negates (subtracts the certainty 
factor from 1) only the first clause immediately to its 
right.  If several clauses are bounded by parentheses, 
the total certainty factor of all clauses is negated.  

The "not" returns the difference between 1 and the 
certainty factor of the clause(s) to its right.  

The actual inferencing process is very simple when 
described in high-level terms.  The inferencing module 
is indeed very simple because it relies heavily on the 
supporting routines to compute and evaluate clauses.  
Passes are made through the knowledge base until it is 
exhausted.  During each pass, each rule that has not 
already been fired is broken into clauses and then 
compared to the blackboard to compute its certainty 
factor.  If the premise is true, the conclusion is then 
fired and the rule is added to the list of fired rules.  
If the rule is a concluding rule, then the rule is added 
to the list of fired conclusions as well.  

When using the interactive AFES shell, if the inferencing
 process  has been completed and no concluding rules have
 been fired, the shell proceeds to ask the user for factual 
data in order to reach at least one conclusion. 

Most of the data used by the shell is stored dynamically 
in the form of linked lists of data structures.  Some 
are straightforward such as the list of rules.  Others 
are more complex, like the matrix and the blackboard.  
All lists are maintained by Ada's heap management 
procedures.  

An example rule is:

if exposure is high and fuel-status is not-low and 
mission-status is return-to-base 
then speed is afterburner

-- end of message
sam harbaugh saharbaugh@ROO.FIT.EDU        
-----------
ISI  Integrated Software, Inc.
1945 Palm Bay Rd #7
Palm Bay, FL 32905
----- the end, really