I'm making a summary of different ways to do LMR based on remaining depth and move count, and it seems that there are several ways to do it in use. I'm wondering what the experience using these different forms is.
Basically, old descriptions say to reduce by 1 ply moves that are later than the first three or four, independent of depth, excepting some moves (good captures, evasions). Let's call this constant.
Another approach I have seen, as used by Senpai, increases the reduction linearly with move count, beyond a certain depth. Let's call this linear in count.
Other approaches reduce more with larger remaining depth. I think it's important here that the growth with depth is sub-linear, but I have no solid evidence for this. I have seen two approaches.
Fruit reloaded uses sqrt(depth-1) + sqrt(count-1). Let's call this square root.
Finally, Stockfish uses something of the form log(depth)*log(count). Let's call this double log product.
An alternative I haven't really seen has the form log(depth*count), but my impression (from a few testing positions, so take with salt) is that this rises too steeply with depth. Something like log(depth*count**2) seems to perform better. Let's call this logarithmic.
All of these expressions have different overall scaling factors to control the rate at which reductions increase. Are there other common approaches I have missed, or things that are known to work better than others (I get that the details depend a lot on move ordering and other tree-shaping techniques)?
LMR prescription
Moderators: hgm, Rebel, chrisw
-
- Posts: 893
- Joined: Mon Jan 15, 2007 11:23 am
- Location: Warsza
Re: LMR prescription
You might want to add two step approach: don't reduce up to move n, reduce by one up to move n1, then reduce by two.
Also, Fruit Reloaded approach is really unique - if I remember correctly, it also controls late move pruning, applying it if reduction > depth.
Also, Fruit Reloaded approach is really unique - if I remember correctly, it also controls late move pruning, applying it if reduction > depth.
Pawel Koziol
http://www.pkoziol.cal24.pl/rodent/rodent.htm
http://www.pkoziol.cal24.pl/rodent/rodent.htm
-
- Posts: 3196
- Joined: Fri May 26, 2006 3:00 am
- Location: WY, USA
- Full name: Michael Sherwin
Re: LMR prescription
New in Romichess.
Code: Select all
s32 m = histTblg[fig][fs][ts];
s32 n = histTbln[fig][fs][ts];
if(n > 49 && m/n < 12) {
reduce += (int)(1.0 + sqrt(sqrt(depth) * sqrt(count)) / (log(m/n+1)+1));
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: LMR prescription
This is the way of calculating the base lmr array in Andscacs. Is a bit strange, but works well. Is the result of tens of trials and error.
Anyway it can be greatly modified depending on a lot of things before usage.
Anyway it can be greatly modified depending on a lot of things before usage.
Code: Select all
int p, j;
double idx;
for (p = 1; p < 64; p++) {
idx = 2 + 8 / (float)p;
for (j = 0; j < maxjugadeslmr; j++) {
reduccio_lmr[p][j] = 1 + (j >= idx) + (j >= 4 * idx) + (j >= 8 * idx) + (p > 8) + (p > 15);
}
reduccio_lmr[p][0] = 0;
reduccio_lmr[p][1] = 0;
if (reduccio_lmr[p][2] > 1)
reduccio_lmr[p][1] = 1;
}
Daniel José - http://www.andscacs.com
-
- Posts: 2929
- Joined: Sat Jan 22, 2011 12:42 am
- Location: NL
Re: LMR prescription
Some plots (I've added the functional form of Romichess, I'll do Andscacs later):
What strikes me is that Senpai and Fruit Reloaded are very agressive when it comes to reductions (Romichess even more so; I used 12 for the ratio m/n, for smaller ratios the reduction is larger) and Stockfish is a lot more conservative (perhaps going somewhat against its reputation). What is interesting about the Stockfish approach is that it will not apply reductions at all at depth 1 (makes sense, of course), which the other approaches do.
What strikes me is that Senpai and Fruit Reloaded are very agressive when it comes to reductions (Romichess even more so; I used 12 for the ratio m/n, for smaller ratios the reduction is larger) and Stockfish is a lot more conservative (perhaps going somewhat against its reputation). What is interesting about the Stockfish approach is that it will not apply reductions at all at depth 1 (makes sense, of course), which the other approaches do.
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: LMR prescription
Reductions are cumulative in each ply, so a reduction of for example 5 is already very agressive. A reduction of 10 or 15 is like saying you don't want to analyze the position, unless is used in a non cumulative way.Evert wrote: ...and Stockfish is a lot more conservative (perhaps going somewhat against its reputation)
Daniel José - http://www.andscacs.com
-
- Posts: 276
- Joined: Sat Mar 04, 2017 12:24 pm
- Location: Hungary
Re: LMR prescription
It depends on many things. (Move ordering, dangerous move)
If something works well in the end game (especially in the pawn endgame), then it will probably work well in the middle game as well. But this is just my opinion.
Senpai LMR work me fine in middle game, but not in the endgame.
The older Stockfish formula is very good in the endgame and in the middle game as well. (double log product.)
The difference is around ~10 elo for me.
I need more tests.
If something works well in the end game (especially in the pawn endgame), then it will probably work well in the middle game as well. But this is just my opinion.
Senpai LMR work me fine in middle game, but not in the endgame.
The older Stockfish formula is very good in the endgame and in the middle game as well. (double log product.)
The difference is around ~10 elo for me.
I need more tests.
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: LMR prescription
Also very important, the engine goes deeper faster, not by reducing more, but by finding better moves quicker. Aggressive reductions that contempt moves that later will be good, increase a lot the number of nodes needed when are found to be good, as the engine finds a lot of contradictions or search instability that make it slower.
So the equilibrium between evaluation and reductions is critical.
So the equilibrium between evaluation and reductions is critical.
Daniel José - http://www.andscacs.com
-
- Posts: 3196
- Joined: Fri May 26, 2006 3:00 am
- Location: WY, USA
- Full name: Michael Sherwin
Re: LMR prescription
Something is wrong with the graph for Romi's formula. A maximum possible example only yields a value of about 8.
reduce += (int)(1.0 + sqrt(sqrt(depth) * sqrt(count)) / (log(m/n+1)+1));
1 + sqrt(sqrt(36) * sqrt(100)) / 1
1 + sqrt(6 * 10)
1 + 7
8
reduce += (int)(1.0 + sqrt(sqrt(depth) * sqrt(count)) / (log(m/n+1)+1));
1 + sqrt(sqrt(36) * sqrt(100)) / 1
1 + sqrt(6 * 10)
1 + 7
8
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through