Vous êtes sur la page 1sur 18

Some issues of representation in a

general problem solver


by G E O R G E W.ERNST
Case Institute of Technology
Cleveland, Ohio

and

ALLEN NEWELL
Carnegie Institute of Technology
Pittsburgh, Penna.

INTRODUCTION Another sample task is that of integrating, sym-


The research reported here is an investigation into bolically, a simple integral such as
the development of a computer program with general Ite'dt.
problem solving capabilities. This investigation in-
volved the construction of one such computer pro- This problem is apparently quite different from the
gram called the General Problem Solver (GPS, missionaries and cannibals task, but GPS has the
although more properly GPS-2-6) which was accom- generality, as well as the ability, to solve both of
plished by modifying an existing program conceived these problems.
in 1957 by A. Newell, J. C. Shaw, and H. A. Simon. Although GPS-2-5 was designed to be general,
(See references 1,2,3,4,5,6,7,8,9,10,11,12.) it, together with its predecessors, only solved three
The emphasis in this research is on the generality different kinds of problems due mainly to inadequate
of GPS on the variety of problems which GPS can facilities for representing tasks. The central problem
attempt to solve. The quality of the problem solving of this research is to generalize GPS-2-5 so that it
exhibited by GPS is only a secondary consideration. can attempt a wider variety of problems. We also
Hence, the kind of problems for which GPS was demand that the formulation of problems for GPS
designed are simple according to human standards. requires no knowledge of the internal structure of the
A typical problem is the missionaries and cannibals program. Underlying this specific objective is the
task in which there are three missionaries and three desire to shed light on some of the issues involved
cannibals who want to cross a river. The only means in designing better representations for problem
of conveyance is a small boat with a capacity of two solvers.
people, which all six know how to row. If, at any This is a brief statement of the problem. Section A
time, there are more cannibals than missionaries on gives a more detailed description of the problem on
either side of the river, those missionaries will be which this research focuses. The organization of
eaten by the cannibals. How can all six get across GPS is described in Section B. Section C describes
the river without any missionaries being eaten? the representation of problems used by GPS-2-5
and Section D describes the generalizations in-
*This paper gives a brief summary of a more detailed work.1 The corporated in GPS. Section E gives a concrete ex-
extension of GPS described here is the essential part of the Ph.D. ample of a task solved by GPS. The results are sum-
thesis of the senior author at Carnegie Institute of Technology.
We are indebted to H. A. Simon and J. C. Shaw for many dis- marized in section F.
cussions about the content of this work. This research was sup- A. The approach
ported in part by Contract SD-146 from the Advance Research
Projects Agency of the Department of Defense and in part by the We may consider a problem solver to be a process
Rand Corporation. that takes a problem specification as input and, if

583
584 Spring Joint Computer Conf., 1967

successful, provides the solution as output. Figure 1 Heuristic search


provides a simplified picture. Initially the problem In a simplified form of the heuristic search para-
specification is expressed in an external represen- digm, there are objects and operators, such that an
tation which is converted by a translator to the in- operator can be applied to an object to produce
ternal representation an encoding of the external eitner a new objeci or a signai umi inuicai.es in-
representation inside the computer. The internal applicability. A heuristic search problem is:
Given:
a. an initial situation represented as an object,
EXTERNAL
b. a desired situation represented as an object,
I REPRESENTATION j
c. a set of operators.
Find: a sequence of operators that will transform
the initial situation into the desired situation.
The first operator of the solution sequence is applied
to the initial situation, the other operators are applied
to the result of the application of the preceding oper-
ator, and the result of the application of the last oper-
TRANSLATOR
ator in the sequence is the desired situation.
The operators are rules for generating objects and
thus define a tree of objects. Each node of the tree
represents an object, and each branch of a node rep-
resents the application of an operator to the object
represented by the node. The node to which a branch
leads represents the object produced by the appli-
cation of the operator. A method for solving a heur-
INTERNAL
istic search problem is searching the tree, defined by
REPRESENTATION
the initial situation and the operators, for a path to
the desired situation.
PROBLEM For many problems we know of no obvious heur-
SOLVING istic search formulation. Thus, in some sense adopting
TECHNIQUES heuristic search limits the generality that can be
achieved. However, heuristic search derives its appeal
from its generality, demonstrated by its wide use in
other research efforts into problem solving (discussed
SOLUTION in Chapter II of *).

The problem of generality


The power of a problem solver is indicated by the
representation is processed by a set of problem effectiveness of its problem solving techniques while
solving techniques and the result of this processing its generality is indicated by the domain of prob-
is (hopefully) the solution. lems that it can deal with.* The generality and the
The model in Figure 1 is useful in depicting the power of a problem solver are not independent be-
issues on which this research focuses. For instance, cause both depend strongly upon the internal repre-
this research ignores, by and large, the properties of sentation. The internal representation is pulled in two
good external representations; whereas the external directions: on the one hand, it must be general enough
representation is the central issue in some problem so that problems can be translated into it, and, on the
solving programs (e.g., the external representations
of Bobrow14 and Raphael15 is an approximation to
This is an over-simplified statement since it qualifies a Turing
the vernacular). Rather, this research approaches Machine as a general problem solver. But its generality stems from
the construction of a general problem solver by t n e fac le amount of information in the specification of
adopting a general paradigm of problems, heuristic problem is not limited. For example, the problem of playing perfect
search, 15 and then constructing problem solving tech- chess can be given to a Turing Machine by listing all possible chess
positions together with the best move for each position. But this
niques that are applicable to the paradigm. After
specification, being impractical, does not qualify a Turing Machine
describing heuristic search we will discuss the role as a chess player. We only point out the inportance of the amount
of the internal representation of a genera! problem of information in the specification of a problem; it will not be dealt
solver. with in this paper.
A General Problem Solver 585

other hand it must be specific enough so that the prob- is solved when an object is generated that is iden-
lem solving techniques can be applied. tical to the desired situation.
To illustrate this interdependence, consider a heur- The problem solving techniques of GPS consist of
istic search problem solver whose only technique is a set of methods, which are applied by a problem solv-
to generate objects by applying the operators in a ing executive. To solve a problem, the problem solving
fixed order and testing if any of the generated objects executive selects a relevant method and applies it.
are identical to the desired situation. It would be easy Subproblems may be generated by the method in an
to construct such a problem solver with a relatively attempt to simplify the problem. In such cases, the
high degree of generality even though it could only main problem may temporarily be abandoned by the
solve the most elementarv problems. On the other problem solving executive for the purpose of solving
hand, it would be difficult today to achieve even a the subproblem. Subproblems are attempted in the
slight degree of generality with a problem solver that same way that the main problem is attempted by
discovered the terms in an evaluation function for selecting and applying a relevant method.
determining the likelihood of the existence of a path A complete description of the problem solving ex-
from any object to the desired situation. Thus, there ecutive and the methods is given in Chapter III.7
are many different problems of generality, one for each For the purposes of this paper, we will only illustrate
set of problem solving techniques, and the difficulty the methods of GPS by describing how GPS ap-
of achieving generality depends upon the variety and proaches the missionaries and cannibals task. In this
complexity of the techniques. example INITIAL-OBJ* is the situation when 3
This research investigates a particular problem of M (missionaries), 3 C (cannibals) and the BOAT
generality the problem of extending the generality are at the LEFT bank of the river. DESCRIBED-
of GPS while holding its power at a fixed level. This OBJ is the situation when 3 M, 3 C, and the BOAT
involved extending the internal representation of are at the RIGHT. M-C-OPR, the only operator of
GPS in such a way that its problem solving methods this task, moves X missionaries, Y cannibals and the
remain applicable and in a way that increases the BOAT from the FROM-SIDE of the river to the
domain of problems that can be translated into its TO-SIDE. We will ignore for the moment how the
internal representation. Thus, this research is mainly task, which includes the above objects and operator,
concerned with representational issues. We would not is represented either externally or internally, assum-
expect the issues to be the same in generalizing the ing that there is some internal representation to which
internal representation of a problem solver which the problem solving methods of GPS can be applied.
employed markedly different techniques than GPS. Figure 2 shows the first few goals attempted by
In this respect, this research has the nature of a case GPS. To solve TOP-GOAL, GPS matches the INI-
study. TIAL-OBJ to the DESIRED-OBJ and detects that
B. GPS there are 3 too many cannibals at the LEFT. In at-
GPS attempts problems by tree'search, as does tempting to alleviate this difference (GOAL 2) the
any heuristic search program. But to guide the M-C-OPR is applied with Y and FROM-SIDE speci-
search GPS employs a general technique called fied to be 2 and LEFT, respectively. This operator
means-ends analysis which involves subdividing a application (GOAL 3) results in the OBJECT 1.
problem into easier sub-problems. Means-ends analy- Since there are still too many cannibals at the
sis is accomplished by taking differences between LEFT, GPS attempts to move the remaining cannibal
what is given and what is wanted, e.g., between two to the RIGHT (GOAL 4, GOAL 5, GOAL 6).
objects or between an object and the class of objects However, first the BOAT must be moved back to
to which an operator can be applied. A difference the LEFT (GOAL 7, GOAL 8). The operator in
designates some feature of an object which is un- GOAL 6 can be applied to OBJECT 2 which results
desirable. GPS uses the difference to select a desir- in the old situation OBJECT 1. At this point GPS
able operatorone which is relevant to reducing the knows that it is in a loop and looks for something new
difference. For example, in attempting the original to do. (To be continued in Section E.)
problem, GPS detects a difference, if one exists, This example illustrates the kind of information
between the initial situation and the desired situation. that GPS must abstract from the internal repre-
Assuming that a desirable operator exists and that sentation in order to apply its problem solving
it can be applied to the initial situation, GPS applies
*We adopt the convention that words written in all capital letters
it and produces a new object. GPS rephrases the correspond directly to I PL symbols inside the machine. These sym-
original problem by replacing the initial situation bols are either defined in the I PL code76 that comprises GPS or
with the new object and then recycles. The problem defined in the task specification.
586 Spring Joint Computer Conf., 1967

