What would be the most direct way to influence SF pruning?
Moderators: hgm, Dann Corbit, Harvey Williamson
-
Ozymandias
- Posts: 1529
- Joined: Sun Oct 25, 2009 2:30 am
What would be the most direct way to influence SF pruning?
In absence of an UCI parameter, where in the code, should I look for the most relevant section? From what I can understand, it's disseminated throughout the search.cpp file. Of all those bits and pieces, which one has a larger impact on whether SF prunes more or less?
-
Eelco de Groot
- Posts: 4557
- Joined: Sun Mar 12, 2006 2:40 am
- Full name:
Re: What would be the most direct way to influence SF prunin
Hello,
I think this is difficult to answer becayse as you say there are so many sections all influencing the width of the search in some way. Can you say a bit more about what you want to do, make Stockfish prune more, or less or just in specific types of positions or a version that prunes similarly to a less selective program etc.
The sections are reasonably modular and most have simple comments about what they do, so you could just alter a few things and see if the effect is what you expected. You would learn more by doing I think. Disabling nullmove probably would have always the largest effect, in most positions, and is easy to achieve.
Been away from the forum for a while, maybe I will have to skip it again for a week or so. No idea what has been happening in the world really, reading no newspapers etc.
A bit like Robinson Crusoe but he never had Internet and most things did not happen quite as quickly in those days.
Regards, Eelco
I think this is difficult to answer becayse as you say there are so many sections all influencing the width of the search in some way. Can you say a bit more about what you want to do, make Stockfish prune more, or less or just in specific types of positions or a version that prunes similarly to a less selective program etc.
The sections are reasonably modular and most have simple comments about what they do, so you could just alter a few things and see if the effect is what you expected. You would learn more by doing I think. Disabling nullmove probably would have always the largest effect, in most positions, and is easy to achieve.
Been away from the forum for a while, maybe I will have to skip it again for a week or so. No idea what has been happening in the world really, reading no newspapers etc.
Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
-
Ozymandias
- Posts: 1529
- Joined: Sun Oct 25, 2009 2:30 am
Re: What would be the most direct way to influence SF prunin
I'd like it to prune less, in general.
Disabling a portion of the code probably isn't what I want. More like modifying some value, so I can tweak it, until it prunes as much as I'd like.
Disabling a portion of the code probably isn't what I want. More like modifying some value, so I can tweak it, until it prunes as much as I'd like.
-
kbhearn
- Posts: 411
- Joined: Thu Dec 30, 2010 4:48 am
Re: What would be the most direct way to influence SF prunin
tweaking the values for LMR is probably what you want for something that will just generally make the tree wider/narrower. There's probably a fairly wide range of values with not much strength difference so you'll probably be making the engine weaker but not by much.
-
Ozymandias
- Posts: 1529
- Joined: Sun Oct 25, 2009 2:30 am
Re: What would be the most direct way to influence SF prunin
Would this be a good place to start?:
(Lines 1009 to 1011 from the last search.cpp)
Code: Select all
if ( depth >= 3 * ONE_PLY
&& moveCount > 1
&& !captureOrPromotion)
-
Eelco de Groot
- Posts: 4557
- Joined: Sun Mar 12, 2006 2:40 am
- Full name:
Re: What would be the most direct way to influence SF prunin
I think that is what Kevin was suggesting, but to clarify then you would want to make the reduction less, which is a few lines further line 1013
and the formula for the reduction you find earlier, line 75 for the template and then the calculation of r in line 188
making r smaller will decrease the selectivity in general, but r is further modified line 195 by looking if the evaluation function is equal or increasing compared to the next previous ply, the first ply upwards that had the same side to move.
This reduction you could of course also modify.
Code: Select all
Depth r = reduction<PvNode>(improving, depth, moveCount);Code: Select all
double r = log(d) * log(mc) / 2;Code: Select all
// Increase reduction for non-PV nodes when eval is not improving
if (!imp && Reductions[!PV][imp][d][mc] >= 2 * ONE_PLY)
Reductions[!PV][imp][d][mc] += ONE_PLY;Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
-
Ozymandias
- Posts: 1529
- Joined: Sun Oct 25, 2009 2:30 am
Re: What would be the most direct way to influence SF prunin
Ok, thanks, I'll try that. This should be fun.