ozzi7 / Poker-MCCFRM

A poker AI for NL Texas Holdem trained using Monte-Carlo Counterfactual Regret Minimization.
MIT License
85 stars 26 forks source link

Index was out of range error #4

Closed tombenj closed 4 years ago

tombenj commented 4 years ago

Happens on Trainer:

Saving to file EMDFlopHistogram.txt...
Saving turn histograms to file EMDTurnHistogram.txt
Saving to file EMDTurnHistogram.txt...
Starting Monte Carlo Counterfactual Regret Minimization (MCCFRM)...
Unhandled exception. System.AggregateException: One or more errors occurred.

(Index was outside the bounds of the array.)
 ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Poker_MCCFRM.Trainer.TraverseMCCFR(State gs, Int32 traverser, Int32 iteration) in /home/ec2-user/Poker-MCCFRM/Poker-MCCFRM/Trainer.cs:line 350
   at Poker_MCCFRM.Trainer.TraverseMCCFR(State gs, Int32 traverser, Int32 iteration) in /home/ec2-user/Poker-MCCFRM/Poker-MCCFRM/Trainer.cs:line 332
   at Poker_MCCFRM.Trainer.TraverseMCCFR(State gs, Int32 traverser, Int32 iteration) in /home/ec2-user/Poker-MCCFRM/Poker-MCCFRM/Trainer.cs:line 350
   at Poker_MCCFRM.Trainer.TraverseMCCFR(State gs, Int32 traverser, Int32 iteration) in /home/ec2-user/Poker-MCCFRM/Poker-MCCFRM/Trainer.cs:line 332
   at Poker_MCCFRM.Trainer.TraverseMCCFR(State gs, Int32 traverser, Int32 iteration) in /home/ec2-user/Poker-MCCFRM/Poker-MCCFRM/Trainer.cs:line 319
   at Poker_MCCFRM.Trainer.TraverseMCCFR(Int32 traverser, Int32 iteration) in /home/ec2-user/Poker-MCCFRM/Poker-MCCFRM/Trainer.cs:line 77
   at Poker_MCCFRM.Program.<>c__DisplayClass3_0.<Train>b__0(Int32 index) in /home/ec2-user/Poker-MCCFRM/Poker-MCCFRM/Program.cs:line 141
   at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
   at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
--- End of stack trace from previous location where exception was thrown ---
tombenj commented 4 years ago

These are the files that were created and present in the directory. The only thing that might be sketchy is EMDFlopTable.txt of size 5mb. But the log output wasn't showing any errors when producing it:

-rwxrw-r-- 1 ec2-user ec2-user   16K May  1  2017 Combinatorics.dll
-rw-r--r-- 1 root     root      246M Feb  7 17:44 EMDFlopHistogram.txt
-rw-r--r-- 1 root     root      5.0M Feb  7 17:44 EMDFlopTable.txt
-rw-r--r-- 1 root     root       680 Feb  3 21:07 EMDTable_temp_2786911.txt
-rw-r--r-- 1 root     root       54M Feb  7 02:45 EMDTable_temp_9493718.txt
-rw-r--r-- 1 root     root      2.7G Feb  7 17:45 EMDTurnHistogram.txt
-rw-r--r-- 1 root     root       54M Feb  7 17:44 EMDTurnTable.txt
-rwxrw-r-- 1 ec2-user ec2-user  190K Nov 18 23:01 FASTER.core.dll
-rw-r--r-- 1 root     root       15G Feb  3 16:03 HandValueTable.txt
-rw-r--r-- 1 root     root       704 Feb  4 07:50 OCHSOpponentClusters.txt
-rw-r--r-- 1 root     root      470M Feb  6 08:56 OCHSRiverClusters.txt
-rw-r--r-- 1 root     root      7.4G Feb  4 07:51 OCHSRiverHistograms.txt
-rwxr-xr-x 1 ec2-user ec2-user   85K Feb  7 19:39 Poker-MCCFRM
-rw-rw-r-- 1 ec2-user ec2-user   50K Feb  6 12:54 Poker-MCCFRM.deps.json
-rw-rw-r-- 1 ec2-user ec2-user   95K Feb  7 19:39 Poker-MCCFRM.dll
-rw-rw-r-- 1 ec2-user ec2-user   55K Feb  7 19:39 Poker-MCCFRM.pdb
-rw-rw-r-- 1 ec2-user ec2-user   139 Feb  6 12:54 Poker-MCCFRM.runtimeconfig.dev.json
-rw-rw-r-- 1 ec2-user ec2-user   146 Feb  6 12:54 Poker-MCCFRM.runtimeconfig.json
-rw-rw-r-- 1 ec2-user ec2-user   20K Feb  6 12:25 screenlog.0
-rwxrw-r-- 1 ec2-user ec2-user  202K Sep 25 21:47 System.Interactive.Async.dll
-rwxrw-r-- 1 ec2-user ec2-user 1019K Sep 25 21:47 System.Linq.Async.dll
-rwxrw-r-- 1 ec2-user ec2-user   26K Jun 13  2016 System.ServiceModel.dll
UYousafzai commented 4 years ago

did you ever find out what the issue on this particular bug was? :)

tombenj commented 4 years ago

No, I'm still stuck on it. Maybe @ozzi7 has thoughts?

UYousafzai commented 4 years ago

hey @ozzi7 , would love to get your input on this. thank you

vanfactory commented 4 years ago

I'm also in the latest commit and am stuck on this. The trainer doesn't start because of this issue. I tried to revert to earlier commits but the code change is too large and won't work with the files generated in the latest one. Would appreciate any update from @ozzi7

ozzi7 commented 4 years ago

Hello everyone! I can look into this later, maybe next month. Last time I executed this I did not have any problems. If I remember correctly (and this is a big if, it's been a while) this error could arise if there is a disparity between the methods GetValidActions() and CreateChildren() of State.cs in the number of valid actions they find. GetValidActions() is only there for efficiency reasons. So perhaps a temporary fix would be to change the GetValidActionsCount() method to always create the children and count them instead of calling GetValidActions(). But the disparity also shows that one of the two methods is wrong. The game state generation should be re-implemented and I did not find the time yet.

ozzi7 commented 4 years ago

The list of possible raises in Globals.cs must contain three elements currently.