bupticybee / TexasSolver

🚀 A very efficient Texas Holdem GTO solver :spades::hearts::clubs::diamonds:
https://bupticybee.github.io/texassolver_page
GNU Affero General Public License v3.0
1.69k stars 301 forks source link

saving to json file took 20 minutes #52

Open ad-dev-on opened 2 years ago

ad-dev-on commented 2 years ago

I ran the default free-pio range and bet sizes (3betpotFAST tree) exactly using your .exe, it solved pretty smooth but then after achieving 0.5 accuracy it took more than 20 minutes to save it to .json file the solving process took 80 something iteration under 2 minutes using only 1GB ram but then when it started saving it to json file, its memory usage exceeded my computer ram capacity (16GB) and program started paging.

here is my command line parameters: set_pot 180 set_effective_stack 910 set_board Qs,Jh,2h set_range_ip AA:0.25,99,88,77,66,55,44,33,22,AQo,AJ,AT,A9,A8,A7s,A6s,A5s,A4s,A3s,A2s,KQ,KJ,KT,K9,K8s,K7s,K6s,K5s,K4s,K3s,K2s,QJ,QT,Q9,Q8s,Q7s,Q6s,Q5s,Q4s,Q3s,Q2s,JT,J9,J8s,J7s,J6s,T9,T8s,T7s,T6s,98,97s,96s,95s:0.5,87s,86s,85s:0.5,76s,75s,74s:0.5,65s,64s,63s:0.5,54s,53s:0.5,43s set_range_oop AA,KK,QQ,JJ,TT,99,88,AK,AQ,AJ,ATs,ATo:0.75,A9s,A8s,A5s:0.5,A4s:0.5,A3s:0.5,A2s:0.5,KQ,KJs,KJo:0.75,KTs,KTo:0.25,K9s,QJs,QJo:0.5,QTs,Q9s,JTs,JTo:0.25,J9s,J8s,T9s,T8s,T7s:0.45,98s,97s,96s:0.45,87s,86s:0.75,85s:0.45,76s:0.75,75s:0.75,74s:0.45,65s:0.75,64s:0.5,63s:0.45,54s:0.75,53s:0.5,52s:0.45,43s:0.5,42s:0.45,32s:0.45 set_bet_sizes oop,flop,bet,50 set_bet_sizes oop,flop,raise,50 set_bet_sizes ip,flop,bet,50 set_bet_sizes ip,flop,raise,50 set_bet_sizes oop,turn,bet,50 set_bet_sizes oop,turn,raise,50 set_bet_sizes ip,turn,bet,50 set_bet_sizes ip,turn,raise,50 set_bet_sizes oop,river,bet,50 set_bet_sizes oop,river,donk,50 set_bet_sizes oop,river,raise,50 set_bet_sizes ip,river,bet,50 set_bet_sizes ip,river,raise,50 set_allin_threshold 0.67 build_tree set_thread_num 8 set_accuracy 0.5 set_max_iteration 200 set_print_interval 10 set_use_isomorphism 1 start_solve set_dump_rounds 3 dump_result output_result.json

I needed river strategy so I used set_dump_rounds 3 Also the output file was 1GB or something like that

bupticybee commented 2 years ago

Yes this is a known issue. I know it's bad, json is not a efficient format to save the strategy after all.

I will seek to create a format of my own to solve this issue, hopefully in the next version (0.2.0) or the version after the next.

bupticybee commented 2 years ago

And BTW can you give me a clue why saving river is needed? Most people cannot even memorize flop and turn, not to mention river.

I mean other than building a bot, I really don't see the reason to save the strategy of river.

ad-dev-on commented 2 years ago

you are absolutely right, I don't think humans are capable of memorizing flop strategy in every situation on different boards let alone turn or river. However, My coach says we need to review all these spots to learn the pattern of strategies in every streets especially river. In 100bb cash game most of the time we are dealing with all-in spots which is half the beginning stack size therefore it is detrimental to learn these spots.

ad-dev-on commented 2 years ago

Lets say we have 100bb preflop we raise they 3bet we call, now if they bet half pot on the flop and half on the turn they are usually betting 60bb all in on the river which is 60% of our beginning stack which is huge. IMO river decisions are the toughest part of poker.

bupticybee commented 2 years ago

Lets say we have 100bb preflop we raise they 3bet we call, now if they bet half pot on the flop and half on the turn they are usually betting 60bb all in on the river which is 60% of our beginning stack which is huge. IMO river decisions are the toughest part of poker.

I myself don't play poker a lot, I guess I didn't fully understand all your points, but I guess this is what you are saying:

  1. human can't remember everything but you still want to know how to play in some important points in river, and that's why you want to save the river strategy.
  2. people make huge bets in river all the time, so it's crucial to learn how to play in river.

Is this the points you want to make? Or am I missing something here?

I will try to fix the saving speed in the next version for sure.

BTW, do you have more suggestions for the solver? I'm building the gui version these weeks, I'm open to every possible suggestions now.

ad-dev-on commented 2 years ago

me neither I'm a recreational player I play here and there and lose money haha.

about your question:

