You are on page 1of 10

Computers and Electrical Engineering 30 (2004) 563572

www.elsevier.com/locate/compeleceng

A novel solution for maze traversal problems using articial neural networks
S. Srinivasan *, D.P. Mital, S. Haque
Department of Health Informatics, UMDNJSchool of Health Related Professions, 65 Bergen St., Newark, NJ 07107-3001, United States Received 24 February 2004; accepted 20 July 2004

Abstract In this paper we have addressed the problem of nding a path through a maze of a given size. The traditional ways of nding a path through a maze employ recursive algorithms in which unwanted or nonpaths are eliminated in a recursive manner. Neural networks with their parallel and distributed nature of processing seem to provide a natural solution to this problem. We present a biologically inspired solution using a two level hierarchical neural network for the mapping of the maze as also the generation of the path if it exists. For a maze of size S the amount of time it takes would be a function of S (O(S)) and a shortest path (if more than one path exists) could be found in around S cycles where each cycle involves all the neurons doing their processing in a parallel manner. The solution presented in this paper nds all valid paths and a simple technique for nding the shortest path amongst them is also given. The results are very encouraging and more applications of the network setup used in this report are currently being investigated. These include synthetic modeling of biological neural mechanisms, traversal of decision trees, modeling of associative neural networks (as in relating visual and auditory stimuli of a given phenomenon) and surgical micro-robot trajectory planning and execution. 2005 Elsevier Ltd. All rights reserved.
Keywords: Articial neural networks; Maze generation; Path nding; Neural model

Corresponding author. Tel.: +1 973 972 6871; fax: +1 973 972 8540. E-mail address: srinivsh@umdnj.edu (S. Srinivasan).

0045-7906/$ - see front matter 2005 Elsevier Ltd. All rights reserved. doi:10.1016/j.compeleceng.2004.07.002

564

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572

1. Introduction The maze problem in its variations is an important one in many search problems as in say, trafc control, VLSI lead routing, robot locomotion, etc. The traditional ways of nding a path through a maze employ recursive algorithms in which unwanted or non-paths are eliminated in a recursive manner. It takes an inordinate amount of time to solve in such a manner for mazes of sizes greater than, say, 10 10. Neural networks with their parallel and distributed way of computing promise a way to solve such a problem [1]. There have been some approaches using articial neural networks (e.g. using Hopelds type) to solve the Travelling Salesman Problem and also decision tree search problems but they do not assure any success consistently [24]. Some of them depend on nding a global minimum in the energy function of the network or some other constraint in both neural network and other approaches and in doing so it assumes that the path found will satisfy that criterion [5]. In this paper we report the use of a biologically inspired technique for nding the path in a maze without getting into dening an energy function and other complicated ways of structuring the network. It arises from the observations made with rodents and sub-terranean mammals in nding and remembering the paths in an experimental setup [6,7] or in their physical environments [8] wherein it has been surmised that these animals may be mapping the maze (path to a food source for example strewn with obstacles) in their brains [9]. The representation of the maze [10] and its invocation could be in a non-visual form such as olfactory or auditory stimuli (even geomagnetism [11,12]) rather than visual stimuli alone or it could be a combination of all of them. In general it was found that cues from visual and non-visual sources were used by the animals to nd their way to the food. It appeared that both place and response types of learning existed and whichever was stronger depended on the stimulus conditions that prevailed in the maze. Thus, animals could meaningfully be said to learn either (a) the place where food was or (b) the response necessary at a particular choice point. Simple mazes could be learned by kinesthetic stimuli alone, but not complex mazes. In complex mazes, kinesthetic stimuli joined other available cues in the learning. It was also found that mazes could also be learned by intramaze cues, but such cues typically were combined with extra-maze cues. In elevated mazes, extramaze cues proved to be more important than intra-maze cues. If the maze was enclosed in a homogeneous room, or if the maze had walls/top, intra-maze cues predominated. Either type of cue may be the more important, depending on the relevant amount of relevant stimulation stemming from each source. In this paper we utilize these biological observations in the design of a neural map with extraneous inputs combined to form the entrance and the exit in a maze lled with obstacles. More importantly we present a synthetic model of what could possibly be occurring in the path generation in such biological neural maps.

2. Methodology Essentially, the objective is to nd a map a maze lled with obstacles (static or dynamic) onto a neural network and allow the algorithms governing the function of the neural network to result in the generation of a path through the maze. Note that for a maze with an opening and a way out, the best and a quick way of determining a path would be to start from both the sides simultaneously, that is, in a parallel manner and to move or converge until a path is obtained. The

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572

