class_docstr: <a id="InfoSet"></a>
  
  ## Information Set $I_i$
class_docstr_tok: ["<","a","id=","''","InfoSet","''",">","<","\/a",">","#","#","Information","Set","$","I_i","$"]
docstr: ## Calculate strategy
  
  Calculate current strategy using [regret matching](#RegretMatching).
  
  egin{align}
          extcolor{lightgreen}{\sigma_i^{T+1}(I)(a)} =
  egin{cases}
  rac{   extcolor{orange}{R^{T,+}_i(I, a)}}{\sum_{a'\in A(I)}    extcolor{orange}{R^{T,+}_i(I, a')}},
    &     ext{if} \sum_{a'\in A(I)}       extcolor{orange}{R^{T,+}_i(I, a')} \gt 0 \
  rac{1}{\lvert A(I) 
  vert},
   &      ext{otherwise}
  \end{cases}
  \end{align}
  
  where $ extcolor{orange}{R^{T,+}_i(I, a)} = \max \Big(  extcolor{orange}{R^T_i(I, a)}, 0 \Big)$
docstr_tok: ["#","#","Calculate","strategy","Calculate","current","strategy","using","[","regret","matching","]","(","#","RegretMatching",")",".","\begin","{","align","}","extcolor","{","lightgreen","}","{","\\sigma_i^","{","T+1","}","(","I",")","(","a",")","}","=","\begin","{","cases","}","rac","{","extcolor","{","orange","}","{","R^","{","T",",","+","}","_i","(","I",",","a",")","}","}","{","\\sum_","{","a'\\in","A","(","I",")","}","extcolor","{","orange","}","{","R^","{","T",",","+","}","_i","(","I",",","a","'",")","}","}",",","&","ext","{","if","}","\\sum_","{","a'\\in","A","(","I",")","}","extcolor","{","orange","}","{","R^","{","T",",","+","}","_i","(","I",",","a","'",")","}","\\gt","0","\\","rac","{","1","}","{","\\lvert","A","(","I",")","vert","}",",","&","ext","{","otherwise","}","\\end","{","cases","}","\\end","{","align","}","where","$","extcolor","{","orange","}","{","R^","{","T",",","+","}","_i","(","I",",","a",")","}","=","\\max","\\Big","(","extcolor","{","orange","}","{","R^T_i","(","I",",","a",")","}",",","0","\\Big",")","$"]
code: def calculate_strategy(self):
      """
          ## Calculate strategy
  
          Calculate current strategy using [regret matching](#RegretMatching).
  
          \begin{align}
          \textcolor{lightgreen}{\sigma_i^{T+1}(I)(a)} =
          \begin{cases}
          \frac{\textcolor{orange}{R^{T,+}_i(I, a)}}{\sum_{a'\in A(I)}\textcolor{orange}{R^{T,+}_i(I, a')}},
            & \text{if} \sum_{a'\in A(I)}\textcolor{orange}{R^{T,+}_i(I, a')} \gt 0 \\
          \frac{1}{\lvert A(I) \rvert},
           & \text{otherwise}
          \end{cases}
          \end{align}
  
          where $\textcolor{orange}{R^{T,+}_i(I, a)} = \max \Big(\textcolor{orange}{R^T_i(I, a)}, 0 \Big)$
          """
      # $$\textcolor{orange}{R^{T,+}_i(I, a)} = \max \Big(\textcolor{orange}{R^T_i(I, a)}, 0 \Big)$$
      regret = {a: max(r, 0) for a, r in self.regret.items()}
      # $$\sum_{a'\in A(I)}\textcolor{orange}{R^{T,+}_i(I, a')}$$
      regret_sum = sum(regret.values())
      # if $\sum_{a'\in A(I)}\textcolor{orange}{R^{T,+}_i(I, a')} \gt 0$,
      if regret_sum > 0:
          # $$\textcolor{lightgreen}{\sigma_i^{T+1}(I)(a)} =
          # \frac{\textcolor{orange}{R^{T,+}_i(I, a)}}{\sum_{a'\in A(I)}\textcolor{orange}{R^{T,+}_i(I, a')}}$$
          self.strategy = {a: r / regret_sum for a, r in regret.items()}
      # Otherwise,
      else:
          # $\lvert A(I) \rvert$
          count = len(list(a for a in self.regret))
          # $$\textcolor{lightgreen}{\sigma_i^{T+1}(I)(a)} =
          # \frac{1}{\lvert A(I) \rvert}$$
          self.strategy = {a: 1 / count for a, r in regret.items()}
  
imports: from typing import NewType, Dict, List, Callable, cast
  from labml import monit, tracker, logger, experiment
  from labml.configs import BaseConfigs, option
label_desc: Use image node_id 6 for calling the InfoSet obj's underlying member method code with example usage: obj.calculate_strategy() without return types