TOP-GOAL: TRANSFORM the INITIAL-OBJ into the difference process detects the difference used in the
DESIRED-OBJ. state of GOAL 7.
GOAL 2: R E D U C E the number of C's at the LEFT bank
Desirability-selection. For any difference GPS must
of the river in the INITIAL-OBJ by 3.
GOAL 3: APPLY the M-C-OPR with Y = 2 and FROM- be able to select from all operators of a task those
SIDE = LEFT, to INITIAL-OBJ. OBJECT 1: operators that are relevant to reducing the difference.
(LEFT (M 3 C 1) RIGHT (M O C 2 BOAT (Of course, this selection will not in general be
YES)) perfect.)
GOAL 4: TRANFORM OBJECT 1 into the INITIAL-
The M-C-OPR is selected to reduce the difference
OBJ.
GOAL 5: REDUCE the number of C's at the LEFT bank in GOAL 2. But before generating GOAL 3 GPS
of the river in OBJECT 1 by 1. specifies the variables Y and FROM-SIDE to insure
GOAL 6: APPLY the M-C-OPR with Y = 1 and FROM- that the operator performs the desired function. Such
S I D E = LEFT, to OBJECT 1. a specification of variables limits the number of dif-
GOAL 7: REDUCE the difference that the BOAT is not
ferent ways that the operator can be applied to a given
at the LEFT bank in OBJ ECT I.
GOAL 8: APPLY the M-C-OPR with TO-SIDE = LEFT object. Hence, it can be viewed as the selection of
to OBJ ECT 1. a few promising possibilities from the total number
OBJECT 2: (LEFT (M 3 C 2 BOAT YES) of possibilities.
RIGHT (M O C 1)) Feasibility-selection. For any object GPS must
GOAL 9: APPLY M-C-OPR with Y = 3 and FROM-
S I D E = LEFT, to OBJECT 2.
be able to select from all the operators those that are
OBJECT 1: (LEFT (M 3 C 1) RIGHT (M O applicable to the object. (Again, perfect selection is
C 2 BOAT YES)) not necessary.) This is meant to cover the case where
GOAL 4: TRANSFORM OBJECT 1 into the INITIAL- the internal representation permits several operators
OBJ. of limited range to be combined into a single operator
Figure 2 -The first few goals generated by GPS in solving
missionaries and cannibals
of wider range, such that the application of the unified
operator does not decompose simply to the sequential
methods. Hence, these methods place large demands application of the sub-operators. Feasibility-selection
on the internal representation because processes that is used in achieving GOAL 3 in Figure 2. Note that
abstract the information must be feasible. Below we the operator, move 0 missionaries and 2 cannibals
summarize the demands of the problem solving from LEFT to RIGHT, is a schema in the sense that
methods, cross-referencing each to the above ex- it can be applied to many different objects to yield
ample. many different results. For example, in GOAL 3
Each of these demands requires that GPS employ it is applied to INITIAL-OBJ to yield OBJECT 1
a process for abstracting certain information from but it can also be applied to the object,
the internal representation. These processes may be LEFT ( M O C 2 BOAT YES) RIGHT (M 3 C 1),
different for different representations, but the in- to yield DESIRED-OBJ. Feasibility-selection re-
formation abstracted does not depend on the rep- quires that GPS produce the result without generating
resentation. the different instances of the operator schema.
Object-comparison. GPS must be able to compare Canonization. GPS must be able to find the can-
two objects to determine if they represent the same onical name of certain types of data structures.
situation. Object-comparison is used in attempting Canonization arises from GPS's strategy for com-
the TOP-GOAL in Figure 2. paring two data structures. If they have canonical
Object-difference. If two objects do not represent names, they are equivalent only if they have the
the same situation, GPS must be able to detect dif- same name. On the other hand, if two data structures
ferences between them that summarize their dis- do not have canonical names, they are equivalent
similarity. In attempting TOP-GOAL, the object- only if all of their structure is equivalent. GOAL 9
difference process detects the difference that is used in Figure 2 leads to the regeneration of GOAL 4.
in the statement of GOAL 2. GPS recognizes that these two goals are indentical
Operator-application. GPS must be able to apply because they have the same canonical name (even
an operator to an object. The result of this process though they are generated in different contexts).
is either an object, or a signal that the application is
not feasible. The operator-application* is used to C. Internal representation of GPS-2-5
achieve GOAL 3. The current version of GPS was developed through
Operator-difference. If it is infeasible to apply an the modification of an existing version, called. GPS-
operator to an object, GPS must be able to produce 2-5. That GPS-2-5, together with its predecessors,
differences that summarize why the '-application is solved only three different kinds of problems was
infeasible. In attempting GOAL 6, the operator- due mainly to inadequate facilities for representing
A General Problem Solver 587

