Poker-AI.org

Poker AI and Botting Discussion Forum
It is currently Mon Nov 13, 2023 2:00 pm

All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: Wed Jul 17, 2019 1:33 am 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
I have built a solver for a poker player, it's not a bot but soemthing like Pio that he uses to study games other than NL Holdem.
So far it can display strategies and ranges, but now the guy also wants to display EQs and EVs. Everything has to happen pretty much in real time and before I start implementing it, I am thinking about the best way to do it.
The obvious way is to just enumerate everything, but it's a multiway solver that also supports preflop, so I think that might take too long?
Is there any way to calculate preflop EQs with LUTs? It's pretty simple in HU situations, you basically save all the hand vs. hand EQs and then weigh every hand according to the opponents range, but I think there is no way to do that in multiway pots, is that correct?
Right now I am thinking about using monte carlo methods for both calculations, but then again it might take some time untill it converges in multiway pots...

Any tips? Or maybe someone knows some good C/C++ code for this? (At least the EQ)


Top
 Profile  
 
PostPosted: Wed Jul 17, 2019 9:05 am 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 642
I suspect I haven't understood the question properly but here goes anyway.

If it's like Pio then you surely you can get EVs from the last best response calculation you did in the solution. Equity is a similar, but simpler calculation because it only has to look at one path between chance nodes terminating in showdowns, not folds


Top
 Profile  
 
PostPosted: Thu Jul 25, 2019 2:07 am 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
The solver is similar to Pio in functionality, but it uses a different algorithm. I use monte carlo CFR and don't compute the best response at this point.
I checked how long it takes to compute the equity with Equilab for a flop and it's about 5-10 seconds which would be way too slow for my software.
Also unlike Pio my solver has multiway pots and preflop so it will take longer anyway. I will think about it more during the weekend but I think in the end a monte carlo eq and ev are the most likely ways I will tackle this.


Top
 Profile  
 
PostPosted: Tue Jul 30, 2019 6:17 am 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
One thing that I am wondering about is, if there is a way to use the HU equity LUTs and calculate multiway equities from that.
For example if hero has AA, the 2 villains have KK and A5. AA has 82% EQ vs KK and 90% EQ vs A5, can we from that calculate how much EQ AA has vs bot ranges combined?

I think it's not possible btw. but maybe I am wrong.


Top
 Profile  
 
PostPosted: Thu Aug 01, 2019 5:37 am 
Offline
New Member

Joined: Thu Aug 01, 2019 5:36 am
Posts: 2
Thanks for sharing


Top
 Profile  
 
PostPosted: Sun Aug 04, 2019 6:58 pm 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
I have implemented the monte carlo method today. It is fast enough I would say, but it's still much slower than Equilab. I think that is normal because Equilab only deals with combos that are either in the range or not, my solver has to deal with probabilities. So a hand combo can have a weight like 0.5 or 0.6494.
I used the C++ standard library discrete_distribution and I also use rejection, meaning that rather than adjusting the probability for each combo every time I sample a new board (card removal basically) I just sample a hand from the original distribution and reject it/sample a new hand if it overlaps with the board.

Still the sampling is pretty much all of the runtime of my algorithm, even though the C++ standard say it's amortized constant time. Any ideas how to speed it up?


Top
 Profile  
 
PostPosted: Mon Aug 05, 2019 9:50 am 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 642
I don't think I'm particularly surprised that that sampling is a big part of the calculation, since the meat is so simple.

But I'm confused by this question. Calculating the NE which you are already doing is orders of magnitude more expensive than calculating ev and equity, so I just don't see why it matters. If you already have the NE strategy can't you calculate best response from it? There are a lot of similarities between calculating EV, Equity and NE, so If you have some ingenious scheme to make the NE calculation go faster, can't you use a similar scheme to make EV and equity go faster.

I think to really be able to help I need to know what you are already doing better than I currently do.


Top
 Profile  
 
PostPosted: Mon Aug 05, 2019 7:12 pm 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
I am not sure if my NE calculation is really that fast, I mean it's ok I guess but not faster than other commercial solvers.

