You are on page 1of 9

1713!

A FIRST COURSE IN ARTIFICIAL INTELLIGENCE


IN PETROLEUM ENGINEERING
M. L. Eskijian

Introduction
During this past year, I was given the task of
putting together an introductory course in the application of
artificial intelligence/expert systems in petroleum engineering.
The course focused on computational tools, programming languages
and the construction of expert systems. Petroleum engineering
applications were a constant search process, and at the
completion of the course, we found no shortage of problems that
could be solved quite adequately with artificial intelligence
methodso
The syllabus for the course included the topics:
Computational Tools for Inference
Programming Languages
Building Expert Systems
Natural Language Processing (NLP)
Petroleum Applications
In terms of prerequisites for this course, they are not quite the
expected. A strong background in procedural computer languages
such as Fortran, Basic, Pascal was of no help in
understanding the declarative languages of AI, and even served to
make the learning experience more difficult. The only
requirement that became clear to me was that the student must
have a good understanding of a broad range of topics in petroleum
engineering.
In terms of constructing an expert system, the students who had
worked in a specific area, such as log analysis or drilling,
found that putting together an expert system was not as difficult
as they thought. The students with work experience seemed to
benefit more from the class than the ones who had purely-an
academic background. In some cases, the students who had almost
no computer experience did better than the ones who were
proficient in Pascal or Fortrane The development of expert
systems requires a high level of engineering maturity and
creativity, making it a graduate level class.

Computational Tools for Inference


Considering the classic work of Rebob in AI in the minerals
industry (Ref. 1) it became clear that at least three types
of computational tools were essential. The first tool
Copyright 1987 Society of Petroleum Engineers

This manuscript w~ provi~ed to the Society of Petroleum Engineers for distribution


and POSSible publication 1n an SPE journal. The material is subject to correction
by the author(s). Permission to copy is restricted to an abstract of not more than
300 words. Write SPE Publications Dept .. P.O. Box 833836, Richardson TX
7~083-J836 U.S.A. Telex 730989 SPEDAL. · '
z

is classic logic, in the form of predicate calculus. As the AI


community knows, predicate calculus is a predicate form of logic,
more sophisticated than propositional logic.

In propositional logic, the statements:

A ROCK IS HARD
SAND IS NOT HARD

become in predicate calculus:

IS_HARD(ROCK) True
IS_HARD(SAND) False

The difference between the two is that predicate calculus


creates a function that allows for an argument, and statements
for each object do not have to be written individually.
The most common tools of predicate calculus are "modus poens"
and "modus tolens 11 • These two can be expressed in the following
statements:

(Modus Peens) If there is an axiom of the form El implies E2,


and there is another axiom of the form El, then
E2 follows.

(Modus Tolens) If there-is an axiom of the form El implies E2,


and there is another axiom of the form "not E2",
then 11 not El" follows.

These two statements provide a basic building block for simple


inference engines, based purely on classical logic.

Coupled with logic must be a mechanism to search for


solutions. Thus, search methodologies are extremely important
in many AI applications. Some of the very simple
search algorithms discussed in the class included (Ref. 2):

Depth-First (Prolog default)


Hill Climbing
Breadth-First
Branch and search

The depth-first search method is simply "brut-force'', left to


right, down the logic tree of possibilities, until the solution
is obtainede Hill-climbing is very similar to depth-first,
except that heuristics are employed. Heuristics employs the
rule-of~thumb or an experience factor into the search
processe The breadth-first search crosses between the tree
structure, proceeding down one level at a time. The branch and
search combines heuristics and breadth-type searching.
These methods are only a few of the possible ones employed
today" One statement (Ref. 2) became clearly appropriate:
•:search is seductive, more of it is rarely a good thing."

sP·E 17 1 31
3

The second basic tool for inference is the use of Bayesian


statistics. And although the mathematics of this particular
method can sometimes seem excessive, the basic principle is quite
simple:

