| 15 | } |
| 16 | |
| 17 | PCfrSolver::PCfrSolver(shared_ptr<GameTree> tree, vector<PrivateCards> range1, vector<PrivateCards> range2, |
| 18 | vector<int> initial_board, shared_ptr<Compairer> compairer, Deck deck, int iteration_number, bool debug, |
| 19 | int print_interval, string logfile, string trainer, Solver::MonteCarolAlg monteCarolAlg,int warmup,float accuracy,bool use_isomorphism,int num_threads) :Solver(tree){ |
| 20 | this->initial_board = initial_board; |
| 21 | this->initial_board_long = Card::boardInts2long(initial_board); |
| 22 | this->logfile = logfile; |
| 23 | this->trainer = trainer; |
| 24 | this->warmup = warmup; |
| 25 | |
| 26 | range1 = this->noDuplicateRange(range1,initial_board_long); |
| 27 | range2 = this->noDuplicateRange(range2,initial_board_long); |
| 28 | |
| 29 | this->range1 = range1; |
| 30 | this->range2 = range2; |
| 31 | this->player_number = 2; |
| 32 | this->ranges = vector<vector<PrivateCards>>(this->player_number); |
| 33 | this->ranges[0] = range1; |
| 34 | this->ranges[1] = range2; |
| 35 | |
| 36 | this->compairer = compairer; |
| 37 | |
| 38 | this->deck = deck; |
| 39 | this->use_isomorphism = use_isomorphism; |
| 40 | |
| 41 | this->rrm = RiverRangeManager(compairer); |
| 42 | this->iteration_number = iteration_number; |
| 43 | |
| 44 | vector<vector<PrivateCards>> private_cards(this->player_number); |
| 45 | private_cards[0] = range1; |
| 46 | private_cards[1] = range2; |
| 47 | pcm = PrivateCardsManager(private_cards,this->player_number,Card::boardInts2long(this->initial_board)); |
| 48 | this->debug = debug; |
| 49 | this->print_interval = print_interval; |
| 50 | this->monteCarolAlg = monteCarolAlg; |
| 51 | this->accuracy = accuracy; |
| 52 | if(num_threads == -1){ |
| 53 | num_threads = omp_get_num_procs(); |
| 54 | } |
| 55 | qDebug().noquote() << QString::fromStdString(tfm::format(QObject::tr("Using %s threads").toStdString().c_str(),num_threads)); |
| 56 | this->num_threads = num_threads; |
| 57 | this->distributing_task = false; |
| 58 | omp_set_num_threads(this->num_threads); |
| 59 | setTrainable(this->tree->getRoot()); |
| 60 | this->root_round = this->tree->getRoot()->getRound(); |
| 61 | if(this->root_round == GameTreeNode::GameRound::PREFLOP){ |
| 62 | this->split_round = GameTreeNode::GameRound::FLOP; |
| 63 | }else if(this->root_round == GameTreeNode::GameRound::FLOP){ |
| 64 | this->split_round = GameTreeNode::GameRound::TURN; |
| 65 | }else if(this->root_round == GameTreeNode::GameRound::TURN){ |
| 66 | this->split_round = GameTreeNode::GameRound::RIVER; |
| 67 | }else{ |
| 68 | // do not use multithread in river, really not necessary |
| 69 | this->split_round = GameTreeNode::GameRound::PREFLOP; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | const vector<PrivateCards> &PCfrSolver::playerHands(int player) { |
| 74 | if(player == 0){ |
nothing calls this directly
no test coverage detected