565

reported network methodology is applicable to both dynamic and static obstacles and the speed of updating the paths are limited only to the rate at which the updated maze maps are presented to the network. Fig. 1 illustrates an example of a maze with one completely connected (between the entrance and exit) and some disconnected paths. Hereafter it is assumed that the entrance is the upper left corner square and the exit node is the bottom right corner square, though it is immaterial to the way of solution using our networks. In the case of a visually guided autonomous robot (small enough to be capable of traversing perhaps the internal organ of a body) this gure could represent the start and the end points of the robot given a cross-sectional image (for two dimensional scenarios) of the internal organ or it could be the aerial view provided to a autonomously guided vehicle to help maneuver its way around both dynamic and static obstacles [9]. Basically the path-nding problem resolves into two cases. One is to form the associations that might determine possible paths. The second is to eliminate those which are not part of the path(s) which connect the entrance and exit squares or nodes. The given maze is mapped in the form of a neural network wherein each neuron represents each of the squares or nodes in the maze. One such neural map for a 3 3 size maze is shown in Fig. 2. Each of the neurons has connections to be made to each of its neighbors. At a maximum, a neuron could have four neighbors (for a two-dimensional maze) and hence four connections are possible while the neurons at the corners or the edges of the maze can have only two connections.

Fig. 1. A Maze with potential paths (0) and obstacles (X).

4
e e e

6
e

Fig. 2. A neural network representation of a 3 3 maze wherein the arrows represent the connections with a certain amount of connection strength each and e are the external inputs.

566

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572

External inputs can also be provided to the network which in our case was used to indicate the maze openings as also for determining whether a particular neuron should be clamped at a certain value (as will be described later). The maze openings had external positive input values each, while the obstacles had negative values each and the rest had 0. The weights or connection strengths were constrained to have values of +1 or 1 respectively. There was an upper limit (saturation) to the activation values that a neuron could attain, and also a threshold. For the neural network to generate a path through the maze mapped onto it the activation rule and the association rule for forming the networks connections and the individual units activations were setup as given below: Activation rule at 1 at ext:inputs tstr netinput; netinput estr X
exc

W ij aj aj is excitatory istr

X
inh

W ij aj aj is inhibitory;

Association rule  1; if ai P 0 ^ aj P 0; W ij 1; if ai 6 0 _ aj 6 0: where unit ai is a neighbor of unit aj. Since there were limits (saturation values) set for an individual units activation value scaling parameters for the combined excitatory input and inhibitory input had to be provided and accordingly we have the scaling coecients associated with the excitatory (estr), the inhibitory (istr) as given in the equations above. For the same reason a net input coecient (tstr) was also incorporated to eect gradual changes in the state of activation of the network. Since no learning was involved, a simple Hebbian rule for modifying the connection strengths was incorporated which worked as follows: Hebbian rule DW ij ai aj : If two units (ai and aj) have similar type of activations (i.e. both positive or both negative) then their connection strength (DWij) was to be +1 otherwise it had to be 1. The principle of the working of the neural map network is as follows. Since the opening and end of the maze have positive external inputs, they tend to form positive connections with their neighbors, through the Hebbian rule, simultaneously. Since associations have to be formed between units which are active even though they may be surrounded by very many obstacles (a typical occurrence in a maze) therefore, the excitatory input coecient has to be of a much higher value than the inhibitory input coecient (a typical ratio for estr to istr was of the range of 1001). Also the presence of a threshold value for setting the activation made it imperative that the excitatory connections have a faster eect on the updating of the activations of the appropriate units than the inhibitory connections which arise from the surrounding obstacles. Upon decreasing the value of estr or increasing the value of istr, one can observe that no valid paths are formed since the inputs from the obstacles overwhelm whatever excitatory inputs that may exist. Increasing or decreasing the value of tstr would result in abrupt changes or very little change at all.

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572

567

