今回は以下のランダムウォークの問題を考えます。 I×Jの大きさのグリッドがあります。(1,1)からスタートして、1ターンに上下左右4マスのうち移動できる方向にそれぞれ確率p1,p2,p3,p4で移動します。いくつかのマスには石が置いてあり、通行不可能になっています。(I,J)にはじめて辿り着くまでにかかるターン数の期待値を求めなさい。ただし、(1,1)から(I,J)に移動するパスが少なくとも1つは存在すると仮定します。 例:I = 3, J = 10 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 0 1 1 1 0 1 1 1 0 [2,] 1 0 1 0 1 0 1 0 1 0 [3,] 1 1 1 0 1 1 1 0 1 1 0が石があるマスで、1が移動できるマスです。以降ではこのグリッドを「グリッドA」と呼びます。