* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
DEDUCTIVE CONTROL OF TRAFFIC PROCESS JEŽEK KAREL, ZÍMA MARTIN Department of Computer Science and Engineering University of West Bohemia Univerzitní 8, 30614 Plzeň tel..++420/019/276250 e-mail [email protected], [email protected] Abstract: The possibilities of using the Deductive Database System for optimal transport routes selection in traffic networks is described. Passability and predicated cost of the roads and nodes characterize the individual parts of the net. Characteristic values describing the net’s components change in time and represent a big amount of data. Therefore the application of a database environment is adequate. The traffic control problem is expressed in a declarative programming language - extended Datalog, implemented at the University of West Bohemia, Pilsen. Datalog enables to reflect in the solution singular nonpredictable situations as well as another characteristics of the traffic situation. Key words: Traffic Process Control, Road Transportation Control, Deductive Databases, Datalog 1 INTRODUCTION The road cargo and passenger transportation has become a significant economical as well as ecological and social problem in recent years. We recognize this problem on the level of large cities, on the national interurban level and on the international cross-border level alike. The search for fast, economical and reliable path is an important and interesting task difficult to solve with only conventional methods and algorithms. New navigation equipment and traffic control computers are introduced in the real use. The effective road transportation control and optimization procedures include, apart from path searching method, a lot of auxiliary procedures such as traffic classification, intensity prediction, congestion and accident detection. The up to now experience demonstrates the necessity to apply an artificial intelligence approach to the control of road transportation process. Presented article describes one possible way how a progressive information technology namely deductive database systems can be used in the area of traffic and road transportation control. As the urban traffic differs substantially in some aspects from long-distance traffic we discuss the specific features of urban traffic in a separate section at the end of this article. 2 DEDUCTIVE DATABASE A deductive database system integrates the advantages of the logic programming paradigm and the database management systems. Logic programming offers a great expressive power namely for expressing knowledge, constraints and queries. The database management systems offer the ability to efficient and reliably manage large, persistent data. The integration of logic programming and database systems gives the deductive databases the ability to express and manipulate deductions concerning the contents of a database. To express the contents of a deductive database, a Prolog-like language named Datalog is used. Datalog can serve to express both the set of facts (extensional database) and the set of knowledge expressing rules (intensional database). One of our extensions to Datalog is the ability to use already existing external database files as the possible parts of extensional database. These files are used to keep most of the data describing the actual situation of the road nets and information about predicted states. As we mentioned above, Datalog program consists of facts and rules. To avoid the description of complicated syntax and semantics let us illustrate the key concepts of a Datalog program by the help of a simple example, which is close to our traffic problem - definition of a path in a road network. road (a, b). road (a, c). road (b, d). road (d, c). ... (1) path (X, Y) :- road (X,Y). path (X, Y) :- path (X, Z) , road (Z, Y). (2) (3) Line (1) defines the facts, e.g. there is a road from a to b. Lines (2) and (3) describe the rules. As the symbol „:-“ means if and all variables in Datalog begin with a capital letter, the rule (2) has the meaning „there is a path from X to Y if there exists a road from X to Y“. The rule (3) declares: „There is a path from X to Y if there exists a path from X to Z and there exists a road from Z to Y“. The logical connectives and is expressed as „ , “. Note that pure Datalog is fully declarative and therefore the line (3) does not cause the infinitive cycle as it would be in the Prolog case. 3 ROAD TRAFFIC CONTROL In this section we describe the problem of optimal path searching in road system graph. In the graph the nodes correspond to important cities and the edges to the roads between cities. Because the searched path can intersect country border, then border-crossings are counted as nodes as well. Total time costs were chosen as the optimization criterion. Time costs consist of delay time in important cities added to the time for roads passage. Delay times of other cities were included in the time costs for roads passage. Variability in time is a significant property of time costs. Before we introduce the structure of input data, we show the suggested structure of a traffic control system in a simple picture. The core of a Datalog program which searches for the optimal path using the algorithm by Dijkstra, is described below. From the Datalog program and user’s query a SQL statement is constructed which is computed by the database system and the answer is handed back to the user. Information about the time variable components parameters are continuously transferred from the predictors P1, P2, .., Pn to the database and saved in database tables. The structure of network is described by a database table too. Datalog program queries answers Deductive Database RDBMS P1 P2 … Pn Data Fig. 1. Description of the optimal path searching system For the description of the road traffic control situation we need two sets of input data. First table, named road, describes the edges of the road system graph. Each record of this table contains the identification of two cities, connected by this road and the time, which is needed for this road passage. The second table, named city, describes the delay time in individual nodes in the graph. Each record of this table contains identification of the node and two other attributes determine the delay time value and the node entry time. From this it follows, that one of predictor P1, P2, .. , Pn, corresponds to each city and road because the delay attribute is time dependent. For the sake of simplicity these two tables do not participate in the algorithm but their values are included into the table edge. Searching for the optimal path in the road system graph optimized by time costs consists of two parts. In the first part, the time-variable graph node weighting is computed by summing up the passage times of the evaluated edge with delay time in its final node. This fact is stored in the table edge. The second part is the implementation of Dijkstra’s algorithm for finding the minimal path in a graph between two selected nodes. In the first phase of algorithm, an initialization is executed, where the values for all graph’s nodes are assigned. For the start node, named Start, the permanent value 0 is assigned, other nodes have a temporary value MAX, which is the maximum representable number in the database system. The predicate node contains attributes which correspond to the identification of the starting node, identification of the final node (which is where the searched path should end), time of departure from the Start node, his weighting and the flag for permanent (1) or temporary value (0). node (Start, Goal, Start, Time, 0, 1) :- edge (Start, _, Time, _), edge (_, Goal, _, _), Start <> Goal. node (Start, Goal, Node, Time, MAX, 0) :- edge (Start, _, _, _), edge (_, Goal, _, _), edge (Node, _, Time, _), Start <> Goal, Node <> Start. The next rule looks up and evaluates those graph’s nodes which are accessible through the edge leading from a node, with the permanent flag set. Each of these nodes can be assigned more than one temporary value. At the same time this rule contains a cycle stop condition. This condition tests if the final node has been assigned a permanent value. accessible (Start, Goal, NodeY, Time + Value, ValueX + Value) :node (Start, Goal, NodeX, Time, ValueX, 1), edge (NodeX, NodeY, Time, Value), NodeY <> Start, NodeX <> Goal. For each new node with multiple weights we select the least value of the weight which belongs to the given start time and corresponds to the node’s temporary value. This way we get a set of nodes from which we select those with the least temporary value and set this value as permanent. node (Start, Goal, Node, Time, min (Value), 0) :- accessible (Start, Goal, Node, Time, Value). node (Start, Goal, Node, Time, min (Value), 1) :- node (Start, Goal, Node, Time, Value, 0). In the case the final node has already been assigned the permanent value, the optimal path can be assembled. This path is created backwards from the final node to the start node. The edge is a part of the optimal path if the difference of permanent values is equal to the time weight. path (Start, Goal, Goal, Time, Value) :- node (Start, Goal, Goal, Time, Value, 1). path (Start, Goal, NodeX, Time, ValueX) :- node (Start, Goal, NodeX, Time, ValueX, 1), path (Start, Goal, NodeY, Time + ValueY - ValueX, ValueY), edge (NodeX, NodeY, ValueY - ValueX). 4 URBAN TRAFFIC CONTROL In this section we discuss the problems of effective traffic control in cities where the road crossings are equipped with traffic lights. Effective control should prevent the accumulation of vehicles, waiting for green light on crossings. To be able to describe the problem and its solution, a few new terms have to be introduced. The term intensity represents the number of vehicles passing through one traffic line in a unit of time. Load corresponds to the time rate of the detectors being shaded by cars. The detector is located in every traffic line and serves for data collection describing the actual state of the traffic. The next important term signal phase is the time interval in which free flow is allowed for certain, usually not colliding traffic movements. The last term, signal program, described the traffic lights control on controlled crossings. It determines the order and durations of individual signal phases. The solution of the given problem is not trivial and is composed of several parts. The first problem is to design suitable signal phases for crossings. For the actual values of intensity and load we can create appropriate signal programs. These programs are created so that maximum satisfaction for all traffic movements on the individual crossing is achieved. For a more perfect solution the programs must changed at nearby crossings to off load the crossing with critical traffic. The next problem is the design of signal programs and their synchronization so that traffic movement fluency is optional. For solving all of these problems the deductive approach is applicable. Below we introduce the deductive solution for the signal phases of crossings. In the algorithm which collects signal phases of crossings, the following tables are used. Table movement which describes all possible traffic movements on crossings, and table collision which contains pairs of colliding traffic movements. Each record of the table movement contains the identification of the crossing, one input and one output traffic line, used by the described traffic movement which goes through this crossing. The second table, collision, contains the identification of crossing and identification of two traffic movements, which collide on the crossing. Each of the traffic movements is described by input and output traffic lines. For uniqueness, the identification of traffic lines on crossing is done via numbering where i-th traffic line is assigned the value 2i. This property is used for unique numbering of resultant signal phases. According to the definition, signal phase contains non-colliding traffic movements which means that the non-colliding traffic movements on the crossing have to be deduced. nocollision (Crossing, Input1, Output1, Input2, Output2) :movement (Crossing, Input1, Output1), movement (Crossing, Input2, Output2), not collision (Crossing, Input1, Output1, Input2, Output2), Input1 <> Input2, Output1 <> Output2. In the next step we gradually create tables for signal phases, which contain one, two or more non-colliding traffic movements. This algorithm contains only the creation of signal phases containing at most two traffic movements. Rules for creating more then two non-colliding traffic movements have similar form. phase1 (Crossing, Input + Output, Input, Output) :- movement (Crossing, Input, Output). phase2 (Crossing, Phase + Input2 + Output2, Input1, Output1, Input2, Output2) :phase1 (Crossing, Phase, Input1, Output1), nocollision (Crossing, Input1, Output1, Input2, Output2). In the final part of this algorithm a table is created, which should contain all computed signal phases. Each signal phase in this table contains as many records as is the number of corresponding traffic movements on this crossing. phase (Crossing, Phase, Input, Output) :- phase1 (Crossing, Phase, Input, Output). phase (Crossing, Phase, Input, Output) :- phase2 (Crossing, Phase, Input, Output, _, _). phase (Crossing, Phase, Input, Output) :- phase2 (Crossing, Phase, _, _, Input, Output). 5 CONCLUSION A new approach to the road traffic and transportation control problem was described. The Grant Commission of the European Union is asked to support the next development. A cooperation with the Faculty of Transportation in Prague is prepared to solve the mentioned above problems. Literature 1. DPT. OF TRANSPORTATION: Design of Light Signal Equipment for Traffic Control. Center of Traffic Research, Brno, 1996 (in Czech). 2. PŘIBYL, P. – NOVÁK, M. – PELIKÁN, E.: Preliminary Technical Specification of Prediction Module for Traffic Controller, Research Report LSS 14/97 E, Faculty of Transportation, Czech Technical University, Prague, 1997. 3. ULLMAN, J.D. : Principles of Database and Knowledge-Base Systems, volume II, Computer Science Press, 1989.