0% found this document useful (0 votes)
14 views5 pages

Table Driven Problem Solvers

Research paper on table-driven finite automata.

Uploaded by

mcguire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Table Driven Problem Solvers

Research paper on table-driven finite automata.

Uploaded by

mcguire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

TABLE-DRIVEN PROBLEMSOLVERS

David S. BURRIS
Department of Computer Science
Sam Houston State U n i v e r s i t y
H u n t s v i l l e , TX 77341

Kurt SCHEMBER
Computer Science and Engineering
U n i v e r s i t y of Texas A r l i n g t o n
A r l i n g t o n , TX 76019

This paper suggests an extension of decision tables and f i n i t e automata to more general t a b l e - d r i v e n
problem solvers. The basic idea is that when a problem description is changed, only the contents of a
table d i r e c t i n g the flow of control and actions taken by a program need be modified and not the actual
code. Program actions may be changed e a s i l y and documentation and program r e l i a b i l i t y improved.
Index Terms - Decision Tables, f i n i t e automata, t a b l e - d r i v e n problem solvers.

I. INTRODUCTION

Decision tables and other graphical and/or since i t is driven by that pseudo-solution.
t a b u l a r methods have long been used by program- Secondly, solutions using flowcharts, decision
mers and analysts to represent the flow of con- tables, f i n i t e automatons, e t c . , are f r e q u e n t l y
t r o l and information necessary to solve a problem obtained (at least conceptually) more r e a d i l y than
on a computer. T r a d i t i o n a l l y the completed deci- by implementing programs. Flowcharts and decision
sion table ( f l o w - c h a r t , f i n i t e automaton, pseudo- tables require l i t t l e or no knowledge of computers
code, e t c . ) is then used as a guide f o r w r i t i n g or computer languages, hence allowing non-computer
an equivalent program in a programming language. personnel to produce s o l u t i o n s . T h i r d l y , t a b l e -
The r e s u l t i n g program solves the problem as spe- driven techniques are very f l e x i b l e . New decision
c i f i e d by the pseudo-technique (decision t a b l e , rules or actions may be specified by changing the
etc.). I t should be noted, however, that the tables that drive the program. The program code
s o l u t i o n is f i x e d and even small changes in the i t s e l f need not be modified. Fourthly, the
o r i g i n a l problem necessitate modifying the o r i g - pseudo-representation of the problem serves to
inal program and v e r i f y i n g that the modified pro- document the s o l u t i o n . Program maintenance is re-
gram solves the desired problem. The approach duced and r e l i a b i l i t y enhanced since the actual
discussed herein is to w r i t e a program which code need not be modified each time a change in
accepts as input the pseudo-representation of the the decision rules or actions taken is made.
problem s o l u t i o n (decision t a b l e , f l o w c h a r t , e t c . )
and i n t e r p r e t s or executes i t . This allows the Table-driven problem solving techniques can
decision l o g i c to change without reprogramming best be applied when there is a f i n i t e set of
the table i n t e r p r e t e r . actions which are to be taken as a r e s u l t of a set
of decision rules. Decision tables are p a r t i c u -
Table-driven i n t e r p r e t i v e techniques are gen- l a r l y amenable to t a b l e - d r i v e n problem solvers.
e r a l l y applicable where there is a f i x e d set of Flowcharts that can be cast as f i n i t e automatons
conditions to be considered and actions to be tak- can also be adapted to t a b l e - d r i v e n techniques. A
en, and the combination of conditions considered few examples are given to i l l u s t r a t e the general
and/or actions taken is subject to change. Table- technique.
driven or i n t e r p r e t i v e problem solving techniques
have many advantages. F i r s t of a l l , the program 2. DECISION TABLES AS THE PSEUDO-REPRESENTATION
to i n t e r p r e t the pseudo-representation of the pro-
blem need be w r i t t e n and debugged only once. I f Consider the decision table in Figure 1 con-
the pseudo-representation of the problem is cor- s i s t i n g of four r u l e s , three conditions and three
r e c t , then the computer s o l u t i o n w i l l be correct, actions (2). Yes and no are indicated by Y and N
r e s p e c t i v e l y , and a dash (-) means that the value
Permission to copy without fee all or part of of the condition has no e f f e c t on the outcome.
this material is granted provided that the copies For example, in r d e 1 the order would be approved
are not made or distributed for direct commercial regardless of the value of "Special Clearance" as
advantage, the ACM copyright notice and the title long as the value of "Credit OK" and "Favorable
of the publication and its date appear, and notice Pay Experience" is Y. A t a b l e - d r i v e n decision
is given that copying is by permission of the Asso- table routine may be implemented by w r i t i n g a pro-
ciation for Computing Machinery. To copy otherwise, gram to accept a variable size matrix representing
or to republish, requires a fee and/or specific per- the decision rules and actions to be taken. Each
mission. column of the matrix is then considered as a
o ~980 ACM 0-89791-014-1/80/0200-0032 $00.75 vector of N condition values and M corresponding

