Simulation in PASCAL
Total Page:16
File Type:pdf, Size:1020Kb
Behavior Research Methods & Instrumentation 1983, Vol. 15(2),305-307 Simulation in PASCAL EARL HUNT University ofWashington, Seattle, Washington 98/05 Some of the author's experiences in working with simulation languages are discussed. The use of PASCAL language is detailed. The history of computer simulation of cognitive tion languages are big-city tools, the intellectual equiva processes has been intertwined with the history of lent of Dior gowns worn in the Parises and Londons of development of ever more powerful special-purpose cognitive science. Some of us are cognitive hicks. All we languages for constructing simulation programs. The have are blue jeans. (The existence of designer jeans has progression of languages from IPL-IV (for the true nothing to do with this argument.) historian) to today's dialects of LISP attests to the To move away from the analogy, users of special usefulness of this effort. Even so, these languages still purpose simulation languages generally have two things: force the psychologist to do a fair bit of "reinventing access to a very large machine and membership in a the wheel" (e.g., rewriting programs for parsing or for substantial community of artificial intelligence/cognitive production execution). To solve these problems, some science research workers who use, support, and under more specialized translator systems have developed. stand the languages. The little old lady from Dubuque These are exemplified by PRISM (Langley, 1983) cannot play simulation because she does not have a and CAPS (Thibadeau, 1983). These systems make it good glove and because she does not have enough friends easier for psychologists to write simulations of the type to make up a team. It has been suggested that equip envisaged by the system designers. The translators ment is no longer a problem; a substantial computer themselves contain assumptions that have psychological can be purchased for only $250,000. Only? True to content. If one can live with the restrictions, which history, though, computer scientists have promised us may have substantial psychological content, program that things will get better in the future. They probably ming is much more efficient. will. I am confident that the equipment problem will be Special-purpose simulation languages are impressive solved, although perhaps sooner at the more highly and are highly desirable. Nevertheless, they have two endowed universities. The Dubuquean still needs team disadvantages. One that has been widely publicized is mates. In the foreseeable future. a number of bright that the systems are not well suited for arithmetical hardworking people will want to do simulation but will computations. This is something of a chimera. Simula not be located near very many other people who have tion languages can (and have) been written to encompass similar interests. My comments are addressed to the conventional computing, although at the price of requir good people of Dubuque. ing a larger machine. However, the cost of computing For the past several years, I and a small (i.e., two and memory is dropping rapidly, so computational persons) group of colleagues have found ourselves in this power is not an issue. I do point out, though, that one situation. While the University of Washington has an wants to write a simulation of a model that is essentially excellent psychology department, the idea of simula an exercise in mathematical psychology. as opposed to tion is somewhat exotic to my colleagues in physio "information processing" in the sense used by Newell, logical, social, and, indeed, traditional human experi Simon, and most other cognitive scientists, and then the mental psychology. The Computer Science Department simulation languages may not provide reasonable ways is very highly rated in its field, but it is not nor does it to state your problem. Obviously, one would use BASIC desire to be a center of artificial intelligence research. if BASIC would do the job. The interesting question is (Psychologists may find this hard to believe, but it is "What do you do when your problem falls somewhere in quite possible.) Also, my theoretical bent has always between cognitive psychology and mathematical psy been to try to unite mathematical reasoning with simula chology?" It is at this point that a second, less publicized tion, and thus my own theorizing has inevitably been problem appears. I believe that it is crucial. The simula- grounded in mathematical psychology as well as cogni tive science. The research reported here was supported by a contract We have worked quite well in this environment, by between the Office of Naval Research and the University of programming in general-purpose computer languages. Washington. The opinions expressed are the author's and do nut reflect policy of the Office of Naval Research. I am happy to Today we are working in PASCAL. In the past, we have acknowledge the helpful comments made by John Cotton, who produced simulation and artificial intelligence programs read an earlier draft of this manuscript. written at various times in FORTRAN and ALGOL 305 Copyright 1983 Psychonomic Society, Inc. 306 HUNT (Hunt. 1975; Hunt. Marin, & Stone, 1966; Quinlan & want to be the intellectural colleague of centers in Hunt, 1968). Our present efforts will be used to illus cognitive science; I am not sure that I want to be their trate the problems and potentials of the approach. customer. We are trying to construct a program that will simu How well is the approach working? The mathematical late a variety of tasks in what is known as the "attention psychology aspects of our work require a great deal of and performance" literature. Examples range from computation. I am doubtful that some of the searches choice reaction time experiments to studies of quite for good parameters, or estimations of population complex tasks, in which a person has to split his/her statistics, would be feasible on all but the most sophisti attention over several different subtasks such as tracking, cated LISP systems. Of course, how big a problem this response selection, and memorization. The tasks com is depends upon the true cost of computing. Our work bine low-level, but not negligible, reasoning requirements fits very nicely into normal operations on a VAX sys with a strong requirement to respond in real-time. tem. Depending on the number of other users, simula Simple tasks in this field yield to mathematical model tion of a typical experiment will appear to take piace ing, but complex tasks do not. In order to deal with instantaneously or may require 5-10 min of waiting all of these different tasks within a single simulation, we for a response. The verdict is still out concerning the decided to construct an interpreter that would be PASCAL microengine. The manufacturer's inadequate capable of executing productions and that would con support has presented us with a number of problems. tain within itself a number of mathematical models of Note that here we reverse our usual roles. The centers various "automated" information processing steps. that use artificial intelligence languages usually rely on These models would provide the building blocks for large, very well documented systems produced by major production selection and execution. As a very crude manufacturers. If one really wants to cut corners in an guide, we proposed using production systems to simu effort such as ours, one uses a machine constructed by late how a person approached a task, consciously, and Mrs. Murphy's Storm Door and Computing Company. mathematical modeling to simulate the more mech Sometimes small companies turn out to be the apple of anistic information processing that supports conscious our eye; sometimes they provide an orchard full of reasoning. lemons. The interpreter program contains about 1,100 lines Our typical use of the system is to assign a person a of PASCAL code. It has been executed both on a VAX simulation project, give him his own file, and expect and on a small (65-KB) special microcomputer, called a him to do the necessary reprogramming. Someone work "PASCAL rnicroengine," that was built specifically for ing with us can play with assumptions in a way that one executing PASCAL programs. We have already done a probably could not play with the assumptions that are considerable amount of simulation of choice reaction internal to CAPS or PRISM unless he was an experi time experiments and have prepared a paper covering enced LISP programmer. Of course, to play in our this topic. Studies of dual task phenomena and Stroop league, you have to program in PASCAL. This brings up interference phenomena are now in progress. Clearly, an extremely important point. we are in business. The details of our scientific work As scientists, we want to develop theories of cogni will be reported elsewhere. Here, I concentrate on what tion. As teachers, we want to teach psychology. Any we have learned about simulation itself. training in the techniques of computer use is strictly Our program could be thought of as a very limited subservient to those goals and, frankly, we would pre and rapid CAPS program. In this sense, we invented the fer to have such training done by other people. The wheel at about the same time that it was invented in ideal assistant arrives in the laboratory already trained Pittsburgh. The basic program was written by myself on techniques and ready to begin work immediately on and a technician (who was not a professional program a substantive problem. A person who already knows mer) over a period of about 4 months, and then it was PASCAL can work in our laboratory after about 1 week modified slightly by a computer science graduate stu of studying the coding conventions.