3. Results and discussion Once the external inputs are provided, that is, once the initial constraints of the maze were set up, the network is run which essentially is the execution of the computations involved in the network equations given above. To emulate the parallel nature of their processing, a temporary buffer was incorporated to hold the computed values of each of the neurons and then to eectively update them in a synchronous manner subsequently. This leads subsequently to a convergence of positive connections or in other words a path(s) is (are) formed from both ends as is shown in Fig. 3 for the case of a 10 10 maze. Once the associations are formed for potential paths, it was required to determine the wanted paths from the unwanted ones. In the case above it can be observed that the implementation of the given algorithms results in unwanted paths in other places wherein a continuous structure of positive connections are formed. This requires further processing to remove the unwanted paths and only retain the valid ones, that is, those which connect the begin and end nodes. For this, another network, a supervisory network, or a higher level net, as we called it, is employed. It operates on the activations obtained in the lower level net (thus far described) its basic purpose being to gradually (over a few cycles) remove the unwanted associations (as described above) and hence eliminate those paths which did not connect the begin and end nodes. This can be done by observing which of the nodes or units have less than two positive connections, that is, those which do not form continuous paths and hence have to be removed. The terminal nodes or units of unwanted paths are the ones which correspond to the above observation and hence are removed which nally results in eliminating that path. For this purpose the functioning of each neuron in the higher-level net is very simple. Each neuron has to note the activations or the sense of the connections of its neighbors and if they are less than two positive activations or connections

Fig. 3. Illustration of the initial maze distribution with potential paths (0) and obstacles (X) and the paths generated by the neural map indicated by an arrow symbol.

568

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572

(which would otherwise be in a path) its activation was to be clamped at a negative value. This helps remove the unwanted paths in just a few network cycles. Fig. 4 illustrates the initial maze and its paths delineated by the two level neural network operating based on the implementation just described. Notice that the higher-level networks output has duly eliminated the second obstructed and unwanted path seen in the output of lower-level network. To observe the eect on the working of the neural network the dierent parameters relevant in its proper operation such as estr, istr and tstr as also the number of lower nets cycles were modied and the results are as shown in Fig. 5. The problem of nding the shortest path is a dicult one because of the intelligence that is required to compare two possible paths and then determine which is shorter of the two. Of course in the biological setting such knowledge may not be available to the animal and the most expe-

Fig. 4. Illustration of the initial maze distribution with potential paths (0) and obstacles (X) and the outputs for the lower- and higher-level neural networks.

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572

569

Fig. 5. Outputs for special test cases where (a) the lower net cycles were made very large and (b) the lower net cycles were made very low (1/50th the set size mentioned below) and (c) either decreasing the value of estr or increasing the value of istr relative to each other. Changes in tstr either resulted in outputs such as (b) i.e. no changes at all or in (c) i.e. no path.

dient path in its traversal through the subterranean maze is the one that is executed. However for the purposes of say robot path control such a problem is a valid one and in our case, for any given maze having more than one path connecting the entrance and exit nodes the shortest path, if it exists, will be found due to the converging nature of the processing in the shortest time. In the processing of the lower-level net, supervisory feedback is required to determine when the rst path is formed and then set the higher-level net into operation thus eliminating all other paths. An alternative and viable solution however was implemented as follows. For an N N size maze, a path could be at the most of a length of N2/2 (assuming the case of static obstacles). By using the reported network architecture this would imply that a path could surely be found in less than N2/2 cycles (for static obstacle scenarios only). Thus the low level net was set to operate for N2/2 cycles the resultant activations of which is input to the higher-level net. The higher-level net has a supervisory function which computes the absolute sum of the activations and after each cycle computes the dierence between the previous and the present summed values. Once the dierence so determined is found to be zero, that is, once the net has reached a stable state the network stops

570

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572


12000
Network Cycles

10000 8000 6000 4000 2000 0 0 5000 10000 15000 20000 Size (no. of maze elements) 25000

Fig. 6. A graph of the size (in terms of the number of maze elements) versus the number of network cycles (of both networks).

functioning and the resultant state of activation is displayed. This also means that for a maze of size S the amount of time it takes would be a function of S (O(S)) and a shortest path (if more than one path exists) could be found in around S/2 cycles where each cycle involves all the neurons doing their processing in a parallel manner. This is illustrated (as shown in Fig. 6) in noting the number of cycles taken for the implementation of our network algorithms for mazes of dierent sizes (ranging from 10 10 to 150 150 cells). In its working this network is similar to the interactive activation network proposed by Rumelhart and McClelland [13,14] and since it uses the basic Hebbian rule updating its connection strengths it is more nearer to the mimicking of a biological neuron than for example a back-propagation neural network. Similar noteworthy biologically plausible approaches towards this problem and applicable to robot locomotion do exist though it would be interesting to determine the extent of their dynamic obstacle avoidance capabilities [1517]. The neural network used as a map of the maze also serves as an appropriate approach to the synthetic modeling of a biological neural system and could very well serve as a tting testing bench, for the implementation of the underlying theories be they in the computational or in the biological domain. Such synthetic models are very eective for studying biological systems as well since in studying the performance of a synthetic model, one can generate a set of plausible algorithms for a biological system. Conversely, in observing the biological phenomena, one can explore possible solutions for the synthetic models structure and function.

