for those of you using the history heuristic:
when do you reset the counts?
If you clear it too often, it loses its effectiveness.
If you clear it too rarely, it loses its effectiveness (and you risk overflow as you increase the values).
I presently reset the history table counts to 0 before each iteration of iterative deepening. [Clearing it between real moves on the board seems too rare to me.]
Anyone else do differently?
History Heuristic - when to reset counts
Moderator: Ras
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: History Heuristic - when to reset counts
I no longer use them, but there are at least a couple of ideas.AndrewShort wrote:for those of you using the history heuristic:
when do you reset the counts?
If you clear it too often, it loses its effectiveness.
If you clear it too rarely, it loses its effectiveness (and you risk overflow as you increase the values).
I presently reset the history table counts to 0 before each iteration of iterative deepening. [Clearing it between real moves on the board seems too rare to me.]
Anyone else do differently?
Every so often, divide them all by 2. This doesn't throw them away, but inactive counters trend toward zero.
Or, if when you increment a counter, it passes some magic threshold, divide all counters by 2. This keeps all counters in the range 0 to N where N is your "magic" number...
Or, do as I did and throw 'em out completely.

-
- Posts: 318
- Joined: Thu Mar 09, 2006 1:07 am
Re: History Heuristic - when to reset counts
Disclaimer: My engine is weak and my history does not work very good.AndrewShort wrote:for those of you using the history heuristic:
when do you reset the counts?
If you clear it too often, it loses its effectiveness.
If you clear it too rarely, it loses its effectiveness (and you risk overflow as you increase the values).
I presently reset the history table counts to 0 before each iteration of iterative deepening. [Clearing it between real moves on the board seems too rare to me.]
Anyone else do differently?
I reset the history table before each search. The values are increased for good moves
with dist*dist but not more than 256. I also store the maximum of all values in the table.
Whenever a value grows over a limit the whole table is scaled down.
That can happen at any time.
When I read a value from the table it is always scaled to the interval [0..256],
thanks to the maximum. At any tyme the highest entry comes back as 256.
I hoped I could use this value in expressions like
if (history < 64) prune...
or
if (history > 200 ) expand...
or even as input in complex formulars like
centidepth += history * 100 / 256 / 10 - 5
or for move ordering
move_value = material_gain + pc_sq_value + (history / 10 - 10)
That gave many possibilities for experiments and disappointment.

Harald
-
- Posts: 201
- Joined: Thu Mar 22, 2007 7:12 pm
- Location: Netherlands
Re: History Heuristic - when to reset counts
In Rotor, I multiply all entries by 0.5 each 10000 nodes.AndrewShort wrote:for those of you using the history heuristic:
when do you reset the counts?
If you clear it too often, it loses its effectiveness.
If you clear it too rarely, it loses its effectiveness (and you risk overflow as you increase the values).
I presently reset the history table counts to 0 before each iteration of iterative deepening. [Clearing it between real moves on the board seems too rare to me.]
Anyone else do differently?
History values are updated with (remaining depth) ^ 3 when a best move was found which is not a capture move.
-
- Posts: 1154
- Joined: Fri Jun 23, 2006 5:18 am
Re: History Heuristic - when to reset counts
This is a good idea. I divide by some large number (forget what, but larger than 2) when things go past a threshold. Your approach might be slightly better, not sure. Checking takes less time, but it probably gets triggered more often and dividing everything is a substantial operation.In Rotor, I multiply all entries by 0.5 each 10000 nodes.
For a long time a did nothing (besides resetting history before each search) and I don't think performance improved much when I added the "safer" code that keeps history in a reasonable range. Even in long games. And for me, history is better than no history, even without keeping them in range

-Sam
Re: History Heuristic - when to reset counts
When you say "divide them all by 2", I assume what you really mean is right shift 1 bit. Real division would be expensive...bob wrote:I no longer use them, but there are at least a couple of ideas.AndrewShort wrote:for those of you using the history heuristic:
when do you reset the counts?
If you clear it too often, it loses its effectiveness.
If you clear it too rarely, it loses its effectiveness (and you risk overflow as you increase the values).
I presently reset the history table counts to 0 before each iteration of iterative deepening. [Clearing it between real moves on the board seems too rare to me.]
Anyone else do differently?
Every so often, divide them all by 2. This doesn't throw them away, but inactive counters trend toward zero.
Or, if when you increment a counter, it passes some magic threshold, divide all counters by 2. This keeps all counters in the range 0 to N where N is your "magic" number...
Or, do as I did and throw 'em out completely.
Re: History Heuristic - when to reset counts
The compiler will allways output a right shift. But your counter should be declared as an unsigned integer to have the smallest code. If it is signed the compiler will add some 'safety' code (useless when you know that the number is not negative).
I reset the counters before a search, and I reduce the counters when they reach a rather high value (so this does not happen often).
HJ.
Code: Select all
cdq
sub eax, edx
sar eax, 1
Code: Select all
// increment the history counter on failed high
void INLINE update(const CM *cm, int depth) {
if( Capt(cm->m) )
return;
int idx = HIST_INDEX(cm->m);
good_hit[ idx ] += depth*depth;
if( good_hit[ idx ] >= 0x00100000 ) {
shift_count++;
for(int i = 0; i < HIST_SIZE ; i++ ) {
good_hit[ i ] = (good_hit[ i ] + 1) / 2;
}
}
}
-
- Posts: 620
- Joined: Fri Feb 08, 2008 10:44 am
- Location: Madrid - Spain
Re: History Heuristic - when to reset counts
I divide all history table by 4 when the max value of the table > 8191
until now it does not go bad.... but maybe I need more experimentation.
until now it does not go bad.... but maybe I need more experimentation.
-
- Posts: 3196
- Joined: Fri May 26, 2006 3:00 am
- Location: WY, USA
- Full name: Michael Sherwin
Re: History Heuristic - when to reset counts
In RomiChess I have made the history counters more dynamic by dividing any counter that exceeds 200 by 2. The history values are then expressed as a pecentage.
n = histTbln[fig][fs][ts] // n is the count
g = histTblg[fig][fs][ts] // g is the 'good' * 100
if(n > 99 && g / n < 12) reduce
n = histTbln[fig][fs][ts] // n is the count
g = histTblg[fig][fs][ts] // g is the 'good' * 100
if(n > 99 && g / n < 12) reduce
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: 373
- Joined: Wed Mar 22, 2006 10:17 am
- Location: Novi Sad, Serbia
- Full name: Karlo Balla
Re: History Heuristic - when to reset counts
Why ever reset history counter?AndrewShort wrote:for those of you using the history heuristic:
when do you reset the counts?
If you clear it too often, it loses its effectiveness.
If you clear it too rarely, it loses its effectiveness (and you risk overflow as you increase the values).
I presently reset the history table counts to 0 before each iteration of iterative deepening. [Clearing it between real moves on the board seems too rare to me.]
Anyone else do differently?
Is it possible to use 2 counters? One for every move made and one for good move. Then define goodness: g = n[good]/n[all].
Then if for example if g < 30%(0.3) reduce move
Best Regards,
Karlo Balla Jr.
Karlo Balla Jr.