src/solve_one_subgame_safe.cpp
// Currently assume that this is a street-initial node.
// Might need to do up to four solves.  Imagine we have an asymmetric base
// betting tree, and an asymmetric solving method.
Currently assume that this is a street-initial node.
Might need to do up to four solves.  Imagine we have an asymmetric base
betting tree, and an asymmetric solving method.
Currently assume that this is a street - initial node . Might need to do up to four solves . Imagine we have an asymmetric base betting tree and an asymmetric solving method .
void SubgameSolver::ResolveUnsafe(Node *node, const string &action_sequence,
				  const ReachProbs &reach_probs) {
  int st = node->Street();
  fprintf(stderr, "ResolveUnsafe %s st %i nt %i gbd %i\n", action_sequence.c_str(), st,
	  node->NonterminalID(), target_bd_);
  int num_players = Game::NumPlayers();
  HandTree hand_tree(st, target_bd_, Game::MaxStreet());
  unique_ptr<EGCFR> eg_cfr;
  if (method_ == ResolvingMethod::UNSAFE) {
    eg_cfr.reset(new UnsafeEGCFR(subgame_card_abstraction_, base_card_abstraction_,
				 base_betting_abstraction_, subgame_cfr_config_, base_cfr_config_,
				 subgame_buckets_, 1));
  } else {
    fprintf(stderr, "Method not supported yet\n");
    exit(-1);
  }
  int num_asym_players = base_betting_abstraction_.Asymmetric() ? num_players : 1;
  for (int asym_p = 0; asym_p < num_asym_players; ++asym_p) {
    BettingTrees *subgame_subtrees = CreateSubtrees(node, asym_p, false);
    if (method_ != ResolvingMethod::UNSAFE) {
      fprintf(stderr, "Expecting unsafe method\n");
      exit(-1);
    }
    double resolving_secs = 0;
    struct timespec start, finish;
    clock_gettime(CLOCK_MONOTONIC, &start);
    eg_cfr->SolveSubgame(subgame_subtrees, target_bd_, reach_probs, action_sequence, &hand_tree,
			 nullptr, -1, true, num_subgame_its_);
    clock_gettime(CLOCK_MONOTONIC, &finish);
    resolving_secs += (finish.tv_sec - start.tv_sec);
    resolving_secs += (finish.tv_nsec - start.tv_nsec) / 1000000000.0;
    printf("Resolving secs: %f\n", resolving_secs);
    fflush(stdout);
    delete subgame_subtrees;
  }
}
void SubgameSolver :: ResolveUnsafe ( Node * node , const string & action_sequence , const ReachProbs & reach_probs ) { int st = node -> Street ( ) ; fprintf ( stderr , " \n " , action_sequence . c_str ( ) , st , node -> NonterminalID ( ) , target_bd_ ) ; int num_players = Game :: NumPlayers ( ) ; HandTree hand_tree ( st , target_bd_ , Game :: MaxStreet ( ) ) ; unique_ptr < EGCFR > eg_cfr ; if ( method_ == ResolvingMethod :: UNSAFE ) { eg_cfr . reset ( new UnsafeEGCFR ( subgame_card_abstraction_ , base_card_abstraction_ , base_betting_abstraction_ , subgame_cfr_config_ , base_cfr_config_ , subgame_buckets_ , 1 ) ) ; } else { fprintf ( stderr , " \n " ) ; exit ( -1 ) ; } int num_asym_players = base_betting_abstraction_ . Asymmetric ( ) ? num_players : 1 ; for ( int asym_p = 0 ; asym_p < num_asym_players ; ++ asym_p ) { BettingTrees * subgame_subtrees = CreateSubtrees ( node , asym_p , false ) ; if ( method_ != ResolvingMethod :: UNSAFE ) { fprintf ( stderr , " \n " ) ; exit ( -1 ) ; } double resolving_secs = 0 ; struct timespec start , finish ; clock_gettime ( CLOCK_MONOTONIC , & start ) ; eg_cfr -> SolveSubgame ( subgame_subtrees , target_bd_ , reach_probs , action_sequence , & hand_tree , nullptr , -1 , true , num_subgame_its_ ) ; clock_gettime ( CLOCK_MONOTONIC , & finish ) ; resolving_secs += ( finish . tv_sec - start . tv_sec ) ; resolving_secs += ( finish . tv_nsec - start . tv_nsec ) / 1000000000.0 ; printf ( " \n " , resolving_secs ) ; fflush ( stdout ) ; delete subgame_subtrees ; } }
Currently assume that this is a street-initial node.
Currently assume that this is a street - initial node .
// One solve for unsafe endgame solving, no t_vals // Don't write out the resolved strategies