• No results found

5 COMPONENT SET RESAMPLING FOR HIGH DIMENSIONAL STATE

6.3 The dynamics of the model

At each time step, the graph model evolves according to two sets of different rules. One

set of rules defines the behavior of the occupants at each time step including how they decide the

destination vertex and how they move to the destination, another set of rules defines the behavior

of occupant in the move queue of each link.

The rules to decide the occupant’s destination and how they move to the destination is defined as follows. For the model of occupant movement behavior, at each time step, if the delay

of occupant is larger than 0, then the delay of the occupant decreases by 1 and elapse time of the

occupant increases by 1. The delay of the occupant serve as a counter to count how many time

step the occupant will stay in its current location and the elapse time of the occupant represents the number of time step has been staying in current location. If the occupant’s delay is set to -1, this means this occupant has just entered its current location and needs to determine its

destination and delay. To determine the destination of the occupant, occupant looks up the

transition table of the current vertex it resides in and select movement behavior profile according

to its current state. The transition table specifies the probability of occupant in a vertex to travel

to each neighbor of the vertex. The occupant use a generated random number to determine which

vertex to travel to according to the probabilities specified in the transition table. This procedure

resides in is assigned to a portion of the roulette wheel while the area of the portion is

proportional to the probability of traveling from current vertex to the neighbor vertex. By

generating a random number between 0 and 1, roulette wheel spins and the selection point points

to some portion of the wheel, then the neighbor vertex assigned to that portion is selected to be

the destination vertex of the occupant. Take the transition table illustrated in figure 6.2 as an

example, according this transition table, the shares of the portion of the roulette wheel is

specified as follows: portion 0~0.4 is assigned to vertex -1 which means staying in current

vertex, portion 0.4~0.6 is assigned to vertex 1, portion 0.6~0.8 is assigned to vertex 3 and portion

0.8~1.0 is assigned to vertex 4. To select a destination, the system generates a random number

between 0 and 1, say, 0.7. Because 0.7 is within the portion 0.6~0.8, vertex 3 is selected as the

destination of the occupant. After the determination of the destination, the next step is to

determine how long the occupant will stay in current vertex. The occupant stays in current vertex

for two reasons: if the occupant’s destination is current vertex, it means it chooses to stay in this vertex for some time; if the occupant’s destination is one of the neighbor vertices of current vertex, the occupant will spend some time to travel to that vertex. The delay an occupant chooses

to stay in current vertex is determined by two attributes minStayTime and maxStayTime, the

actual time an occupant chooses to stay in current vertex is a random value between

minStayTime and maxStayTime. The delay an occupant will spend to travel to the neighbor

vertex is determined by the speed of the occupant and the link distance between the link that the

occupant used to entering its current vertex and the link connecting its current vertex to the

neighbor vertex it will travel to. Specifically, it is a random value between the maxDelay and

minDelay. The maxDelay is calculated by the link distance divided by the speed of the occupant

minus elapse time (int the case maxDelay is larger or equal to the elapse time). After the delay of

the occupant is set, it reduces by 1 at each time step. When it reaches 0, it means the staying time

for the occupant has expired or the occupant has finished traveling and ready to enter the

destination vertex. If it is the first case, then delay is reset to -1 so that the occupant goes over

this procedure again to perform movement behavior. If it is the second case then the occupant is queued into the moving queue of the link that connecting the occupant’s current vertex to its destination vertex. The procedure that the occupant moves in the vertex of the graph can be

summarized as follows: function simulate(timeStep) //System behavior Decide_system_phase(); // Agent behavior for each oi in O oi.phase = systemPhase; if oi.s=staying if oi.tstay_delay >0

oi.tstay_delay←oi.tstay_delay-1, oi.telapse←oi.telapse+1 else if oi.tstay_delay =0 decision_making(oi) end if end if if oi.s=moving if oi.tmove_delay >0

oi.tmove_delay←oi.tmove_delay-1, oi.telapse←oi.telapse+1 else if oi.tmove_delay =0 addQueue(oi, oi.lto.q) oi.s ← in queue end if end if if oi.s=in queue // do nothing end if end for

// Queue Behavior -- remove agent from queue

for each link l in the graph for g←1 to l.cf

if o.vdestination.c>o.vdestination.n

o←poll(l.q) o.vpositionl.vto o.lfrom←l o.telapse←0 l.vfrom.nl.vfrom.n-1 l.vto.nl.vto.n+1 decision_making(o) end for end for

function decision_making(oi)

transition_table←choose_transition_table(oi.vposition.T, oi.ph)

oi.vdestination ←select_destination(transition_table)

oi.lto ←findLink(oi.vposition, oi.vdestination)

if (oi.vdestination= oi.vposition) // the case of staying

r←rand(0,1)

s←staying

oi.tstay_delay ←minStaytime+r*(maxStaytime-minStaytime)

else // the case of moving

maxDelay←linkDistance(oi.lfrom ,oi.lto)/oi.spd

minDelay←maxDelay- oi.telapse if maxDelay>= oi.telapse

minDelay←0 if maxDelay< oi.telapse

r←rand(0,1)

s←moving

oi.tmove_delay ←minDelay+r*(maxDelay-minDelay)

end if

In this algorithm, choose_transition_table is a function that select a transition table according to the occupant’s state s, select_destination is a function takes transition_table as input and randomly select a vertex as the destination of the occupant, findLink(v1,v2) returns the link

pointed from vertex v1 to vertex v2, rand(a,b) is a function generating a random number that is

between a and b. linkDistance(l1,l2) returns the link distance between the link l1 and link l2.

function is a function to determine the phase ph of each of the occupants so that occupants select

transition table to guide movements accordingly.

The rules to decide the behavior of occupant in the move queue of each link is defined as

follows. At each time step, for each link of the graph, remove number of occupants equals to the

flow capacity of that link from the moving queue. The occupants that removed from the move

queue enter their destination vertices where the destinations of the occupants become the

locations of the occupants; meanwhile, the delays of the occupants are reset to -1, the isInQueue

properties are reset to false, the elapse time properties of the occupants are reset to 0, the “from” link properties of the occupants are set to the link that the occupants are removed from.

These two sets of rules together define the transition function of the graph model. In the

following section, we describe a case study using the proposed graph model to simulate the

occupancy dynamic in a building.