tasks. The internal representation of GPS-2-5 will branch leads to indicates that three missionaries,
be described to clarify how the representation in- three cannibals, and the boat are at that bank of the
corporated in GPS (described later) alleviated in- river.
adequacies in representation. The internal represen- The use of variables in the tree structures described
tation of a task for (3PS (any version) consists of above allows a class of objects to be represented as
several different kinds of data structures: a single data structure. For example, Figure 4 is
a. objects the tree structure representation of / d u du. If u
b. operators is a variable, this tree structure represents a large
c. differences
S
d. goals
e. TABLE-OF-CONNECTIONS
f. DIFF-ORDERING *
g. details for matching objects
h. miscellaneous information / \
A complete description of the above types of EXP D
data structures is given in Chapter IV.1 Here, we
will only describe the representation of objects and
operators, which provide the main representational E
A U
I
U
issues. However, an example of each kind of data Figure 4 The tree structure representation of /e u du
structure is given in Section E. Other than objects
class of objects. All members of the class have the
and operators, differences are the only other type of
same form but different values for u. GPS assumes
data structure whose representation in GPS is dif-
ferent from its representation in GPS-2-5. Their that all tree structures may contain variables and it
representation depends to a large extent on the repre- is prepared to process them as classes of objects.
sentation of objects and operators, and will be dis- Operators. In GPS-2-5 all operators were rep-
cussed in more detail later. resented by representing the form of both the input
Objects. In GPS-2-5 objects are represented by tree and resultant objects. Assuming that u is a variable,
structures encoded in I PL description lists. Each Figure 4 is the tree structure representation of the
node of the tree structure can have an arbitrary num- input of the operator, / eudu = e u , and Figure 5 is
ber of branches leading from it to other nodes. In the tree structure of the output. Such an operator
addition to branches, each node can have a local can only be applied to a member of the class of objects
description given by an arbitrary number of attribute- represented by the input form.
value pairs. The tree structure in Figure 3, for ex- D. Representational issues
ample, represents the initial situation in the mis- The representational issues that were investigated
sionaries and cannibals task. In Figure 3 the node to arose from various properties of tasks that could not
which the LEFT branch leads represents the left adequately be dealt with by the existing program.
bank of the river and the node to which the R I G H T Each of these issues will be discussed below. For
branch leads represents the right bank of the river. some the representation was generalized, and the
The local description at the node which the LEFT difficulty was removed. Other issues could not be
dealt with within the framework of the existing pro-
gram. However, attempting to alleviate these diffi-
culties did clarify important aspects of the issues.
EXP
LEFT X \ RIGHT
/ \
E U
Figure 5 The tree structure representation of J"eu
M 3
Desired situation
In many tasks the desired situation is a class of
C 3
objects that could not be represented in GPS-2-5.
In integration, for example, the desired situation is
BOAT YES
any expression that does not contain ' / ' . A tree struc-
Figure 3 The tree structure representation of the initial ture cannot represent this class of objects because all
situation in the missionaries and cannibal task of the members do not have the same form. For this
588

reason the representation of the desired situation operator can be represented as a data structure, called
had to be generalized. a MOVE-OPERATOR, that consists of a group of
In introducing a new representation for the desired TESTs and a group of TRANSFORMATIONS.
situation, GPS must be given some new processes The TESTs, which are the same as the TESTs in a
for abstracting information from the new representa- DESCRIBED-OBJ, must be satisfied in order for
tion: a new object-comparison process so that GPS the operator to be applicable and the TRANSFOR-
can compare an object to the desired situation; and MATIONS indicate how the resultant object differs
a new object-difference process so that GPS can from the input object.
detect differences between an object and the desired A TRANSFORMATION is a data structure that
situation. Object-comparison and object-difference consists of an OPERATION and several arguments.
are the only demands (described above) of GPS's GPS knows the semantics of the OPERATIONS,
problem solving method that are affected by the intro- but as in TESTs, only knows the generic form of
duction of a new representation for desired situation. the arguments, which are task dependent. Currently,
The generalization of the desired situation allowed GPS understands six OPERATIONS. A typical
it to be represented as a set of constraints called a TRANSFORMATION (from the missionaries and
DESCRIBED-OBJ. A set of constraints represents a cannibals operator that moves X missionaries, Y
class of objects, each of which satisfies all of the cannibals and the BOAT from LEFT to RIGHT) is:
constraints. The desired object in the integration DECREASE the number of missionaries at
task can be represented by the single constraint: the LEFT by X and increase the number of
missionaries at the right by X.
No symbol in the expression is an ' / ' . In this TRANSFORMATION the OPERATION is
DECREASE and the arguments are X, the number
Each constraint in a DESCRIBED-OBJ is a data of missionaries at the LEFT, and the number of
structure, called a TEST, that consists of a RELA- missionaries at the RIGHT.
TION, and several arguments (in most cases, two). Figure 6 illustrates how the operator that moves X
In the previous example, missionaries and Y cannibals from LEFT to RIGHT
a. the RELATION is NOT-EQUAL; can be represented as a MOVE-OPERATOR. The
b. the first argument is a symbol; first two TESTs indicate that X and Y must be
c. the second argument is ' / ' . greater than O. The third TEST insures that at least
This constraint is quantified "for all" symbols. one person is in the BOAT to operate it and that
GPS recognizes NOT-EQUAL as a RELATION the capacity of the BOAT is not exceeded. The re-
which it understands. (Currently GPS understands maining TESTs prevent missionaries from being
fifteen RELATIONS.) On the other hand, GPS only eaten.
understands the generic form of the arguments,
the arguments themselves being task dependent. TESTs: , ,
Using constraints to represent objects is con- 1. X e {o. 1, 21
venient because each constraint is a simple data 2. Y e {0, 1, 2 }
structure. Both the object-comparison process and 3. X +Y < 2
4. Either
the object-difference process analyze the structure a. the number of missionaries at the L E F T
of the constraints. The structure of many representa- > the number of cannibals at the L E F T ,
or
tions is too complex to permit such an analysis. For b. the number of missionaries at the L E F T
example, an alternate representation for the desired = 0.
5. Either
situation is a program whose input is an object and a. the number of missionaries at the RIGHT
whose output is a signal indicating whether or not < the number of cannibals at the RIGHT,
or
the object is a member of the class of objects that the b. the number of missionaries at the RIGHT
program represents. The object-difference process = 0.
for this representation would be extremely complex TRANSFORMATIONS:
1. DECREASE the number of missionaries at the
because it would require an analysis of the program. L E F T by X and increase the number of mission-
aries_at the RIGHT by X.
2. DECKfc,ASE the number of cannibals at the L E F T
Operators by Y and increase the number of cannibals at the
The operators of many tasks, particularly math- RIGHT by Y.
3. MOVE the BOAT from the L E F T to the RIGHT.
ematical calculi could be represented conveniently
in GPS-2-5. However, the operators of other tasks Figure 6 - T h e MOVE-OPERATOR representation of
could not, e.g., the operator of missionaries and the operator that moves X missionaries. Y cannibals
cannibals. To alleviate this difficulty, in GPS an and the BOAT from the LEFT to the RIGHT
j o y

The three TRANSFORMATIONS indicate how alized processes were more complex and did more
the application of the operator affects the number processing, there was a savings due to an overall
of missionaries, the number of cannibals and the reduction in the problem space.
BOAT, respectively. TRANSFORMATIONS can The main complicating feature of unordered sets
also implicitly test feasibility. For example, the is that in matching two unordered sets corresponding
BOAT must be at the LEFT jn order for the third elements must be paired. A variable can be made
TRANSFORMATION to be applicable. identical to any element via substitution and thus
The introduction of MOVE-OPERATORs in can be paired with any element. However, to see the
GPS required the addition of new processes so that identity of two unordered sets may require that a
the problem solving methods could be applied to particular variable be paired with a particular element.
this new representation. New processes were needed Chapter V 1 discusses this issue in more detail and
for operator-application, operator-difference, desir- describes how the generalized processes (object-
ability-selection, and feasibility-selection. Hence, the comparison, etc.) deal with this issue.
MOVE-OPERATOR representation was designed
Large objects
so as to make these processes simple. For many
GPS can only solve simple problems before its
representations one or more of these processes would
memory is exhausted. However, for some tasks the
be too complex to implement.
objects are so large that not even simple problems
A key feature of the MOVE-OPERATOR rep-
can be solved before its memory is exhausted. For
resentation is its transparent structure. Each of the
example, the representation of a chessboard in GPS
new processes does an analysis of this structure in
requires 1,000 memory locations and thus only several
order to abstract the necessary information. Another
objects can be stored in memory.
good property of MOVE-OPERATORs is its struc-
tural similarity to DESCRIBED-OBJ. This similarity There are two distinct difficulties with GPS's
causes the MOVE-OPERATOR processes to be use of memory: (1) GPS saves in memory all objects
similar to the DESCRIBED-OBJ processes, and thus generated during problem solving and (2) each object
all of these processes use the same basic subroutines. is a total situation, i.e., there is no provision for
For example, the operator-difference process for dealing with fragments of situations. These diffi-
MOVE-OPERATORs and the object-difference culties could not be dealt with in this research be-
process for DESCRIBED-OBJs are nearly identical. cause they are too closely connected with the problem
solving methods of GPS, which were held fixed.
Unordered sets
The representation of some tasks requires rep- Differences
resentation of an unordered set. Multiplication, In generalizing GPS, the representation of differ-
for example, can be represented as an n-ary function ences was degenerated. Each difference in GPS
of a set of arguments whose order is unimportant. can only pertain to the value of an attribute of a node
Such an unordered set can'be represented in GPS-2-5 of an object. More global differences, such as the
as an object, representing an ordered set, and an number of occurrences of a symbol, which could be
operator for permuting the elements of the set. This represented in GPS-2-5, cannot be represented
representation has the drawback that discovering the because they would introduce too much complexity
identity of two sets may require several applica- in the operator-difference, the object-difference, and
tions of a permutation operator. The permutation the desirability-selection processes. Thus, the gen-
operator would be unnecessary if the identity test eralization of these processes for MOVE-OPER-
could implicitly take into consideration the unordered ATORs and DESCRIBED-OBJs was based on this
property of the two sets. simplified representation of differences.
The objects of GPS-2-5 can implicitly represent Differences, although not part of the general
unordered sets, provided that the nodes can be tagged heuristic search paradigm, are central to means-ends
either ordered or unordered. These tags designate analysis, which is the main technique of GPS. Many
the branches of a node to be either ordered or un- tasks were not given to GPS, because the simple
ordered. Although a seemingly simple generalization, differences would not adequately guide GPS's
it considerably complicates the object-comparison, search for a soltuion. For example, many of the
the object-difference, the operator-application, logic tasks solved by GPS-2-5 cannot be solved by
the operator-difference, and the canonization pro- GPS due to the lack of direction provided by the
cesses. These processes were generalized for the degenerate differences. However, the representation
integration task so that the nodes of objects and of differences is adequate for the eleven tasks that
operators could be unordered. Although the gener- were given to GPS.
590 Spring Joint Computer Conf., 1967

. An example the 3 missionaries, the 3 cannibals, and the BOAT


Since the emphasis of this research is on the in- are at the LEFT bank of the river. DESIRED-OBJ
ternal representation of problems, it was designed is a similar data structure representing the situation
without any consideration of how tasks might be com- when the 3 missionaries, the 3 cannibals and the
T
municated to the machine. The external representa- R H A T nre> at t"he R I G H hank of the river
tion was then designed so that a task expressed in it The next four data structures are necessary only
would be readable. Below we describe the external because they are used in the definition of M-C-OPR.
representation of the missionaries and cannibals task X+Y is the name of a data structure representing
and how its corresponding internal representation is the sum of X and Y. 1, 2 is the data structure rep-
processed by GPS. It is hoped that the external rep- resenting the set that contains the two elements,
resentation of this task (and the other ten given 1 and 2. 0,1,2-SET and SIDE-SET are similar data
to GPSO is sufficiently readable for the reader to structures that represent sets.
decipher. If this is the case, he can determine precisely FROM-SIDE-TESTS is a data structure that rep-
what information is contained in the specification resents a set of two TESTs. The first TEST is true
of a task. As noted earlier, the amount of information if the number of missionaries at the FROM-SIDE
in the specification of a task is related to the issue is not less than the number of cannibals at that bank
of generality. of the river. The second TEST is true if there are no
Figure 7 shows the specification of the missionaries missionaries at the FROM-SIDE. TO-SIDE-TESTS
and cannibals task for GPS. The specification of is a data structure similar to FROM-SIDE-TESTS.
any task is a string of words delimited by "spaces." Both of these data structures are used in the definition
Parentheses are used to group the words. The first of the next data structure, M-C-OPR.
part of the specification (the part before the oc- M-C-OPR is the data structure that represents
currence of TASK-STRUCTURES) indicates how the only operator of this task. CREATION-OPER-
words that are not part of GPS's basic vocabulary, ATOR indicates that the result of applying the
should be interpreted. For example, BOAT is a word M-C-OPR should be a new list structure instead of
peculiar to this task. The string a modification of the list structure that represents
BOAT = ATTRIBUTE the input object. The words enclosed in ('s are
designates the BOAT to be an ATTRIBUTE of a comments.
node of an OBJECT-SCHEMA. This part of the Following VAR-DOMAIN are four TESTs that
task specification is analogous to declaration state- constrain the legitimate values of variables. In-
ments in ALGOL. cidentally, GPS knows which words are variables
The remainder of the task specification defines the because they are listed in the data structure, LIST-
data structures that comprise the representation of OF-VAR, defined at the end of the task specification.
a task. Each data structure definition has the form The first two TESTs following VAR-DOMAIN
<name> = ( <body> ) require X and Y to be 0,1, or 2 and their sum to be
The first such definition in Figure 7 follows TASK- no greater than 2.
STRUCTURES. The name of this structure is TOP- The third and fourth TESTs indicate that both
GOAL and it designates INITIAL-OBJ to be the TO-SIDE and FROM-SIDE stand for different banks
"initial situation" of the problem and DESIRED- of the river.
OBJ to be the "desired situation." The three TRANSFORMATIONS following
INITIAL-OBJ is the next data structure defined MOVES indicate how the values of the three AT-
in Figure 7. This data structure, shown as a tree TRIBUTES, BOAT, M, and C, are modified in
structure in Figure 3, represents the situation when applying the operator.
RENAME

LEFT FIRST

RX15fT~S'E"C0D

TFTClTRE

B"0TT ATTRIBUTE

C ATT,RTB"U'T'E
A General Problem Solver 591

B?l EKWIffil~r

-BvpnTTEXtWE

C-L = KEffTOFfE ''


:
C-R a~JTE"ATURE

D"ESTRFQ^"0"B^*^"iy9"JECrf"^S^ffE>fA

TR OW^STD E^HJO"C P R 0 G

TR"O^S~li"D"EVTE"STS~V-VVTFsrs

TWrtTAU^OBJ * OB^ECY^SCHE^

M ATTiR"IWTr~

TF&rQPW^n0"V '6HD' P E R ATO R

"H-U s gEXfORE

H^R"1~CEXTURE

"STDB-S^r-ir-SBT

TCr="STDFT~="~r0C^PR"0G

TO"- SID E^T ES T S - a~T-TESTS

"X-* "CONSTANT

y^ry-a-^xpRES

T~_CONSTANT '

"TJT1T2 - S ET-e-'S ET

TTZ^T-gFI
TASK-STRUSTURES

TOP*G04L 1! TRANSFORM THE> INI TIAL-OBJ INTO' THE' DESIRED.OBJ ' )


INITIAb-OBJ * ( LEFT < M 3 C 3 BOAT Y5S )
RIGHT ( H O C O ) )
DESIREB-OBJ < LEFT < M 0 C 0 )

RIGHT < M 3 C 3 BOAT YES > >

X+Y a ( X + Y )

1*2 " C 1 2 )

01*2-SET a ( 0 1 2 )
SIDB-S5T a (! LEFT RIGHT )

FROM-SXDE-TESTS a < 1. THE M OF: THE FROM-SIDE; IS NOT-LESS-THAN

THE C OF: THE FROM-SIDE; .


2. THE M OF THE FROM-SIOE' EQUALS 0 .
592 Spring Joint Computer Conf., 1967

TO-SIDS-TESTS a ( 1 , THE M OF THE TOPSIDE IS NOT-LESS-THAN

THE C OF THE TO-SIDE ,

2. THE M OF THE TO-SIDE EQUALS- 0 .

M-Q^QPfi a < CREATION-OPERATOR

J MOVE X MISSIONARIES AND Y CANNIBALS' FROM THE FROM-SlpE TO

TJHE _TJ) "_ S iP_i _


VAR-DOMAIN

1, Y IS A CONSTRAINED-MEMBER OFl THE. 0 , 1 , 2 - S E T ,

THE CONSTRAINT IS X + Y IS IN-THE-SET 1 , 2 .

2. X IS A CONSTRAINED-MEMBER OFl THE: 0 , 1 , 2 - S E T $

THE CONSTRAINT IS X + Y IS IN-THE-SET 1 , 2 t

3. THE FROM-SIDE IS AN EXCLUSIVE-MEMBER OF THE S'tDE-SET

4. THE TO-SIDEi IS AN EXCLUSIVE-MEMBER' OF THE SIPB-SET .

MOVES ~

IVMOYE THE"BOAT~OF~THE"FROM--sri7E-TO~THE~BO"AT~OF~THE~"TO-Sl'DFT

27~D E C R E"A S E~ B Y~T H E~A M 0 U S T~X ~T*I E~M~AT~T H E~F R OM-S fD EHk~N D~A DD

IT~T 0~T H E "M~A T~T H E~T3-~ SI t)T~.

STTJEcRFASE-BY^HE-AMOUsrT-THE-Cnnn^e^ROMVSTDE^A'ND-A^

^^^"TRErc-AT^THE^TS^SI'D'Er;;

posT^nr E STS ~~
iT^ARE-ANY^FTflfFROM-SlDE-TESTS-TROF-;^

2T~Aftg"AWOF THE f O ^ S T D E ^ T F S T S n r W E - T l "

"B-L ( BWT~ON~fHE~TFY~7~l ~~~~

"B^R-IT-BfAT-ONnrHE-RIGHrT - !

-(T-T~s~r~C~ON~T H E~C E F T~T~)

"C- R~"~r~C~0"N~t'R6~RI "GHT~~)

^^"""Tir-OirTHE-tEFT-T-J

"M^R ( K ~ 0 1 T T H E _ R r 6 H T - ^ )

"D'IFF-_WE~RiNG s ( flT-fTIM-r~C"=R~CHL~| " ' "

rB-o-in-)
TAWE^F^CWN^TTOVS-B~CTHCToW^^ ~~ "

'COMP"A"RF^O"BiFCrfS~B(-BASIC-MATCH-)

"B"ASTC~-MATOT-e~T~C0MP-TE"AT-XI5T~r~EFTr~C-L B-L! > > ' ~

TOr-~A7T/R~I"B~~e ( M C BOAT~F~~
:
rT3T=OT?V"A"R 3 < FROM^STDE~TO^SlffEnTT"> _ _
E m } _ _ _ _ _ _ _

Figure 7 The specification for GPS of the missionaries


and cannibals task
A General Problem Solver 593

Following POST-TESTS are two TESTs that must difference, GPS attempts to apply it to INITIAL-
be true of any object produced by an application of OBJ. Before creating GOAL 3, GPS specifies Y
the operator. These constraints prevent missionaries and FROM-SIDE to be 2 and LEFT, respectively,
from being eaten in the resultant object. We can so that the operator will perform the desired function.
assume that the object to which the operator is ap- GOAL 3 results in OBJECT 5 and GPS attempts
plied satisfies these constraints because INITIAL- to transform this new object into DESIRED-OBJ
OBJ and DESIRED-OBJ satisfy them and all other (GOAL 4).
objects are produced by an application of the M-C- Since there are still too many cannibals at the
OPR. The first TEST following POST-TESTS re- LEFT (GOAL 5), GPS attempts to move the re-
quires one of the two TESTs in FROM-SIDE- m a u l i n g uaiiinuai w uic rvivjrl i \KJ\jr\.M~, vj. nuw-
TESTs to be true (of the resultant object). This pre* ever, the operator cannot be applied because the
vents missionaries from being eaten at the FROM- BOAT is at the wrong bank of the river. In an attempt
SIDE. The second TEST following POST-TESTS is to bring the BOAT back to the LEFT (GOAL 7),
similar. It should be noted that conjunction is the GPS applies the M-C-OPR with the TO-SIDE equal
implied logical connective of the TESTs in M-C- to LEFT (GOAL 8) and OBJECT 6 is produced.
OPR or any other MOVE-OPERATOR. And the GPS moves one cannibal across the river (GOAL 9);
TESTs in POST-TESTS of the M-C-OPR illustrate it does not realize that bringing the BOAT back
how disjunction can be used. to the LEFT also brought a cannibal with it. Since
The next six data structures defined in Figure 7 transforming the result of GOAL 9, which is an old
are the types of differences of this task. A difference object, into the DESIRED-OBJ is an old GOAL,
consists of a type of difference and a value. For GPS does not attempt it but looks for something else
example, the difference to do.
C-L,-2
GOAL 11 is created in an attempt to transform all
indicates that there are two more cannibals at the
of the OBJECT-SCHEMAs which are derived from
LEFT in one object than in another object. DIFF-
the INITIAL-OBJ, into the DESIRED-OBJ.
ORDERING is the data structure that designates
(OBJECT 4, which is the SET of all OBJECT-
M-R, M-L, C-R and C-L to be more difficult to reduce
SCHEMAs derived from the INITIAL-OBJ, is
than B-L and B-R.
generated internally by GPS). GOAL 13 is created
TABLE-OF-CONNECTIONS indicates that because OBJECT 6 has never appeared in a TRANS-
M-C-OPR is relevant to reducing any type of differ- FORM type of GOAL. (This is the NEW-OBJ
ence. COMPARE-OBJECTS and BASIC-MATCH selection criterion.) Since there are too many canni-
causes GPS to look for the following types of differ- bals at the LEFT in OBJECT 6 (GOAL 14), two are
ences in comparing two objects: moved across the river (GOAL 15, OBJECT 7).
a. M-L Everything goes smoothly until GOAL 27, which
b. C-L results in an old object, at which point GPS generates
c. B-L a GOAL indentical to GOAL 22. GPS does not
Hence, GPS only compares the LEFT banks of two reattempt GOAL 22 but generates a new GOAL
objects because what is not at the LEFT must be (GOAL 29) by selecting a NEW-OBJ (OBJECT 8).
at the RIGHT. Attempting GOAL 29 quickly leads to the old
OBJ-ATTRIB is a list of the ATTRIBUTES and object, OBJECT 7 (GOAL 31) and the old GOAL,
LIST-OF-VAR is a list of the variables. GOAL 16.
Figure 8 shows the way that GPS attempts to GOAL 33 is generated by selecting another NEW-
solve the missionaries and cannibals task. In attempt- OBJECT and GPS does not run into trouble until
ing TOP-GOAL, GPS detects that there are too many GOAL 49 which results in an old object. Again a
missionaries and cannibals at the LEFT. GOAL 2 new GOAL is generated by selecting a NEW-OBJ.
is created in an attempt to reduce the number of GOAL 52 is abandoned because attempting it creates
cannibals at the LEFT by 3. GPS knows that there a GOAL identical to GOAL 43. The generation of
are 3 too many cannibals at the LEFT but the '3' GOAL 54 quickly leads to success.
does not get printed. GPS attempts to reduce the
most difficult differences first which eliminates F. Results
B-L. C-L was selected instead of M-L because GPS The initial motivation for this research comes from
detected C-L first. the tasks themselves; they could not be expressed
Since the TABLE-OF-CONNECTIONS indi- in the internal representation of GPS-2-5. But the
cates the M-C-OPR is relevant to reducing this majority of this research focuses on the processing
594 Spring Joint Computer Conf., 1967

i'~T0P-30AL TBAMSFORM INITIAL-OBJ INTO DESIRED-OBJ (SUBGOAL'1 OF NONE)

2 60AL1 2 REDJCE C-L ON I >JITIAL-OBJ (SUQGOAL OF TOP-GOAL)

(SUB30AL OF 2)
SET: X 0. TO-SIDE RIGHT
. 0B JECT s r c l E F M M 3 C i > RlGHT(M ft 0 2 BOAT YES))

2" GOAL^TRANSFORM 5 HTO DESIRED-OBJ (SUBQOAL OF TOP-GOAL)

3 GOAL: 5 REDUCE C-L ON 5 (SUBGOAL OF 4)

}ALT6~APPLY M-C-OPR WITH Y * 1, FROM-SIDE " L E F T , TO 5' (SUBGOAL QP: 3>


SETt X * 0* TO-SIDE RIGHT j

3 30*L: 7 REDUCE B-L! ON 5 (SUBGOAi.' OF 6)

6 80ALI 8 APPLY M.-C-CPR WITH TO-SlD(= * LEFT, TO 5 (SUBGOAL OF 7)


'"'"SETl Y' 1 X 0* FROM-SIDE RIGHT
OBJECT 6t (LEFTtM 3 C ? BOAT YES) RlGHTtM li C 1))

5; GOAL' 9 APPLY M-C-OPR WITH Y * 1, F R O M - S I D E LEFiTl TO 6 (SUBGOAL OFi 6)


SET: X s 0, TO-SIOE s RIGHT |
OBJECT 5* (LEFT(M 3 C 1) RlGHTtM 0 C 2 BOAT YES))

2 QOALi 11' TRANSFORM 4 INTO DESIRED-OBJ (SUBGOAL OF TOP-GOAL)

"3~G0AL 1? SELECT FPOM 4 A/C NEW-OBJ OF DEsIRED-OBj (SUBGOAL ;OF 11)


A SELECTED

3 SO.AL' 13: TRANSFORM 6- INTO DESIRED-OBJ (SUBGOAL OF 11)

"4~G0ALri4 REDUCE C-L ON 6 (SUBGOAL OF 13)

5 30AL 15 APPLY M-C-OPR WITH Y * 2 FROM-SIDE LEFT* TO 6 (SUBGOAL OF 14)


SET: < B: 0* TO-SIOE RIGHT |
OBJECT 7: <LEFT(M 3 C 0) RlGHT(M 0 C 3 BOAT' YES))

4 GOAL 16 TRANSFORM 7 INTO DESIRED-OBJ (SUBGOAL OF' 13)

3' GOAL 5? REDUCE M-L ON 7 (SUBGOAL OF 16)

6 GOALIIB APPLY M-C-OPR WITH X 2. FROM-SIDE LEFT. TO 7 (SUBGOAL OF 17)


SETl Y 0# TO-SIDE RIGHT

7 GOAL' 19 REDUCE B-L ON 7 (SUBGOAL OF 18)

8 GOAL 2P APPLY M-C-OPR WITH Tfl-SiDE LEFT. TO 7 (SUBQOAL OF 19)


SETl Y 1 X 0, FROM-SIDE RIGHT
OBJECT 8 (LEFT(M 3: C 1 BOAT YES) RIGHT(M 0 C 2))

7 GOAD 21 *PPLY M-C-OPR WITH X a j>, FROM-SlDE B UEFT. TO 8 (SUBGOAL OF 18)


""" "" SET! Y Ot TO-SIDE RIGHT I "
OBJECT 9t (LEFT(M 1 C D RIGHT(M 2 C i. BOAT YES))
5' GOAL! 27 TRANSFORM 9 INTO DESIRED-OBJ (SUBGOAH OF'16)
j ' ' . " " ~ ,

6
630ALI 23 REDUCE C-L' ON 9 (SUBGOAL OF 22) "

7 30AU 24 APPLY H-C-OpR WITH Y' B 1, FROM-SIDE B LEFTi TO 9 (SUBGOAL OF 23)


SETl X s 0 TO-SIDE RIGHT * "':

8 GOAL 25 REDUCE B-L ON 9 (SUBGOAL OF 24)


A General Problem Solver 595

9 GOAL 26 APPLY M.C-0P=? WjTH TO-SIDE a LEFT! TO 4 (SUBGOAL7 OF 25)


SETJ Y 1 X 1* FOM*-SlDE RIGHT j
OBJECT 101 <LEFT(M 2 C 2 BOAT YES) RIGHTCM 1:0 D )

