src/solve_all_backup_subgames.cpp
// Copy the base values for the trunk to final_sumprobs_.
// There's an assumption that nodes in the base tree and the final tree have the same indices
// (in the trunk).
Copy the base values for the trunk to final_sumprobs_.
There's an assumption that nodes in the base tree and the final tree have the same indices
(in the trunk).
Copy the base values for the trunk to final_sumprobs_ . There ' s an assumption that nodes in the base tree and the final tree have the same indices ( in the trunk ) .
void SubgameSolver::CopyTrunk(Node *node) {
  int st = node->Street();
  if (st >= resolve_st_) return;
  if (node->Terminal()) return;
  int pa = node->PlayerActing();
  int nt = node->NonterminalID();
  int num_succs = node->NumSuccs();
  if (base_buckets_.None(st)) {
    CFRStreetValues<int> *base_csv =
      dynamic_cast<CFRStreetValues<int> *>(base_sumprobs_->StreetValues(st));
    CFRStreetValues<int> *final_csv =
      dynamic_cast<CFRStreetValues<int> *>(final_sumprobs_->StreetValues(st));
    int num_boards = BoardTree::NumBoards(st);
    for (int bd = 0; bd < num_boards; ++bd) {
      CopyUnabstractedValues(base_csv->AllValues(pa, nt), final_csv->AllValues(pa, nt), st,
			     num_succs, bd, bd);
    }
  } else {
    int num_buckets = base_buckets_.NumBuckets(st);
    CFRStreetValues<int> *from_csv =
      dynamic_cast<CFRStreetValues<int> *>(base_sumprobs_->StreetValues(st));
    CFRStreetValues<int> *to_csv =
      dynamic_cast<CFRStreetValues<int> *>(final_sumprobs_->StreetValues(st));
    int *from_values = from_csv->AllValues(pa, nt);
    int *to_values = to_csv->AllValues(pa, nt);
    int num = num_buckets * num_succs;
    for (int i = 0; i < num; ++i) {
      to_values[i] = from_values[i];
    }
  }
  for (int s = 0; s < num_succs; ++s) {
    CopyTrunk(node->IthSucc(s));
  }
}
void SubgameSolver :: CopyTrunk ( Node * node ) { int st = node -> Street ( ) ; if ( st >= resolve_st_ ) return ; if ( node -> Terminal ( ) ) return ; int pa = node -> PlayerActing ( ) ; int nt = node -> NonterminalID ( ) ; int num_succs = node -> NumSuccs ( ) ; if ( base_buckets_ . None ( st ) ) { CFRStreetValues < int > * base_csv = dynamic_cast < CFRStreetValues < int > * > ( base_sumprobs_ -> StreetValues ( st ) ) ; CFRStreetValues < int > * final_csv = dynamic_cast < CFRStreetValues < int > * > ( final_sumprobs_ -> StreetValues ( st ) ) ; int num_boards = BoardTree :: NumBoards ( st ) ; for ( int bd = 0 ; bd < num_boards ; ++ bd ) { CopyUnabstractedValues ( base_csv -> AllValues ( pa , nt ) , final_csv -> AllValues ( pa , nt ) , st , num_succs , bd , bd ) ; } } else { int num_buckets = base_buckets_ . NumBuckets ( st ) ; CFRStreetValues < int > * from_csv = dynamic_cast < CFRStreetValues < int > * > ( base_sumprobs_ -> StreetValues ( st ) ) ; CFRStreetValues < int > * to_csv = dynamic_cast < CFRStreetValues < int > * > ( final_sumprobs_ -> StreetValues ( st ) ) ; int * from_values = from_csv -> AllValues ( pa , nt ) ; int * to_values = to_csv -> AllValues ( pa , nt ) ; int num = num_buckets * num_succs ; for ( int i = 0 ; i < num ; ++ i ) { to_values [ i ] = from_values [ i ] ; } } for ( int s = 0 ; s < num_succs ; ++ s ) { CopyTrunk ( node -> IthSucc ( s ) ) ; } }
Copy the base values for the trunk to final_sumprobs_.
Copy the base values for the trunk to final_sumprobs_ .