32
possible actions, Vi = (cl, c2 . . . . . cn, a l , a 2 . . . . . from the program or l e f t for futureuse, as i t w i l l
am). The example of Figure l might be used by a not be executed without a corresponding action en-
store for checking a customers credit before making try in the condition-action matrix. Conditions and
a sale. When a customer desires a credit sale, a actions may be added or deleted by merely changing
vector of conditions would be presented to the the number of rows in the table. Likewise, rules
table-driven problem solver. I t in turn would may be added and deleted by changing the number of
search for a vector of stored conditions that match columns in the table. Both limited entry (Y, N, - )
(or satisfy) the input vector and then perform the and extended entry (values or relationships such as
appropriate actions. Note that i f i t becomes nec- 156 or =) decision tables are amenableto table-
essary to modify the conditions for approving cred- driven techniques. I t may be desirable to store
i t , only the condition portion of the condition~ the condition-entry vectors as a separate matrix
action matrix need be changed, e.g., Figure 2. I t from the matrix of action vectors when there is a
is not necessary to modify any program code for the great deal of duplication to reduce space require-
altered conditions. I f new actions are to be im- ments. For example, rules R2 and R4 in Figure l
plemented, then the code can be developed and have the same action vectors. These rules could
tested independently. Whenactions are no longer share the same action vector by appending to each
appropriate the corresponding code may be deleted condition vector in the condition matrix an

R1 R2 R3 R4

Special C l e a r a n c e Y N

Credit OK Y - N

F a v o r a b l e Pay E x p e r i e n c e N

P e r f o r m Approve Order X X

P e r f o r m Reject Order

Notify Manager X X

Figure 1

R1 R2 R3

Special C l e a r a n c e

Credit OK N Y

F a v o r a b l e Pay E x p e r i e n c e Y N

P e r f o r m Approve O r d e r

P e r f o r m Reject O r d e r X

Notify Manager X X

Figure 2

33
additional entry indicating the corresponding ac- that t h i s can be accomplished without changing or
tion vector in a separate action matrix. developing new code as long as e x i s t i n g assembly
techniques are used.
3. FINITE STATE AUTOMATONSAS THE PSEUDO-
REPRESENTATION The example f o r approving c r e d i t can also be
solved with an appropriate f l o w c h a r t / f i n i t e autom-
Other pseudo-representations that can be used aton as can many banking, bookkeeping, and inven-
to drive t a b l e - d r i v e n problem solvers include f i - tory-supply problems. Lathes and t o o l i n g machines
n i t e automata or flowcharts that can be cast as may also be c o n t r o l l e d by a t a b l e - d r i v e n problem
f i n i t e automata. Many business and i n d u s t r i a l pro- solver by generating a set of routines to machine
blems can be solved by an appropriate f i n i t e autom- a gear, groove, etc. The input to the program
aton.. Consider a computerized assembly l i n e in would consist of a state table to d i r e c t the order
which N d i f f e r e n t products are made from the same in which these routines where executed. The depth
subparts by combining them in d i f f e r e n t orders. of grooves, size of cogs produced, e t c . , would be
For example, in b u i l d i n g coffee tables there might determined by the value of global variables sup-
be M styles of table tops, N styles of legs, and P p l i e d with the stateotable. As an example, con-
s t y l e s of handles. Generally a separate program sider the flowchart of Figure 3 f o r approving a
would be w r i t t e n f o r each flowchart or f i n i t e au- c r e d i t sale. I t is recast in Figure 4 as a f i n i t e
tomaton representing an assembly procedure. What state automaton and in Figure 5 in a s u i t a b l e tabu-
is desired is a s i n g l e program which would accept l a r form f o r presentation to the computer. Figure
as input a f i n i t e automaton d i r e c t i n g the assembly 6 shows sample code in a high level language which
process and/or choice of styles. Hence, a l l of the would be driven by the table of Figure 5.
current product l i n e would be produced using a
single program but with a d i f f e r e n t t a b u l a r repre- To implement f i n i t e automata requires only
sentation f o r each product s t y l e to control pro- that we w r i t e a program which uses i t s current
gram flow and the assembly process. New products state and next input to t r a n s f e r to a new state.
could be produced f o r consideration from e x i s t i n g Changing the next state i n d i c a t o r s changes the
or new parts bydeveloping a new f i n i t e automaton problem solved by the automaton. Input to the
to specify the order of assembly and/or selection t a b l e - d r i v e n problem solver of Figure 6 would be a
of parts. The new product would then be produced vector containing the appropriate values of
by using the new automaton as input to the t a b l e - "Special Clearance," "Credit OK," and "Favorable
driven problem solver. I t is important to note Pay Experience." State 0 is always assumed as the

N y J Perfo= Approve Order


~ Notlfy Manager ~STOP )

Perform ApproveOrder
N ~ Notify Manager ~STOP )

N ~,Y ,

IPerf?rmApproveOrder I
(STOP)
J'PerformRejectOrder I "/~ )
I Notify Manager , ~ STOP

~ PerformRejectOrder~ /~ STOP )

Figure 3

34
S,ec~-a'Lc ~
e ~ -

Figure 4