The NE calculation takes way longer than calculating EV or EQ, that is true, but the usage and the user's expectations are different. Basically the user runs the training over night generally, but then when he views the results he wants a responsive GUI.
So for example if he views the root of the game, the EQ and EV should be computed in maybe a second or so, and when he chooses an action, in other words he changes to a different game state, the EQ and EV should again be computed in about a second.
A full best response from the preflop round would take much longer than that, especially in multiway pots. If you for example take something like Equilab it takes some time to compute Equities for a 5 player situation, so I thought there might be faster ways with LUTs or so.

My monte carlo sampling looks like this:

Code:
std::discrete_distribution<int> distribution;

int HolecardRandomDistribution::nextCombo(unsigned long long cardMask) {
   int index = distribution(generator);
   unsigned char cards[2];
   Range::getHoleCardCombinationFromIndex(cards, index);
   while ((((cardMask | (1ULL << cards[0])) == cardMask) || (((cardMask | (1ULL << cards[1]))) == cardMask))) {
      index = distribution(generator);
      Range::getHoleCardCombinationFromIndex(cards, index);
   }

   return index;
}


Basically I sample a combination from a vector with 1326 probabilities and after each combo that I sample I set the corresponding bit in the cardMask.
If the combination that I sampled overlaps with any combinations that were sampled before, I resample.
For preflop HU and preflop 3handed I use LUTs.


Top
 Profile  
 
PostPosted: Tue Aug 06, 2019 9:50 am 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 642
Can't you calculate the EVs and the equities for all situations at the end of the NE calculation and put them on disk? Work back from leaves to root.

I think you should be able to do this without using up too much memory. If not you can free up memory used in the NE calculation I think. I reckon it is possible to store each NE action probability in a byte.


Top
 Profile  
 
PostPosted: Wed Aug 07, 2019 8:07 pm 
Offline
Veteran Member

Joined: Mon Mar 04, 2013 9:40 pm
Posts: 269
You can get a 5x cfr speed improvement if you precalculate the equities in advance. For holdem this about 120G of data or so. It takes about a day to do all 1755 on an average machine.


Top
 Profile  
 
PostPosted: Thu Aug 15, 2019 2:49 pm 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
shalako wrote:
this about 120G of data or so

That's only for HU, right?


Top
 Profile  
 
PostPosted: Thu Aug 15, 2019 2:50 pm 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
Another related question: most of you have probably heard about the O(N) terminal node evaluation, I only got it to work for HU, is it also possible for multiway?


Top
 Profile  
 
PostPosted: Wed Aug 21, 2019 7:06 pm 
Offline
Veteran Member

Joined: Mon Mar 04, 2013 9:40 pm
Posts: 269
HontoNiBaka wrote:
shalako wrote:
this about 120G of data or so

That's only for HU, right?


Yeah Only HU as its hand vs hand but it would not take much to modify the calc for multiway. The data is the same.

Anybody know how solvers or a method to calculate optimal bet sizing? all I have seen is Tiptons Traps formula and not much else.


Top
 Profile  
 
PostPosted: Thu Aug 22, 2019 9:42 am 
Offline
Senior Member
User avatar

Joined: Sun Mar 10, 2013 10:31 am
Posts: 139
are preflop ranges you use are predefined?
or can you get few (100, 1000) predefined ranges?
then solution is simple.
for each range pregenerate some distribution (few thousends card pairs) (with probabilities already calculated there)
so get random card pait will be just GerPair(rand()),
then you can calculate any you thoughts wery wery quick.
(cards vs distribution, distribution vs distribution vs distribution)
And this "not LUTs" will take no mutch place.
for example you have 100 predefined distributions, in each 2000 predefined card pairs
so it will takes only 100*2k*2 = 0.4Mb of memory
1000 predefined distributions will take 4Mb of memory :)

with this technik you will have easy calculation time < 1ms.
but if you want faster - just ask me how ))


Last edited by nefton on Thu Aug 22, 2019 10:11 am, edited 2 times in total.

Top
 Profile  
 
PostPosted: Thu Aug 22, 2019 10:05 am 
Offline
Senior Member
User avatar

Joined: Sun Mar 10, 2013 10:31 am
Posts: 139
also, just understanding what realy EQs mean - probably can imroove your perfomanse 2x or 3x or 5x faster.
Main keyword i talking about is "accuracy"
how many itterations do you do? why? do you ask yourself that question?
may be doing 10% of that amount of itterations in some cases will be enought to answer to your question?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group