Here is a 3bet pot flop situation which is very common: flop: Pot: 20 remaining-stack:90 oop bets 10(50% of pot) ip calls

Turn Pot: 40 remaining stack: 80 oop bets 20(50% of pot) ip calls

River Pot: 80 remaining stack: 60

here is the river spots that I was talking about. the pot is completely inflated. Relative to the pot our stack is small or stack to pot ratio is small enough to leave oop with 2 decision either check or bet all-in. But if you consider it we have so many chips(remember we started with 100). that is why river decisions are very important we would lose a lot of chips if we don't study these spots. A lot of players drown in the river haha.

so yes they bet huge if you consider chips but relative to the pot small(close to only 70% of the pot).

bupticybee commented 2 years ago

me neither I'm a recreational player I play here and there and lose money haha.

about your question:

Here is a 3bet pot flop situation which is very common: flop: Pot: 20 remaining-stack:90 oop bets 10(50% of pot) ip calls

Turn Pot: 40 remaining stack: 80 oop bets 20(50% of pot) ip calls

River Pot: 80 remaining stack: 60

here is the river spots that I was talking about. the pot is completely inflated. Relative to the pot our stack is small or stack to pot ratio is small enough to leave oop with 2 decision either check or bet all-in. But if you consider it we have so many chips(remember we started with 100). that is why river decisions are very important we would lose a lot of chips if we don't study these spots. A lot of players drown in the river haha.

so yes they bet huge if you consider chips but relative to the pot small(close to only 70% of the pot).

I see, seems like the postflop spr ratio is pretty small.

It's pretty unreasonable from my point of view, if anyone play like this, the game won't last long. In a few rounds that player will lost all of his/her chips.

Bynoo commented 2 years ago

From a game theoretical/computational point of view, figuring out an exact river solution (given full information on both players ranges) is an easy problem.

However, when it comes to gameplay, certain aspects are different when comparing river decision making to flops/turns.

Low SPR ratio river spots are not that common, but they do occur in 3-bet pots and tournaments (low SPR already at the start of the hand) a high amount of the time. Arguably, high SPR river spots are just as interesting, since the optimal strategy is more complex, when raise and re-raise are part of the game tree.

It's pretty unreasonable from my point of view, if anyone play like this, the game won't last long. In a few rounds that player will lost all of his/her chips.

You correctly point out the higher risk of ruin in these situations - players lose all their chips on the river all the time, despite playing optimally with equilibrium strategies!

Since the pot can grow with each street of betting, and is thus potentially the largest when playing the river, the lower frequency of playing a river is balanced by their high influence. Studying river with TexasSolver should be as important as flop and turn.

It would be amazing if saving river strategies becomes possible with the next version. This project is great 👍

bupticybee commented 2 years ago

From a game theoretical/computational point of view, figuring out an exact river solution (given full information on both players ranges) is an easy problem.

However, when it comes to gameplay, certain aspects are different when comparing river decision making to flops/turns.

  • No more cards are being dealt. The worse hand can win the pot only by bluffing.
  • In general, your exact combination of cards has the most impact on the river. Consider 3-to-a-flush boards and holding AA for example. Having the ace completing the flush usually influences the optimal strategy significantly, making larger bets with those combinations of AA a more frequent choice.

Low SPR ratio river spots are not that common, but they do occur in 3-bet pots and tournaments (low SPR already at the start of the hand) a high amount of the time. Arguably, high SPR river spots are just as interesting, since the optimal strategy is more complex, when raise and re-raise are part of the game tree.

It's pretty unreasonable from my point of view, if anyone play like this, the game won't last long. In a few rounds that player will lost all of his/her chips.

You correctly point out the higher risk of ruin in these situations - players lose all their chips on the river all the time, despite playing optimally with equilibrium strategies!

Since the pot can grow with each street of betting, and is thus potentially the largest when playing the river, the lower frequency of playing a river is balanced by their high influence. Studying river with TexasSolver should be as important as flop and turn.

It would be amazing if saving river strategies becomes possible with the next version. This project is great 👍

I see your point, let me try conclude :

  1. low SPR rivers are rare but still exists.
  2. low frequency are balanced with high value
  3. studying river is important, and is a must for TexasSolver

Here are my plan for this specific problem:

  1. In the gui version that comes soon I will make visulization for each round, that will make the study of river strategy doable.
  2. But you still can't save river efficiently even with the upcoming gui version, that will be something to except on the version after that.
  3. The reason now I don't suggest to save strategy to river is mainly because json is not suitable to save large strategys. I will seek to create my own format in the next version or the version after that.
mix16atpitt commented 2 years ago

Saving ALL River strategies starting from Flop is not necessary at all. One can easily solve River by configuring all the details starting from River, that is: Given all the information on Flop and Turn, one can estimate the ranges for both players starting from River. If you want to estimate how your Flop/Turn decisions and the upcoming cards will affect your River decisions, try to narrow down the ranges for both players after each decision has been made for each line and repeat backtracking the line if needed. In one word, you don't have to SAVE ALL River strategies, you can "VIEW" them in one session and evaluate them by traversing all the branches.