STATE TABLE N FAIR

Special Clearance 0 1 8

Credit OK 1 5 8

Favorable Pay E x p e r i e n c e 2 6 7

Figure 5.

Procedure ACTION(V) ;Declare V(3) ARRAY of conditions;


NEXT STATE:=0;
.B :=TRUE ;
WHILE B DO
BEGIN CASE NEXT STATE OF
~: NEXT STATE?.'=TABLE(0,V(1) ) ;
i: NEXT--STATE :=TABLE (I,V(2)) ;
2 : NEXT--STATE :=TABLE (2, V (3 ) ) ;
3: B E G I N P e r f o r m Approve Order;
B:=FALSE END;
4: BEGIN P e r f o r m Approve Order;
N o t i f y Manager;
B:=FALSE END;
5: BEGIN P e r f o r m Re-act Order;
B:=FALSE END;
6: BEGIN P e r f o r m Re-act Order; Notify Manager;
B:=FALSE END;
7: BEGIN P e r f o r m Approve Order; N o t i f y Manager;
B:=FALSE END;
8: BEGIN P e r f o r m Error Routine; B:=FALSE END;
END CASE;
END Procedure;

Sample Code Using State Table


Fiqure 6.

35
s t a r t state f o r each transaction. Running the f i - automata f o r checking the completeness of solutions
n i t e automata is accomplished by performing a l l and minimizing the number of e n t r i e s or states.
actions indicated by the current state. The next The use of t a b l e - d r i v e n problem solvers would allow
state is determined as a function of the current the s o l u t i o n of problems on a computer by personnel
state and value of the next element in the input not f a m i l i a r with programming languages.
vector. For example, assume the input vector V =
(Special Clearance, Credit OK, Favorable Pay) = Note that changing the contents of the state
(N,Y,N). Starting in state zero, TABLE(O,N) i n d i - table not only changes the problem solved but may
cates a t r a n s f e r to state I . In state one, r e s u l t in one or more action states not being used.
TABLE(I,Y) indicated a t r a n s f e r to state 2. TABLE I f desired, a table driven problem solver could be
(2,N) in state 2 indicates a t r a n s f e r to state 6. used to accept the tabular representation of the
State 6 says to "Perform Reject Order," " N o t i f y the problem and generate a source program to execute
Manager," and t r a n s f e r to state zero in preparation i t consisting of only the action states required
f o r the next c r e d i t request. I f the vector were by the state table. A s i m i l a r approach has pre-
V = (N,Y,Y) then we would a r r i v e in state 3 and v i o u s l y been implemented in the language XPL to aid
"Perform Approve Order" and t r a n s f e r to state zero. in the automatic generation of compiler parsers.
The r e s u l t i n g program (set of action states) would
More complete examples using f i n i t e automata have to be compiled separately f o r each problem
to solve various problems may be found in ( I ) . Fig- solved but with the state table would be an aid to
ure 7 e x h i b i t s a d i f f e r e n t state table which, i f documentation and only require object code f o r the
combined with the actions specified in the proced- actions states a c t u a l l y u t i l i z e d in the s o l u t i o n .
ure of Figure 6, changes the rules f o r granting Generalized problem solvers would p o t e n t i a l l y have
credit. In the state table of Figure 5 the vector a large number of states of which only a small
V = (N,N,Y) would r e s u l t in the sale being rejected portion would be required f o r a s p e c i f i c s o l u t i o n
(state 5). For the state table of Figure 7 the as represented in the state table. Hence generat-
vector V = (N,N,Y) would r e s u l t in the sale being ing a source program consisting of only the re-
approved and n o t i f y i n g the manager. Note that not quired states could r e s u l t in large savings in
only the state table values have been changed but space in the object module.
also the meanings associated with each row (condi-
tions checked by the automaton). Also, the new
solutions were obtained without changing any code REFERENCES
by u t i l i z i n g e x i s t i n g action states.
I. Barnes, B. H. "A Programmer's View of
4. SUMMARY Automata," Computing Surveys (Dec. 72), 221-
239.
I t has been shown that t a b l e - d r i v e n problem
solvers o f f e r advantages over conventional computer 2. Pooch, V. W. "Translation of Decision Tables,"
programming techniques. This is p a r t i c u l a r l y true Computing Surveys (June 74), 125-151.
in instances where a large number of f i x e d decision
rules and/or actions e x i s t and only the combination
of rules considered or actions taken is subject to
change. Program r e l i a b i l i t y is enhanced as the
actual code need not be changed, rather only the
contents of the tables d r i v i n g the code or possi-
bly the actions in the action states. The tables
in turn provide a form of self-documentation. The
tables can f r e q u e n t l y be derived more e a s i l y and
at less overhead than the development of new com-
puter programs or modification of e x i s t i n g pro-
grams as the environment the program models
changes. A considerable body of material e x i s t s
in the l i t e r a t u r e on decision tables and f i n i t e

Y N FAIR

Special Clearance 0 4 1 8

Credit OK 1 3 2 2

Friend of Boss 2 7 5 8

Figure 7

36

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy