* Example 6:
echo Example 6:
* DTMC steady-state analysis using SHARPE
* This is the example on p. 328 of Trivedi's book.
* see Figure 7.9 in the cited book

* Note that self loop probs are not entered intentionally
* By deceiving sharpe into thinking that the chain is
* CTMC, and omitting self loops, we obtain the correct
* steady state probs of the DTMC. This can be shown
* by playing with steady state balance equations

var q2 1-q1
markov memint
1_1 0_2 q2^2
1_1 2_0 q1*q1
0_2 1_1 q1
2_0 1_1 q2
reward default 0
1_1 2
2_0 1
0_2 1
end
end

var EB exrss(memint)
var EBbook (1-q1*q2)/(1-2*q1*q2)
 
loop x1,0.3,0.6,0.1
   bind q1 x1
   expr prob(memint,1_1),prob(memint,0_2),prob(memint,2_0)
   expr EB,EBbook
end

end