8 GOAL 27 APPLY M-C-OPR WITH Y a i. FROM-SIDE * LEFT* TO 10 "(SUBGOAL OF 24)


SETJ X a l, TO-SIOE RIGHT j
OBJECT 9* <LEFT(M 1 C 1> RlGHT(M 2 C 2 BOAT YES)>

"3 G3AL="12 SELECT FROM 4 A/C NEW-OBJ OF DEslRED-OBj (SUBGQAL OF I D


10 SELECTED

3 GOAL'! 29 TRANSFORM 3 INTO DESlRED-OBJ (SUBGOAL OF 11)

4~G0AL 30 REDUCE C-L ON 8 (SUBGOAL OF 29)

5 SOAL 31 APPLY M-C-OPR WJTH Y 1 FROM-SIDE LEFT. TO ft (SUBGOAL' Of 30)


"""' SETJ X 0, TO-SIOE a RIGHT "
OBJECT 7 (LEFT(M 3 C 0> RlGHTtM 0 C 3 BOAT YES))

3 S3AL 12 SELECT FROM 4 A/C NEW-OBJ OF DEslRED-OBj (SUBGOAL OF 11)


10 SELECTED

"S~aOALj"" 33 TRANSFORM 10 INTO OESlRED*OBJ (SUBGOAU OF 11)

'*~4' GO*L: 34 REDUCE C-L ON 10 (SUBGOAL OF 33)

5 GOAL 35 APPLY M-C-OPR WITH Y = 2* FROM-SIDE LEFT. TO 10 (SUBGOAL OF 34)


SET: X a 2. TO-SIDE a RIGHT

4 GOAL' 36 REDUCE M-U ON 10 (SUBGOAL OF 33)

3 GOAL 37 APPLY M-C-OPR WITH X ' ?. FROM-SIDE " L E F T , TO 10 (SUBGOAL OF 36)


SETt Y a o. TO-SIDE a RIGHT I
~" " "' OBJECT 11J (LEFT(M 0 C 2) RIGHT(M 3 C'l B O A T Y E S ) )

~4""G0AL' 38 TRANSFORM 11 INTO DESIRED-ORJ (SUBGOAL OF. 33)

5 GOAL 39 REDUCE C-L ON ll (SUBGOAL OF 38)

b GOAU 40 APPLY M-C-OPR WITH Y a 2l FROM-SIDE i LEFT. TO 11 (SUBGOAL OF 39)


SETJ X a 0. TO-SIDE a RIGHT

7 GOAL 41 REDUCE B-L QM 11 (SUBGOAL OF 40)

3 GOAL 42 APPLY M-C-OPR WITH To-SIDE a LEFT, TO 11 (SUBGOAL! OF 41)


SETJ Y 1. X = 0, FROM-SIDE a RIGHT
OBJECT 121 (LEFT(M 0 C 3 BOAT YES) RIGHT(M 3 C 0))

7 SOAL' 43 APPLY M-C-OpR WITH Y a 2 , FROM-SIDE, LEFTi TO 12 (SUBGOAL OF 40)


SETJ X a 0. TO-SIDE a RIGHT
OBJECT 13: (LEFT(M 0 C 1) RIGHT(M 3 C 2 BOAT YES))'

5 GOAL' 44 TRANSFORM 13 INTO DESIRED-OBJ (SUBGOALi OF 38)

& SOALi 45 REDUCE C-L ON 13 (SUBGOAL OF 44)

7 GOAL'1 46 APPLY' M-C-OPR WITH Y a 1. FROM-SIDE LEFTi TO 13 (SUBGOAL OF 45)


SET: X a 0. TO-SIDE a RIGHT

3 GOAL 47 REDUCE B-L ON 13 (SUBGOAL OF 46)

9 GOAL 48 APPLY M-C-OPR WITH TO-SlDE a LEFT! TO 13 (SUBGOAL OF 47)


SET I Y a l, y 0, FROM-SIDE a RIGHT !.
OBJECT 14j (LEFT(M 0 C 2 BOAT YES) RIGHT(M 3 C 1>)

3 GOAL 49 APPLY M-C-OPR WITH Y li FROM-SIDE LEFT. TO 14 (SUBGOAL OF 46)


596 Spring Joint Computer Conf., 1967

SET X = 0# TO-SIDE RIGHT '


OBJECT 131 (LEFT(M 0 C 1) RIGHT(M 3 C 2 BOAT YES))
.3 S3AI. 12 SELECT FROM 4 A/C NEW-OBJ OF D E R I R E D - O B J (SuBGOAL OF 11)
14 SELECTED
3 SOALI 51 TRANSFORM 12 INTO DESIRED-OBJ (SUBGOAL OF 11)

. GOAL 5? REDUCE C-L ON J2 (SUBGOAL OF 51)

3 GOAL 12 SELECT FROM 4 A/C NEW-OBJ OF DEsIRED-OQj (SUBGOAL OF I D


14 SELECTED
3 30ALI 54 TRANSFORM 14 INTO DESIRED-OBJ (SUBGOAl; OF 11)

"4 GQALi 55 REDUCE C-L ON 14 (SUBGOAL OF 54)

5 GOAL 56 APPLY M-C-OPR WITH Y 2 FROM-SIDE LEFT TO 14 (8UBG0AL OF 55)


SETt X * 0* TO-SIDE RIGHT "~ ~""'
_ OBJECT 15i (LtFTn 0 C 8> RIGHT(M 3 C 3 BOAT YES))
4 QOAL 57 TRANSFORM 15 INTO DESIRED-ORJ (SUBGOAL OF" 54)
"SUCCESS
Figure 8The performance of GPS on the missionaries
and cannibals task

implication of several modes of representation. In they serve as concrete examples of the level of gen-
generalizing GPS the trend appears to be toward erality achieved by GPS.
richer representations whose structure is simple
enough for GPS to "understand." For instance, GPS Missionaries and cannibals
in some sense understands the M-C-OPR in Figure GPS and one of its predecessors, GPS-2-2, 3 both
7 because it can specify the pertinent variables so that solved the missionaries and cannibals task. The repre-
the operator performs a desired function. On the other sentation of the task in GPS was quite different from
hand complex structures, such as IPL programs, were that used by GPS-2-2. The latter contains informa-
avoided in designing the internal representation of tion about the nature of operators which the current
GPS. GPS discovers for itself. GPS-2-2 was given ten
The generalization of GPS has focussed on a par- operators: Move one missionary from left to right;
ticular group of tasks. If other tasks had been chosen, move two missionaries from left to right: move one
the generalization might have followed a quite dif- missionary and one cannibal from left to right, etc.
ferent course. The tasks dealt with in this research The desirability of these operators for reducing the
were not chosen arbitrarily. Some categories of tasks, various types of differences was given to GPS-2-2,
e.g., many optimization tasks, were deliberately exogenously (in the TABLE-OF-CONNECTIONS).
avoided because we know of no obvious heuristic GPS is only given a single operator which moves X
search formulation for them. Other categories of missionaries and Y cannibals across the river. In
tasks were avoided because of deficiencies in GPS's applying this operator GPS specifies the variables
problem solving methods. For example, games were (X, Y, and the direction of the boat) so that the opera-
avoided because GPS does not have a method for tor performs a desirable function.
considering the opponent's moves and interests in ad- GPS-2-2 was given a desirability filter for opera-
dition to its own. tors. This filter prevented GPS-2-2 from attempting
Of the tasks dealt with in this research, GPS can to move more missionaries and cannibals across the
solve some, typified by the tasks described below. river than there were on the side from which they were
However, others cannot be solved by GPS due mainly being moved. Such a separate filter is unnecessary
to inadequacies in its representation. (See Chapter in GPS because GPS never considers applying such
V ; for a discussion of these inadequacies.) an operator. Each operator in the GPS-2-2 formula-
We conclude this paper by briefly discussing the tion consisted of an IPL routine with its parameters
eleven tasks that were actually given to GPS. One (described on page 301), The operator filter was
of the instructive aspects of this research is the light also encoded in IPL. Not only is it tedious to construct
shed upon the structure of these tasks. In addition. IPL routines but the construction of these routines
A General Problem Solver 597

requires some knowledge of the internal structure Perhaps the most instructive part of this example
of GPS-2-2. The construction of the single operators is the light it cast upon the evolution of problem solv-
given to GPS is much less tedious and requires no ing programs. In LT,-' a theorem proving program
knowledge of the internal structure of GPS. for the propositiona! calculus, which is the predeces-
sor of GPS, it was noted that the match routine was
Integration the source of most of the power of the program over
GPS symbolically integrated /te t2 dt and /(sin 2 a brute force search. GPS may be considered as an
(ct)cos(ct) + r 7 ) dt. attempt to generalize the match routine, based on
In the integration, multiplication and addition are that experience. The first predicate calculus theorem
represented as n-ary functions whose arguments are prover did in fact use brute force search.21 From an
represented as an unordered set. Thus, the commuta- efficiency point of view the main effect of the resolu-
tivity and associativity of multiplication and addition tion principle of Robinson was to reintroduce the
are expressed implicitly instead of representing them possibility of matching (gaining, thereby, a vast in-
explicitly as operators. If they were explicitly given crease in power). And it is this feature that allows
to GPS as operators, there would be an overall in- GPS to use the resolution principle in a natural way.
crease in the problem space which would prevent
GPS from solving some trivial integrals. Father and sons task
SAINT, 17 a program that is quite proficient at GPS solved the task in which a father and his two
symbolic integration, also represents the commuta- sons want to cross a river. The only means of con-
tivity and associativity of multiplication and addition veyance is a small boat whose capacity is 200 pounds.
implicitly. Other similarities and some dissimilarities Each son weighs 100 pounds while the father weighs
between SAINT and GPS are discussed in Chapter 200 pounds. Assuming that the father and either son
V.' can operate the boat, how can they all reach the other
side of the river? Of course, there is no way to cross
Tower of Hanoi
the river except by boat.
In the Tower of Hanoi, which is a classical puzzle,
This task is very similar to the missionaries and
there are three pegs and a number of disks, each of
cannibals task. Both tasks involved moving two dif-
whose diameter is different from all of the others.
ferent kinds of people across a river in a small boat.
Initially, all of the disks are stacked on the first peg
But their formulations for GPS are quite different,
in order of descending size. The problem is to dis-
in that none of the operators, objects, or differences
cover a sequence of moves that will transfer all of the
are the same. Many of the earlier publications on
disks to the third peg. Each move consists of remov-
GPS (e.g., 6and7) make the distinction between a task
ing the top disk on any peg and placing it on top of
and a task environment the common part of a group
the disks on another peg, but never placing a disk on
of similar tasks. The father and sons task and the mis-
top of one smaller than itself. GPS solved the 4-disk
sionaries and cannibals task muddies this distinction.
Tower of Hanoi task.
On the one hand, they should both have the same
The Tower of Hanoi is an example of a task for
task environment because of their similarity. In fact
which means-ends analysis is very effective. GPS
they have different task environments because none
never makes a mistake on this task, mainly because
of their objects, operators and differences are the
the differences and the DIFF-ORDERING are in
same.
some sense optimal. For many tasks, it is difficult to
find good differences and a good DIFF-ORDERING. Monkey task
For a different treatment of this task see reference 18. This task, which GPS solved, was invented by
McCarthy 22 as a typical problem for the Advice Taker
Proving theorem in the predicate calculus
program.23 In a room is a monkey, a box, and some
GPS proved the following simple theorem in the
bananas hanging from the ceiling. The monkey wants
first order predicate calculus:
to eat the bananas, but he cannot reach them unless
(3u) (3y) (V.z) ((P(u,y) D (P(y,z) & P(z,z))) &
he is standing on the box when it is sitting under the
((P(u,y) & Q(u,y)) D (Q(u,z) & Q(z,z)))) bananas. How can the monkey get the bananas?
3 is the existential quantifier; V is the universal The answer is that the monkey must move the box
quantifier; P and Q are predicates; u, y and z are under the bananas and climb on the box before he can
variables; D, &, and V are implication, conjunction reach the bananas. The problem originates in the study
and disjunction, respectively. The formulation of of the problem solving ability of primates; its interest
this problem is basically the same as that used by lies not in its difficulty, but in its being an example
Robinson.19 of a problem subject to common sense reasoning.
598 spring Joint Computer Conf., 1967

It is interesting to compare GPS's formulation of


this task to the formulation for a typical Advice Taker
program.24 In GPS the objects are models of room
configurations where as in 24 the objects are linguistic
expressions that describe certain aspects of the room
configurations. Both representations have advantages.
For example, linguistic expressions are useful for
representing imperfect information such as the
monkey is in one of two places. However, models
can represent implicit information that has to be rep-
resented explicitly when linguistic expressions are
used, e.g., the monkey can only be in one place at a Figure 9 A schematic of the seven bridges of Konigsberg
The shaded area is the river and A and B are two
time.
islands in the river

Three coins puzzle ble, and his proof stands as one of the early efforts
In this task there are three coins sitting on a table. in topology.
Both the first and third coins show tails, while the This is the only impossible task that was given to
second coin shows heads. The problem is to make all GPS. Although GPS's behavior is not aimless (it
three coins the same either heads or tails in pre- crosses six bridges in two different ways), GPS
cisely three moves. Each move consists of "turning cannot see the impossibility because it lies in the
over" any two of the three coins. For example, if topological properties of the bridges. GPS only at-
the first move consisted of turning over the first and tempts to cross bridges and has no way of viewing
third coins, all of the coins would be heads in the re- the problem as a whole.
sulting situation. But the task is not solved because
only one move was taken instead of the required Water jug
three. Given a five gallon jug and an eight gallon jug, how
The peculiarity of the three coins task is in the can precisely two gallons be put into the five gallon
solution being constrained to a fixed number of opera- jug? Since there is a sink nearby, a jug can be filled
tor applications. This constraint was handled in GPS from the tap and can be emptied by pouring its con-
by expanding the representation of objects to include tents down the drain. Water can be poured from one
a counter that indicates the number of operator ap- jug into another, but no measuring devices are avail-
plications involved in producing the objects. In the able other than the jugs themselves.
desired situation the counter must have a particular For the water jug task, means-ends analysis seems
value. to be a rather ineffective heuristic as demonstrated
by the fact that GPS stumbled onto the solution.
Better types of differences would improve GPS's
Parsing sentences
performance on this task. Better differences do exist
GPS parsed the sentence,
although they are quite complex (involving modular
Free variables cause confusion. ,
arithmetic, naturally).
according to a simple context-free grammar. (It con-
tains ten productions or rewrite rules.) A great deal Letter series completion
of effort has been devoted to the construction of ef- This task, which is found in aptitude tests, is to add
ficient parsing algorithms for simple phase structure the next few letters to a series of letters. GPS correct-
grammars. The point of this example is not GPS's ly completed the series,
proficiency as a parser, but to illustrate the kinship
between heuristic search and syntatic analysis. BC BD B E--.
The letter series completion task is the only task
Bridges of Konigsberg whose solution requires inductive reasoning. The
In the German town of Konigsberg ran the river formulation is quite clumsy, but this example demon-
Pregel. In the river were two islands connected with strates how the problem can be approached by search-
the mainland and with each other by seven bridges ing for a suitable description in a space of descrip-
as shown in Figure 9. How can a person walk from tions. The binary choice task, another task requiring
some point in the town and return to the same point inductive reasoning, was formulated in a similar way
after crossing each of the seven bridges once and only by Feldman, et A/. 25 (Simon and Kotovsky 26 use a dif-
once? In 1736 Euler proved that this task is impossi- ferent formulation of letter series tasks.)
A General Problem Solver 599

Generality of GPS's basic processes 10 H A SIMON A NEWELL


i he appeal of the heuristic search paradigm lies Current trends in psychological theory
The simulation of human thought
in its generality. Hence, it is important that GPS's University of Pittsburgh Press Pittsburgh P a p 152-179 1961
problem solving techniques have general applicability
11 H A SIMON A NEWELL
to heuristic search problems. Management and the computer of the future
GPS uses all of its basic processes (described Computer simulation of human thinking and problem solving
above) except for operator-difference, on each of the Greenberger M ed
eleven tasks. In solving the predicate calculus, three John Wiley and Sons New York 1962
coins and letter series tasks, GPS never attempts to 12 H A SIMON A NEWELL J SHAW
apply an infeasible operator, and thus 11K /xraior- Contemporary approaches to creative thinking
difference process is never evoked. If each of the The processes of creative thinking
Gruber H A Terell G and Wertheimer M eds
basic processes were specialized to a particular
Atherton Press New York p 63-119 1962
aspect of one task, it would be necessary to add new
13 DGBOBROW
basic processes in order to give GPS a new task.
Natural language input for a computer problem solving
However, the applicability of the basic process to system
all eleven tasks implies that they would also be ap- Doctoral Dissertation Mathematics Dept Massachusetts
plicable to other tasks. Institute of Technology Cambridge Mass 1964
14 B RALPHAEL
SIR: A computer program for semantic information retrieval
Doctoral Dissertation Mathematics Dept Massachusetts
REFERENCES
Institute of Technology Cambridge Mass 1964

1 G W ERNST A NEWELL 15 A NEWELL G ERNST


Generality and GPS Proc of IF IP congress 65
Carnegie Institute of Technology 1966 The search for generality
2 A NEWELL Kalenich W A ed
Self-Organizing Systems Spartan Books Washington D C p 17-24 1965
Some problems of basic organization in problem-solving 16 A NEWELL ed
programs Information processing language-v manual
Yovits M C Jacobi G T and Goldstein G D eds Prentice Hall Englewood Cliffs N J 2nd ed 1961
Spartan Books Washington D C 1962 p 393-425
17 J R SLAGLE
3 ANEWELL
J ACM 10
A guide to the general problem-solver program GPS-2-2
A heuristic program that solves symbolic integration problems
RAND Corporation Santa Monica Calif RM-3337-PR 1963
in freshman calculus
4 A NEWELL
p 335-337 Oct 1963
Proceedings of IF IP congress 62
Learning, generality and problem-solving 18 HORMANN AIKO
North Holland Publishing Amsterdam Holland 1962 Behav sci 10
5 A NEWELL J C SHAW H SIMON Gaku: an artificial student
Preliminary description of general problem-solving program p 88-107 Jan 1965
-IGPS-1 19 J A ROBINSON
CIP Working Paper No 7 Graduate School of Industrial J ACM 12
Administration Carnegie Institute of Technology Pittsburgh A machine-oriented logic based on the resolution principle
Pa Dec 1957 p 23-41 Jan 1965
6 A NEWELL H C SHAW H A SIMON
Information processing: proceedings of the international 20 A NEWELL J C SHAW H SIMON
conference on information processing Empirical explorations with the logic theory machine
Report on a general problem-solving program for a computer Proceedings of the Western Joint Computer Conference
UNESCO Paris 1960 p. 256-264 p 218-239 1957
7 A NEWELL H A SIMON J C SHAW 21 PCGILMORE
Self-organizing systems IBM j res develop
A variety of intelligent learning in a general problem-solver A proof method for quantification theory
Yovits M C and Cameron S eds p 28-35 Jan 1960
Pergamon Press New York 1960 p 153-189
22 J MCCARTHY
8 A NEWELL H A SIMON
Situations actions and causal laws
Science
Stanford Artificial Intelligence Project Memo No 2
Computer simulation of human thought 134
July 1963
P 2011-2017 December 1961
9 A NEWELL H SIMON 23 J MCCARTHY
Lernende automaten Proc symposium on mech of thought processes
GPS a program that simulates human thought Programs of common sense
Munich Germany 1961 Her Majesty's Stationery Office London p 75-84 1959
600 Spring Joint Computer Conf., 1967

24 FISHER BLACK choice behavior


A deductive question answering system Hogott A C and Balderston F E eds
Doctoral Dissertation Division of Engineering and Applied South-Western Publishing Co Cincinnati Ohio p 55-100 1963
Physics
Harvard University Cambridge Mass 1964 26 H A SIMON K KOTOVSKY
25 J FELDMAN F T O N G E H KANTER Psychological review 70
Symposium on simulation models Human acquisition of concepts for sequential patterns
Empirical explorations of a hypothesis-testing model of binary p 534-546 June 1963