Posterior Probability
of a result, given the =
( sample outcome

The method can most clearly be illustrated with an example,


and the recommended text (Ref. 3) provides many engineering
examples with Bayesian solution methods.

The third computational tool for inference is the "fuzzy set",


developed by L.A. Zadeh (Refo 4). This tool allows for an
infinite range of values, in order to capture the "almost",
"maybe" or "sort-of" type of reasoning. A fuzzy set is a class
of objects with a continuum of grades of membership. This set is
characterized by a membership function which assigns to each
object a grade of membership, from 0.00 to 1.00. Zadeh has
written numerous articles and a text (Ref. 5) discussing
the application of fuzzy set theory to decision processes.
In a very simple example of this sort of logic, the maximum
operation replaces the "or"- of a logical expression, and
the minimum operation replaces the "and" operation. In
classical logic addition and multiplication can be used to
express the "or" and 11 and". For the following statements
(Ref. 6) :

J'ane is tall
.Jane is smart

Classical logic would provide:


0.90 * 0.90 = 0.81
This could be translated into the statement,
If Jane is very tall,. and very smart, then she is a
quite tall, smart person.

Fuzzy logic would more accurately provide:

Max (0.90, 0.90) = 0.90


If Jane is very tall and Jane is very smart, then
she is a very tall, smart person.

The fuzzy set approach does ·not degrade the result. One can
easily see a problem in the classical logic as more variables are
introduced, and the final product 'is reduced. The fuzzy set
approach preserves the magnitude of the original statements

SP·E 1 7 1 31
better, and thus more accurately provides a truthful meaning of
the two statements.

Programming Languages

There are a number of possible languages that can be used to


solve engineering problems in artificial intelligence. In order
to expose the students to many possibilities, the following
tools were employed:

Turbo Prolog
XLISP
ESIE (An expert system shell)

Turbo Prolog* is a very fast, compiled, declarative language


that is both a superset and a subset of the current de-facto
standard Prolog of Clocksin and Mellish (Ref. 7). The
Clocksin and Mellish implementation is sometimes called
"Edinburgh Prolog 11o

Turbo Prolog is an inexpensive package that features full color


support, graphics, pop-up windows, flowcharts and a full-screen
editor similar to Turbo Pascal*. The programming limitations of
this language, as compared to a Clocksin and Mellish
implementation are not especially important to a novice user.
Some of the limitations of Turbo Prolog are:

1. Lists must only contain elements of the same type


2. Rules cannot be changed, only data

True expert Prolog programmers would find these two =~st~ictions


severe, but to the novice, the problem is hardly eve~
perceptible. This language is complicated enough without the
ability to modify the rules.

XLISP** is a sharable piece of software, written in "C",


that emulates most of the functions of common LISP, and comes
with the source code and many examples. It lacks an editor, and
thus must be used along with an editor. In this first course in
AI, this language was learned and used for a homework problem,
but was not th·e main programming language of the course. In
general, LISP compilers cost more than the university student can
afford. The purpose of providing this software was to introduce
the student to LISP, and to make him a more informed buyer,
should he later decide to purchase a commercial LISP compiler.
ESIE*** (Expert System Inference Engine) is a public domain
expert system shell, written in Pascal. The source code can be
obtained for a fee, but the compiled program runs just fine and

* Turbo Prolog and Turbo Pasc~l are products of Borland


International; Scotts Valley, California
** XLISP is a product of David Betz, Manchester, New Hampshire
*** ESIE is a product of Harry Reasor, Lightwave Consultants,
Tampa, Florida

SPE 17 1 31
only requires an editor to prepare the rules. This particular
expert system shell can facilitate 400 rules:, 1 goal, and up to
50 variables for legal answers. Within only a few hours,
a student can learn how to use this system, test his set of
rules, and rapidly gain confidence in using an expert system
shell. The one severe limitation of this particular shell is its
inability to perform any computations or arithmetic. It is
solely a rule-based expert system.

Building Expert Systems


An expert system is composed of an inference engine and a
knowledge base. The knowledge engineer seeks to combine the
talents and expertise of the expert with the capabilities
and functions available in an AI framework. The basic steps
involved in this process are thoroughly discussed in
the text edited by Hayes-Roth et al (Ref. 8). This book serves
as an excellent primer on the ~on-programming aspects of
constructing an expert system. In summary, the steps are:

1. Identify
Participants, problem characteristics, resources
and goals

2.· Conceptualization
What kinds of data are available, what variables
or parameters are known, which will be inferred,
what procedures and constraints are involved.

3. Formalization
Data quality and quantity, time dependency of the
problem, data consistency

4. Implementation
Begin programming, possibly introduce a new language

5. Testing
Run examples, determine weaknesses in the solution,
verify inference metbods

Steps 3-5 are iterative, so that as the example set gets larger
and more complex,-the program expands to facilitate problems once
handled only by the expert. Hayes-Roth et al provides pages of
rules for the knowledge engineer to use when dealing with the
expert, and almost provides a code of work ethics for an engineer
working with an expert. Some of these rules are:
1. Obtain a commitment from an articulate expert.
2. Insulate the expert, and the user from programming
technical problems.
3. Be careful about feeling "expert".

Schildt (Ref. 9) provides a complete Turbo Prolog expert system,

SPE 1 7 1 31
and all one has to do.is to add the rules and run. The program
can be extended, and has a separation between the knowledge base
(input via a data file) and the inference rules of the Prolog
program. One student extended this simple program to provide a
well kick analyzer, employing the rules and computations of the
"Practical Pressure Control 11 manual by Swaco-Dresser.

Natural Language Processing

Natural Language Processing (NLP) and the associated parsing


algorithms are an essential part of an AI expert system.
NLP seeks to make the program unde~stand the written language~
Of secondary importance is the capability of the program to
respond with language~like replies. In this first step into
petroleum applications, NLP provides a front-end for AI programs.
The ability to respond to the user with replies is of secondary
importance. A parser dissects the sentence into components, so
that discrete processing can commence. As an example, the
following simple sentence can be broken into the components
listed:

The child runs quickly into


(Determiner) (noun) (verb) (adverb) (preposition)

the large house a


( Dete·rminer) (Adjective) (Noun)

There are at least three good examples of Prolog NLP parsers


available for use. The first one is on the Turbo Prolog example
disk, and the second one is on the Turbo Prolog Toolbox disk.
The most simple, and easiest to understand parser is found in
Reference 9, and was implemented in the class. This parser
includes the sentence components discussed above, and even
includes a noise disposal algorithm to eliminate extraneous
words. Coupled with the parser in the sample program is the
Prolog logic to actually perform the operation.

Petroleum Applications

A number of petroleum engineering applications for AI are now


quite apparent to the industry. The most obvious application is
in log analysis. AI offers the potential to merge the
computational aspects of log analysis with a rule-based system,
to provide a rapid expert advisor for log interpretation.

As an example, one student's program identified the type of


clay, and provided advice on drilling and completion of the
well. The program merged data from three logs:

Lithology-Density
Natural Gamma Ray
NGS Computations playback log (Displaying
Thorium, Uranium and Potassium)

SPE 17 1 31
7

This program verified the reasonableness of the data, proceeded


to solve for the clay type, basing some of its conclusions on the
level of expertise of the user. The log information was
weighted, to form a simple fuzzy set sort of inference system,
and to provide a best guess result. Upon conclusion, the program
provided drilling/compl~tion recommendations based on the clay
type ..
A second petroleum application is the drilling advisor, to
provide rapid advice on kick recognition and control. The
student used the rules and calculations of Swaco-Dresser's
11
Practical Pressure Control 11 to build the expert system.
A third application, and one that will have a broad base of
applications is the AI preprocessor to large programs. Whether
it is a 3-D simulator or a sophisticated PVT equation-of-state
program, an AI front-end can take the burden of education and
assistance from the real expert and greatly reduce the number and
type of errors of the novice user. One student who had written a
very large Fortran PVT equation-of-state program wrote a Prolog
front-end with pop-up windows, input verification and checking,
and then proceeded to create the input file for his program.

Plant diagnostics with a rule-based expert system such as ESIE


is also a good example of a petroleum application. The
problem was to find the source of a leak, given the plant
layout, and a description of the fluids in each tank. Within
only a few hours, the students were able to build the expert
system, and verify the source of the leako

Another good example of a petroleum application is database


management for a reservoir. NLP and a parser can be implemented
to perform computations of determining the water cut, GOR,
daily rates, or whatever, from the production data. High
cut areas or any sort of reservoir performance can be quickly
evaluated. This would serve as a sort of executive DBMS, well
beyond the capabilities of commercial DBMS.
Conclusions

There are many petroleum engineering problem.s that can easily be


formulated into expert systems. One recommendation is to select
problems that ar~ neither too easy nor too difficult for human
experts. Turbo Prolog and Toolbox constitute a modest
investment, have good graphics support, and provide for more than
enough computational power than required by the novice.
ESIE, a public domain expert system shell, is also a good
starting point. It is easy to use, quite powerful and serves to
illustrate the capabilities of a rule-based expert
system.

SPE 1 7 1 31'
AI provides a computational tool to solve problems once thought
to be not well suited for classical programming. Log analysis,
well-kick advice, intelligent pre-processors for large programs,
plant diagnostics, and reservoir DBMS are just a few of the
many examples of AI possibilities in petroleum engineering. The
students who have taken the course benefit in that they are given
computational tools to solve problems in a way that is totally
different from conventional, procedural programming.

SPE 17 1 3l'
References

1. Reboh, Rene, "Knowledge Engineering Techniques and Tools


in the Prospector Environment", Technical Note 243, SRI
International, Menlo Park, CA · June 1981.

2. Winston, Patrick Henry, Artificial Intelligence,


Addison-Wesley Publishing Company, 1984 .

3. Benjamin, J.R. and c. A. Cornell, Probability, Statistics


and Decisions ·for Civil Engineers, McGraw-Hill Book Company.

4. "Fuzzy Sets", L. A. Zadeh, Information and Control,


Vol 8, Pgs. 338-53, 1965.

5. Zadeh, L.A. and Fu, K.S., and Tanaka, K. and Shimura, M.


Fuzzy Sets and Their Application to Cognitive and Decision
Processes, Academic Press, NY, 1975.

6o Brule, James, Artificial Intelligence: Theory. Logic and


Application, Tab Books, Inc, 1986.

1. Clocksin, W. F. and C. s. Mellish: Programming in


Proloq, Springer-Verlag Publi.shing Company 1984.

8. Hayes-Roth, F .. and D.. A. Waterman and D. B.· Lenat,


Bu.ilding Expert Systems, ·Addison-Wesley Publishing Company,
1983.,

9. Schildt, Herbert: Advanced Turbo Prolog, Osborne-


McGraw-Hill Publishing Company 1987.

SPE 1 7 1 31

You might also like