• No results found

3 SMART ENVIRONMENT AND AGENT-BASED SIMULATION OF SMART

3.4 Behavior control of the agent-based model

3.4.1 Navigation behavior

With the bottom two levels of the hierarchical model being implemented, it is possible to

model a basic behavior of occupants’ activity: navigation. The goal of navigation behavior is to guide the agents’ movement so they can arrive their destinations. To model the navigation behavior of the occupants, one must utilize the information of the building structure so that the

agents know how to generate paths to arrive its desired location. A building structure can be

abstracted to corridors, rooms and obstacles such as walls. Agent can move in rooms and

corridors but cannot reach the regions occupied by walls. The problem of path generation is

described as follows: given a starting position and a destination and a map of building structure,

find a path from starting position to the destination without engaging any obstacles. To solve this

problem, we abstract the structural information of the building as a way point graph. The way

point graph defines a series of positions and connections between these positions that can

represent the general structure of the building. The way points in the way point graph are set to

the intersections between corridors and corridors as well as intersections between corridors and

rooms. By doing this, two features of the way point graph are guaranteed: first, from arbitrary

way point in the way point graph, there is a path to another arbitrary way point in the way point

graph; second, since we choose the intersections between corridors and intersection between

corridor and room as the way point, from arbitrary position location on the building map, there is

at least one way point can be connected to without engaging any obstacles. The procedure of

generating a path from position R1 to position R2 is shown as follows:

Figure 3.4 Example of office environment

While constructing way point graph, we set intersections between corridors as well as

intersections between corridors and rooms as the way points, represented by black circles in

figure 3.5. We connect each waypoint to its nearest waypoints to form a graph.

Figure 3.5 Example of waypoint graph

To generate the route we first connect the starting position R1 and destination R2 to all

the way points in the way point graph. We then delete the connections that engage the obstacles.

The modified way point graph is shown as red circles in figure 3.6(a). With the modified graph,

find the shortest path from R1 to R2 to generate a route, which is shown by green lines in figure

(a)Add starting positions to graph (b) Generate shortest path

Figure 3.6 Generation of the navigation path

Formally, let Grepresent a waypoint graph:

{ , , } ( ) G V E W W w E  

, where V, E, W, w are sets of the vertices, edges, distance of the edges and function to return the distance of an edge respectively. For each element in V, a coordination is associated to indicate the position of waypoint. To generate a route from an arbitrary initial position p1 to an

arbitrary destination p2, the waypoint graph is modified as follows:

1 1 2 2 1 2 1 1 2 2 1 1 2 2 ( , ) ( , ) ' { , } ' ( , ) ( , ) ' ( , ) ( , ) I f G p I f G p V V p p E E e I p e I p W W w I p w I p G' = (V',E',W')          

, where f is a function to return all vertices in G that directly connected (i.e. without engaging any obstacles) to a given position p ; e is a function that returns all of the edges connecting vertices in I with p ; After we connect the position and destination of an agent to this waypoint graph , Dijkstra algorithm is applied to the new graph G’= {V’,E’,W’} to find the one to one shortest path from p1 to p2. The returned vertices (waypoints) from the algorithm will then

be stored in a vector as sub-destinations of the generated node. The route of occupant di is then described as a vector: 1 1 2 2 3 3 4 4 1 , , , , 2

{ ,

,

,

,

,... }

i x y x y x y x y

d

p m

m

m

m

p

, p1 represents the agent’s current position; p2 represents the destination and mx,y is the

intermediate node in the route as guidance for the occupants’ movement. Once the route is determined, the agent set its velocity to update its position so that it always moves to mx,y

subsequently. Once the agent arrives an intermediate route point, the route point will be removed

from the route vector and agent will set the next element in the vector di as its destination.

In summary, an agent generates its route to a specific destination from its current position

with following rules:

1. Add starting position and final destination of the agent to the waypoint graph by

connecting them to all the possible vertices such that the new edges do not cross any

obstacles (walls in this particular example).

2. Find a shortest path from the starting position to the destination over the modified way

point graph.

3. Store the route point on the found path as a vector so that agent set its velocity to navigate

to the final destination through the intermediate destinations in the vector.

By maintaining a list of intermediate route point, the speed vector of the agent is updated so

that the moving direction of the agent always navigates to the first element of the route point

vector. When it arrives at that route point, the route point will be removed from the list and agent

navigates to the next route point in the vector.

Note that the implemented navigation behavior assumes that occupant selects

(sometimes people does not select the shortest path to its destination), the behavior of select non-

shortest path can be modeled by assigning a sequence of destinations to the agent to be modeled

and let the agent arrive these destination sequentially.

The navigation behavior makes it easy to abstract real world scenario using this

model. Since all the activities in a building can be described by change of occupants’ positions,

modeling these activity is simply a procedures to assign a set of destinations to the occupants.

For example, to model an activity of conference meeting, we can simply assign the location of

the conference room to the destination of each of the agent and let the agents navigates to that location using method mentioned above. To model agents’ daily activities, we can assign different locations such as kitchen and office as agents’ destinations to model the lunch and work activity. In short, with the method described above for navigation behavior, the activity and the

movements of occupants can be easily described and modeled.