4. Conclusions In this paper we have addressed the problem of nding a path through a maze of a given size. Neural Networks with their parallel and distributed nature of processing seem to provide a natural solution to this problem. The solution using a two level hierarchical neural network has been presented. The lower-level network nds all potential paths and the higher-level network working on the lower-level network nds the valid ones. The number of lower net cycles is a constant for a given maze, while the number of high-level net cycles depends on how soon the network reaches a stable state, which is a linear function of the maze size. The solution presented here nds all valid paths. However, nding the shortest path using the same technique is currently being investigated. Also from the synthetic neural modeling perspective more experiments are necessary to study the dierential learning imposed by the various types (visual and non-visual) of cues.

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572

571

More applications of the network setup used in this report are currently being investigated. These include searching of decision trees, modeling of associative neural networks (as in relating visual and auditory stimuli of a given phenomenon) and surgical micro-robot trajectory planning and execution.

References
[1] Grossberg S. Nonlinear neural networks: principles, mechanisms, and architecture. Neural Networks 1988:1761. [2] Saylor J. Neural networks for decision tree searches. In: Proceedings of IEEE/EMBS-9 conference, vol. 2, 1987. p. 3734. [3] Simon XY, Meng M. An ecient neural network approach to dynamic robot motion planning. Neural Networks 2000;13:1438. [4] Glasius R, Komoda S, Gielen SCAM. Neural network dynamics for path planning and obstacle avoidance. Neural Networks 1995;8:12533. [5] Nayfeh AB. Cellular automata for solving mazes. Dr Dobbs J 1993;197(February). [6] Duchon AP. Maze navigation using optical ow. In: Proceedings of the 4th international conference on simulation of adaptive behavior. Cambridge, MA: MIT Press/Bradford Book; 1996. [7] Whishaw IQ, Haun F, Kolb B. Analysis of behavior in laboratory rodents. In: Windhorst U, Johansson H, editors. Modern techniques in neuroscience. Berlin: Springer-Verlag; 1999. p. 124375. [8] Nicolle MM, et al. Emergence of a cue strategy preference on the water maze task in aged C57B6 SJL F1 hybrid mice. Learn Memory 2003;10:5204. [9] OKeefe J, Nadel L. The hippocampus as a cognitive map. London: Oxford University Press; 1978. [10] Blum K, Abbott L. A model of spatial map formation in the hippocampus of the rat. Neural Comput 1996;8(1):8593. [11] Heth G, et al. Odours underground: subterranean rodents may not forage blindly. Behav Ecol Sociobio 2002;52(1):538. [12] Kimchi T, et al. A subterranean mammal uses the magnetic compass for path integration. Proc Natl Acad Sci USA 2004;101(4):11059. [13] McClelland JL, Rumelhart DE. An interactive activation model of context eects in letter perception: Part 1. An account of basic ndings. Psychol Rev 1981;88(5):375405. [14] Levine DS. Introduction to neural and cognitive modeling. second ed. Lawrence Erlbaum Associates; 2000. [15] Kitamura Y, Suzuhigashi S, Tatsumi S. Observation and path nding method for solving dynamic maze. IPSJ SIG Notes Intelligence and Complex Systems, No. 128-033, 2002. [16] Bieszczad A, Pagurek B. Neurosolver: neuromorphic general problem solver. Inform Sci: An Int J 1998;105:23977. [17] Swain R, Devy M. Visually-guided navigation of a mobile robot in a structured environment. In: Proceedings of symposium international of robotics systems (SIRS). Stockholm, Sweden, July 1997. Shankar Srinivasan is currently an Assistant Professor in UMDNJs Health Informatics Department and has taught in universities in Singapore and Australia. His research interests are mainly in the areas of health care data analysis, neuro-fuzzy systems and enterprise wide health care web services.

572

S. Srinivasan et al. / Computers and Electrical Engineering 30 (2004) 563572 Dinesh Mital is currently an Associate Professor in UMDNJs Health Informatics Department. His areas of research include biomedical signal and image processing, decision support systems, neural and fuzzy logic based applications, and articial intelligence. He has published over 200 technical papers in various international conferences and journals.

Syed Haque is Professor and Chair of the Department of Health Informatics at UMDNJ. His interest areas include health care outcomes measurement and research and health care data mining. He has published extensively in journals and in several conferences, and has also served as Chair in several international conferences.

You might also like