About eval function types

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

About eval function types

Post by Kempelen »

Hello,

I am near to release Rodin 7.0. While that happens, I am rethinking the future development ideas to continue on next releases, and one of them that round my head is the eval function type. I want to make a survey before making hundreads of changes.

There are two types of eval function: 1) use, at the first of the function call, a function to precompute attacks vectors that then are used along all the eval function: see weak attacked pawns, attack squares around king, counting space, etc.... and 2) function that does not computer attack vectors at first, but only mobility/king attack when needed; there is no concept of 'counting attacks on a square' or similars. If I don't remember bad, one of the first type app is Stockfish, and one of the second type is Crafty. The first fovour detailed eval, the second fovour speed.

My question is simple: although I know there is not math or true facts and both types could be similar, what is your opinion about what of those two types of eval are more used but top strong engines? what is the most promising? does any of them probe over time that is the best prefered choice?

My engine is type two and I am thinking about remodeling the whole eval function to a type one, but before that I want to hear opinions and tips about implementations.

regards,
Fermin
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
Henk
Posts: 7218
Joined: Mon May 27, 2013 10:31 am

Re: About eval function types

Post by Henk »

Kempelen wrote:Hello,

I am near to release Rodin 7.0. While that happens, I am rethinking the future development ideas to continue on next releases, and one of them that round my head is the eval function type. I want to make a survey before making hundreads of changes.

There are two types of eval function: 1) use, at the first of the function call, a function to precompute attacks vectors that then are used along all the eval function: see weak attacked pawns, attack squares around king, counting space, etc.... and 2) function that does not computer attack vectors at first, but only mobility/king attack when needed; there is no concept of 'counting attacks on a square' or similars. If I don't remember bad, one of the first type app is Stockfish, and one of the second type is Crafty. The first fovour detailed eval, the second fovour speed.

My question is simple: although I know there is not math or true facts and both types could be similar, what is your opinion about what of those two types of eval are more used but top strong engines? what is the most promising? does any of them probe over time that is the best prefered choice?

My engine is type two and I am thinking about remodeling the whole eval function to a type one, but before that I want to hear opinions and tips about implementations.

regards,
Fermin
I think computing mobility is expensive. Attack vectors may be less expensive if its only a few bitmap operations, I don't know. A very good slow evaluation function applied mainly at leaf nodes makes chess programs play worse, doesn't it ?
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: About eval function types

Post by Ferdy »

I use type 1, this is promising as you can use the info to guide the search, when to prune, how many depths to reduce or perhaps extend.
For example you might be ahead in material and overall static eval, but the area where your king is is somewhat under heavy piece attacks
from opponent, the search might be told not to prune or reduce at this position.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: About eval function types

Post by bob »

Kempelen wrote:Hello,

I am near to release Rodin 7.0. While that happens, I am rethinking the future development ideas to continue on next releases, and one of them that round my head is the eval function type. I want to make a survey before making hundreads of changes.

There are two types of eval function: 1) use, at the first of the function call, a function to precompute attacks vectors that then are used along all the eval function: see weak attacked pawns, attack squares around king, counting space, etc.... and 2) function that does not computer attack vectors at first, but only mobility/king attack when needed; there is no concept of 'counting attacks on a square' or similars. If I don't remember bad, one of the first type app is Stockfish, and one of the second type is Crafty. The first fovour detailed eval, the second fovour speed.

My question is simple: although I know there is not math or true facts and both types could be similar, what is your opinion about what of those two types of eval are more used but top strong engines? what is the most promising? does any of them probe over time that is the best prefered choice?

My engine is type two and I am thinking about remodeling the whole eval function to a type one, but before that I want to hear opinions and tips about implementations.

regards,
Fermin
Crafty does both. It does delay some things until the last minute, hoping to avoid doing them. But it computes pawn attacks, weak pawns and such up front, and uses that information at various other places later. I don't consider ANY of what I do to be a "sacrifice accuracy for speed" however. I consider everything to be a "do only what is necessary."
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: About eval function types

Post by Steve Maughan »

Maverick does type 1 and is still quite fast (4 Mbps on a i7 single core). I think type 1 will be easier to add knowledge to, whereas I feel type 2 is premature optimization (at least for Maverick which is quite young).

Steve
http://www.chessprogramming.net - Maverick Chess Engine
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: About eval function types

Post by lucasart »

Steve Maughan wrote:Maverick does type 1 and is still quite fast (4 Mbps on a i7 single core). I think type 1 will be easier to add knowledge to, whereas I feel type 2 is premature optimization (at least for Maverick which is quite young).

Steve
Totally agree. Same for DiscoCheck.

That being said, there is a whole range of possibilities within "type 1". What Fermin was initially talking about is an array that counts the number of attacks to each square. This is obviously out of question and would be far too costly. You need something more loop-less and bitboard oritented.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.