1

i am trying to model car urban mobility by using Markov chains. I am trying to figure out why my Markov Chain model will not converge to a steady state distribution, assuming that it follows the assumptions of aperiodocity, ergodicity etc. I tried to implement it through python and matrix multiplication using numpy. Below you can see the initial state matrix (A0) and the transition matrix (T). I would appreciate any help. Edit: Below there is a sample of my python code

#Transition matrix
T = np.array([[0.772,0.044,0.001,0.026,0.026,0.001],
             [0.114,0.760,0.183,0.026,0.022,0.007],
             [0.001,0.112,0.447,0.055,0.056,0.008],
             [0.057,0.028,0.157,0.473,0.022,0.001],
             [0.055,0.042,0.184,0.394,0.556,0.072],
             [0.001,0.014,0.026,0.028,0.318,0.911]]).reshape(6,6)


#Initial state matrix
A1 = np.array([0.086,0.180,0.086,0.078,0.219,0.350]).reshape(6,1)

forw = A1

fin = []

i=0

while i<10000:
            
    foo = np.dot(T,forw)
        
    fin.append(foo)
    
    forw = foo
    
    i+=1

enter image description here

Fillip
  • 31
  • 2

0 Answers0