Let
be a finite homogeneous Markov chain
with transition matrix
. We want to compute :
![]() |
(1) |
In order to numerically solve such a problem we will use a value iteration method and a policy iteration method.
we will use on of the two following routines to generate a stochastic matrix.
function M= Mtrans(n) M=rand(n,n); s=sum(M,'c'); M= M./(s*ones(1,n)); endfunction function M= Mprom(n,d) A= 2*diag(ones(1,n)) -diag(ones(1,n-1),1) -diag(ones(1,n-1),-1); A(1,2) = 2*A(1,2) ; A($,$-1)=2* A($,$-1); M = eye(A) - A*d endfunction
Question 1
Using one of the previous function, choose a state space dimension,
generate a transition matrix and write a function for
f. build a column
vector |
Question 2
The value iteration méthod to solve the fixed point problem work as follows.
Choose an initial vector
v0=v which gives n possible
states. Then iterate
|
Question 3
The policy iteration algorithm evolves as follow. Choose a first value
for
v0=v. Then given |