|
||||
Title: Bot Performance Post by speek on Jul 22nd, 2010, 8:31am I hesitate to ask because I don't want to start a bragging contest, but I've been working on my Arimaa game processing (it's not a bot yet, I'm just getting the mechanics down), and I'm basically wondering if I'm in the ballpark performance-wise. I'm disappointed with my results so far compared with previous efforts with a chess engine, but then I guess that's what happens when there are on average 17,000 moves per ply vs 30-40. But it still seems I must be doing something wrong. For generating all possible unique moves for a given position, I'm only processing about 500 positions per second. With chess, this number would be more like 150,000 (or more, that was 3-4 years ago). How do bots perform on average with arimaa and generating legal and unique move lists (not steps, but rather, full moves)? |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 22nd, 2010, 8:52am I haven't benchmarked the specific number you ask for, but it seems to be more or less the same as the number of nodes where a position is evaluated, i.e. a leaf node in the search tree (on a bot with no quiescence search like mine). With that assumption, I just benchmarked the number of calls to evaluate and I'm getting a number of 280,000 per second. Considering that the evaluation function is taking up about 50% of the run time, the speed would be doubled if evaluation came for free (i.e. if the bot spent time mostly on move generation and other search-related stuff). So for me, a very rough answer would be 560,000 per second. This was on a 2.27 GHz 32-bit system with one core, it would probably go up by 1.7-2x on a 64-bit system. What programming language are you using? |
||||
Title: Re: Bot Performance Post by speek on Jul 22nd, 2010, 9:04am If I understand you right, you're saying that your bot is generating and calling evaluation on 280,000 positions/second. In my case, I'm saying I'm generating all the legal full moves of a given position - 500/second, which, if average number of legal moves from a given position is around 17,000 that means I'd be calling evaluation 500 * 17,000, which is 8,500,000 evaluations/second. Of course, my currently non-existent evaluation function is extremely fast, but this does not seem right either. However, it does suggest I'm in the ballpark. That is, if I understand you right, which I'm really not sure about :) I'm using Java, btw. |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 22nd, 2010, 9:31am Oh, I had misread what you said. I don't have an optimized function for generating all unique moves from a position, but from a quick test it seems my bot's doing about 250 positions per second (on a position with only 1263 unique moves). So I'd say your code may actually be faster than mine, and in any case you're definitely in good shape (at least when compared to me). |
||||
Title: Re: Bot Performance Post by speek on Jul 22nd, 2010, 9:45am Thanks, I just felt the need for a sanity check - it's so different from chess just because of the sheer size of the search tree. Also, I read in the forum about bots that search 2-ply and I wondered, do they mean a full-width 2-ply? How do they do that? That would be 100+ million positions. |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 22nd, 2010, 10:01am on 07/22/10 at 09:45:26, speek wrote:
The good part is that you rarely have to generate all the unique moves from a position, either by using step-by-step search, or by generating moves in batches instead of all at once (I think almost everyone is using the former solution). Whenever there's a cutoff in the search, you will avoid generating a lot of moves below that node. A full-width 2-ply search is not hard to do once you have alpha-beta implemented. Transposition tables help a lot too if you're doing step-by-step search (in order to eliminate repeated positions). It takes just a few seconds even in bad cases on my bot (on a faster system than the one I used for the tests above). |
||||
Title: Re: Bot Performance Post by speek on Jul 22nd, 2010, 10:31am Well, I do eliminate duplicate positions as they arise during the step-by-step search process, so I don't even allow those steps to make it into my step storage buffer. As for alpha-beta, I'm not there yet, as I am just generating the legal moves of a single position and trying to optimize my memory and cpu usage while doing so. I noticed some talk about doing evaluations and alpha-beta cutoffs on a step-by-step basis as opposed to a move-by-move basis. I was automatically going for move-by-move before I read that. Most bots do it step-by-step though, right? |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 22nd, 2010, 10:42am Yes, most bots do search step-by-step (including cutoffs), which is simpler to program efficiently. An efficient move-based search would have to be very careful not to waste too much time generating moves that will never be looked at. Doing it step-by-step, at most you'll waste a few dozen generated steps when a cutoff happens. Then there are other potential reasons to do it step-by-step, for example many people have found that it pays off to do iterative deepening on a step-by-step basis. For this reason, if I were you I wouldn't worry too much about optimizing a function which generates all unique moves from a position - you probably will end up not using it in the time intensive parts of your bot. For me, the important parts to focus on were step generation and generating a resulting game state from a single step. |
||||
Title: Re: Bot Performance Post by Fritzlein on Jul 22nd, 2010, 1:47pm on 07/22/10 at 10:42:55, rbarreira wrote:
Note, however, that there can be no alpha-beta cutoffs in the first ply, i.e. the first four steps. Only after the side to move changes does an alpha-beta cutoff even make sense. So searching step-by-step creates no payoff in the first ply. For later plies, my understanding is that better move ordering can make alpha-beta searching hugely more efficient, so iterating by steps is worth it for the move-ordering alone. Furthermore, if the branching factor is 2^14, each additional ply of search depth should take 2^7 times longer than the previous. How often are you going to have over a hundred times longer to think about another ply? Iterating just one step deeper, however, gives you a real chance of completing that iteration. So while step-by-step search gives you nothing on the first ply, it can pay huge dividends on later ply. Quote:
By the way, how much time do you spend in move (or step) generation? I'm guessing it is 5-10%. |
||||
Title: Re: Bot Performance Post by speek on Jul 22nd, 2010, 2:53pm rbarreira mentioned he spends about 50% of his time in evaluation. So I would guess at least 25% of the time is in move/step generation, and probably more. |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 22nd, 2010, 9:47pm on 07/22/10 at 13:47:43, Fritzlein wrote:
A bit less than 5%, after all the optimizations. 10%+ on transposition table stuff (looks a bit high, then again it's accessing RAM so...). 15% on search. 15% on move making. (incrementally updates some stuff to help the evaluation too) 40%+ on evaluation. Roughly. |
||||
Title: Re: Bot Performance Post by speek on Jul 23rd, 2010, 7:10am What does "search" refer to? |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 23rd, 2010, 9:23am Things like checking the repetition/mandatory board change rules, the killer-moves heuristic, checking for terminal states, the alpha-beta algorithm itself etc. |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 26th, 2010, 4:30am I was thinking about this thread the other day and realized that the reason for my apparently bad performance result - considering the position had so few legal moves - should be because I don't check for repeated states except at the leaf nodes (in the move generation that is). So for example when generating the 4 step moves, redundant permutations of the first three steps will all live on to generate the last step. For a position with many unique moves it could effectively be generating millions of redundant permutations. Did you optimize for this in your code? I don't plan to since I don't use this code in the search as I said earlier. But if you did, you might be able to remove that optimization if you're still interested in knowing where your step generation's performance stands. Otherwise, I think the only easy way to compare performance in alpha-beta bots is really the number of nodes per second in an actual search. And even that has its limits, due to heavier/lighter eval, etc. |
||||
Title: Re: Bot Performance Post by speek on Jul 26th, 2010, 9:18am I do weed out repeated positions as they arise in the step search to avoid generating steps that are redundant. By doing so, it generates about 1.8 million unique positions/sec. I am happy with that, as that little amount of time is going to get swamped by evaluation time. I did a little test for a simple eval function, and it dropped that number right down to less than 100,000/sec. Thank you for your help, btw. |
||||
Title: Re: Bot Performance Post by jdb on Jul 26th, 2010, 10:01am Here is the test case from clueless for the routine to generate all unique moves for a position. The ones with 300K legal moves take around .25 sec each on my machine. The position text is the same as the one used by the arimaa server. To get something human readable replace "%13" with "/n". Code:
|
||||
Title: Re: Bot Performance Post by speek on Jul 26th, 2010, 10:52am Great, thanks! |
||||
Title: Re: Bot Performance Post by speek on Jul 27th, 2010, 9:13pm Regarding the position with just the elephant 19 legal moves for silver - I only see 18 legal moves. Not changing the position isn't a legal move, right? What am I missing? |
||||
Title: Re: Bot Performance Post by Fritzlein on Jul 27th, 2010, 9:40pm on 07/27/10 at 21:13:37, speek wrote:
Suicide is legal. By my count the elephant can reach 18 different squares or go bye-bye for 19 total legal moves. |
||||
Title: Re: Bot Performance Post by speek on Jul 27th, 2010, 10:23pm That's how I get to 18. The possible moves are: a6,a7,a8 3 b5,b6,b7,b8 4 c6,c7 2 d6,d7,d8 3 e6,e7,e8 3 f7,f8 2 g8 1 total = 18 Which square did I miss? |
||||
Title: Re: Bot Performance Post by Fritzlein on Jul 27th, 2010, 10:45pm on 07/27/10 at 22:23:21, speek wrote:
You missed d5. |
||||
Title: Re: Bot Performance Post by speek on Jul 28th, 2010, 8:35am I have the gold elephant at d5. A lot of the pieces appear "in between" columns when I replace %13 with \n. Probably this is why my code is often off by a few tens of moves on some of these positions. Any pointers on how to properly read these charts? |
||||
Title: Re: Bot Performance Post by Fritzlein on Jul 28th, 2010, 9:26am The way text is displayed by the forum collapses anything more than five spaces down to five spaces. I couldn't get the board to display properly from cutting and pasting JDB's post. I had to quote JDB's post, and then cut and paste from the window where I was editing my supposed reply to his message. Then I had the right number of spaces. |
||||
Title: Re: Bot Performance Post by jdb on Jul 28th, 2010, 9:33am on 07/28/10 at 08:35:36, speek wrote:
String readable_text = pos_text.replaceAll("%13","\n"); System.out.println(readable_text); Should print out the position in a nice format. |
||||
Title: Re: Bot Performance Post by speek on Jul 28th, 2010, 9:34am on 07/28/10 at 09:26:00, Fritzlein wrote:
Ah, thanks for the secret! |
||||
Title: Re: Bot Performance Post by jdb on Jul 28th, 2010, 9:35am on 07/28/10 at 09:26:00, Fritzlein wrote:
I didn't know about the 5 space thing. Is there a way for me to fix that on my end? |
||||
Title: Re: Bot Performance Post by Fritzlein on Jul 28th, 2010, 9:44am on 07/28/10 at 09:35:15, jdb wrote:
Not that I know of. When I use non-proportional font to make tables, I have to put in periods to stop the spaces from collapsing and to make it display correctly in the forum. >:( For example: Elephant File 2005 2006 2007 2008 2009 2010 ------------- ---- ---- ---- ---- ---- ---- d . . . 98.1 79.5 85.3 89.9 90.0 81.6 c . . . . 13.7 9.4 9.5 10.0 13.2 b . . . 1.9 6.3 5.3 . . 5.2 a . . . . 0.5 . 0.6 Rabbits Forward 2005 2006 2007 2008 2009 2010 --------------- ---- ---- ---- ---- ---- ---- ah . . 55.6 56.3 76.5 59.5 57.1 52.4 a . . . 2.5 15.3 4.1 0.6 5.0 12.8 none . . 14.4 22.6 10.0 6.0 2.1 10.8 cf . . 23.1 . . 8.3 1.4 6.6 ac . . . . . 0.6 . 5.2 c . . . 3.1 . . . . 3.8 acfh . . 0.6 . . 14.9 22.1 3.5 af . . . . . . 0.7 2.1 ach . . . . . . 1.4 1.0 acf . . . . . . . 1.0 ad . . . . . . . 0.3 ce . . . . . . . 0.3 adh . . . 2.6 4.1 10.1 10.0 adeh . . . 2.6 4.1 ag . . . 0.5 1.2 abgh . . 0.6 Setup Balance 2005 2006 2007 2008 2009 2010 ------------- ---- ---- ---- ---- ---- ---- Symmetrical . 56.9 50.5 54.1 50.0 35.7 20.1 Balanced . 22.5 30.0 34.1 42.3 42.9 31.2 Unbalanced . 20.6 19.5 11.8 7.7 20.7 48.6 Gold Move 2w 2005 2006 2007 2008 2009 2010 ------------ ---- ---- ---- ---- ---- ---- E up 4 . . 68.8 26.3 25.9 13.1 20.0 22.9 E up 3 over 1 11.3 11.6 1.2 3.6 14.3 9.7 E up 3; X up 1 6.3 41.1 40.0 45.2 45.7 33.3 E up 2; X,Y up 1 3.8 10.5 23.5 27.4 17.1 21.5 E, X, Y, Z up 1 3.8 3.2 . 1.2 . 4.2 Other . . 6.3 7.4 9.4 9.5 2.8 8.3 |
||||
Title: Re: Bot Performance Post by speek on Jul 28th, 2010, 9:55am Ok, I am mostly getting the right answers. Positions 2 and 3 for instance, spot on. Position 1, off by 1??? But, I am using two different hashes of the board to key unique positions, so it's entirely possible two different positions have the same two hashes once in a great while. |
||||
Title: Re: Bot Performance Post by rbarreira on Jul 28th, 2010, 9:58am on 07/28/10 at 09:55:18, speek wrote:
As long as your zobrist keys have enough bits (64 is more than enough) and they're random enough it is more likely to be struck by lightning than finding a hash collision by just looking at a few thousand positions. |
||||
Title: Re: Bot Performance Post by jdb on Jul 28th, 2010, 10:25am on 07/28/10 at 09:44:57, Fritzlein wrote:
Ok thanks for the info. Maybe there is a setting in the forum software Omar can set? |
||||
Title: Re: Bot Performance Post by jdb on Jul 28th, 2010, 10:30am on 07/28/10 at 09:55:18, speek wrote:
If you want, I can post some positions with reduced material and their move count. |
||||
Title: Re: Bot Performance Post by speek on Jul 28th, 2010, 10:39am I think I'm good. I changed my second hash algorithm slightly, and got the right answer. I did work up from the 'smaller' positions that are there. Right now, of the 4 positions I am testing, I'm correct on all. Sadly, I had to remove my duplicates detection during step generation and only do it at the end, so my code is pretty slow :-( |
||||
Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1! YaBB © 2000-2003. All Rights Reserved. |