chess:programming:evaluation_hash_table
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
chess:programming:evaluation_hash_table [2022/01/06 19:59] – peter | chess:programming:evaluation_hash_table [2022/01/06 21:46] (current) – peter | ||
---|---|---|---|
Line 24: | Line 24: | ||
The zobrist key for the pawns will have to be updated every time a pawn is moved, and also the current pawn evaluation uses the king positions as well. | The zobrist key for the pawns will have to be updated every time a pawn is moved, and also the current pawn evaluation uses the king positions as well. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Collisions ===== | ||
+ | |||
+ | Collision = two positions that are not the same having the same hash signature. | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** An assumption is that the hash table is full of entries that do not match the position being searched. | ||
+ | |||
+ | Factors used: | ||
+ | |||
+ | * P = Probability of a collision on a given table lookup. | ||
+ | * T = Total number of table entries. | ||
+ | * p = Probability of two positions having the same hash signature (= 1/2^n , with n = number of bits in hash). | ||
+ | * N = Nodes searched per second (assume one table lookup at each node). | ||
+ | * R = Rate of collisions. | ||
+ | |||
+ | </ | ||
+ | |||
+ | Calculate the collision rate. | ||
+ | |||
+ | < | ||
+ | P = 1 - (1-p)^T | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ | |||
+ | |||
+ | The rate R of collisions is: | ||
+ | |||
+ | < | ||
+ | R = NP | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | |||
+ | For a 256K entry table, 32 bit hash code, 30K nodes/sec (i.e. T = 256000, n = 32, N = 100000/ | ||
+ | |||
+ | * R = 6 collisions/ | ||
+ | * for a 48 bit hash code: R ~ 1E-4 collisions/ | ||
+ | * for a 64 bit hash code: R ~ 1E-9 collisions/ | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | Could a 24-bit Hash be sufficient for a Pawn Hash Table? | ||
+ | |||
+ | If 24 bits are used for the hash signature, a rather high collision rate would be expected on Pawn table lookups (a few per second). | ||
+ | |||
+ | * The assumption is that entries that do not match the position being searched may break down.... so the collision rate might be less... | ||
+ | * With a 24 bit key about 1/128 times less collisions are expected, so you would get a pawn hash collision in about 1 of every 10,000 positions evaluated using a 24 bit key. | ||
+ | |||
+ | So, no, more bits would be needed. | ||
+ | |||
+ | Pawns make up about half the pieces on the board, and a little less than half the information content (because there are 2 sorts of pawns and 10 sorts of other pieces), so a guess is that about 24 to 30 bits for the pawns is the right proportion. | ||
+ | |||
+ | ---- | ||
+ | |||
chess/programming/evaluation_hash_table.1641499179.txt.gz · Last modified: 2022/01/06 19:59 by peter