ruby/strategy.rb
# U: transition probability matrix
# U_ij: transition probability from j to i
transition probability matrix
U_ij: transition probability from j to i
transition probability matrix U_ij : transition probability from j to i
def _U_matrix(e, b_strategy)
    u = Array.new(N) { Array.new(N, 0.0) }
    N.times do |i|
      si = State.make_from_id(i)
      N.times do |j|
        sj = State.make_from_id(j)
        act_a = action(sj)
        act_b = b_strategy.action( sj.swap )
        sjn = sj.next_state(act_a, act_b)
        u[i][j] = _uij(si, sjn, e)
      end
    end
    u
  end
def _U_matrix ( e , b_strategy ) u = Array . new ( N ) { Array . new ( N , 0.0 ) } N . times do | i | si = State . make_from_id ( i ) N . times do | j | sj = State . make_from_id ( j ) act_a = action ( sj ) act_b = b_strategy . action ( sj . swap ) sjn = sj . next_state ( act_a , act_b ) u [ i ] [ j ] = _uij ( si , sjn , e ) end end u end
U: transition probability matrix
U_ij: transition probability from j to i
U : transition probability matrix U_ij : transition probability from j to i
e
b_strategy