@jit(nopython=True, cache=True)
def _lemke_howson_capping(payoff_matrices, tableaux, bases, init_pivot, max_iter, capping):
 (m, n) = (tableaux[1].shape[0], tableaux[0].shape[0])
 init_pivot_curr = init_pivot
 max_iter_curr = max_iter
 total_num_iter = 0
 for k in range(((m + n) - 1)):
  capping_curr = min(max_iter_curr, capping)
  initialize_tableaux(payoff_matrices, tableaux, bases)
  (converged, num_iter) = lemke_howson_tbl(tableaux, bases, init_pivot_curr, capping_curr)
  total_num_iter += num_iter
  if (converged or (total_num_iter >= max_iter)):
   return (converged, total_num_iter, init_pivot_curr)
  init_pivot_curr += 1
  if (init_pivot_curr >= (m + n)):
   init_pivot_curr -= (m + n)
  max_iter_curr -= num_iter
 initialize_tableaux(payoff_matrices, tableaux, bases)
 (converged, num_iter) = lemke_howson_tbl(tableaux, bases, init_pivot_curr, max_iter_curr)
 total_num_iter += num_iter
 return (converged, total_num_iter, init_pivot_curr)

@ jit ( nopython = True , cache = True ) def _lemke_howson_capping ( payoff_matrices , tableaux , bases , init_pivot , max_iter , capping ) : ( m , n ) = ( tableaux [ 1 ] . shape [ 0 ] , tableaux [ 0 ] . shape [ 0 ] ) init_pivot_curr = init_pivot max_iter_curr = max_iter total_num_iter = 0 for k in range ( ( ( m + n ) - 1 ) ) : capping_curr = min ( max_iter_curr , capping ) initialize_tableaux ( payoff_matrices , tableaux , bases ) ( converged , num_iter ) = lemke_howson_tbl ( tableaux , bases , init_pivot_curr , capping_curr ) total_num_iter += num_iter if ( converged or ( total_num_iter >= max_iter ) ) : return ( converged , total_num_iter , init_pivot_curr ) init_pivot_curr += 1 if ( init_pivot_curr >= ( m + n ) ) : init_pivot_curr -= ( m + n ) max_iter_curr -= num_iter initialize_tableaux ( payoff_matrices , tableaux , bases ) ( converged , num_iter ) = lemke_howson_tbl ( tableaux , bases , init_pivot_curr , max_iter_curr ) total_num_iter += num_iter return ( converged , total_num_iter , init_pivot_curr )
execute the lemke-howson algorithm with the heuristics proposed by codenotti et al .