Evaluation function

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

lauriet
Posts: 199
Joined: Sun Nov 03, 2013 9:32 am

Evaluation function

Post by lauriet »

Hey guys,

I recently discovered a bug (ok an amateurs mistake) in my program. The evaluation function will sometimes return a value of greater than 100 (a pawn is worth 100).
Obviously it was playing some dumb moves. Loosing pieces for a perceived positional advantage.
The eval function uses PST, mobility, doubles/backward/isolated pawns, king safety etc, etc. I have positive values for good things like mobility and negative values for bad things like doubled pawns. I was hoping that the negative values would restrain the positive values from increasing too much.
How can i make sure that in ALL combinations of positions I never exceed 100.

:?:
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Evaluation function

Post by bob »

lauriet wrote:Hey guys,

I recently discovered a bug (ok an amateurs mistake) in my program. The evaluation function will sometimes return a value of greater than 100 (a pawn is worth 100).
Obviously it was playing some dumb moves. Loosing pieces for a perceived positional advantage.
The eval function uses PST, mobility, doubles/backward/isolated pawns, king safety etc, etc. I have positive values for good things like mobility and negative values for bad things like doubled pawns. I was hoping that the negative values would restrain the positive values from increasing too much.
How can i make sure that in ALL combinations of positions I never exceed 100.

:?:
You can, but you shouldn't. You can always do the ugly

score = Max(Min(score, 100), -100);

But lots of scores SHOULD be > one pawn. King safety. Unstoppable passed pawns. Etc...
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Evaluation function

Post by lucasart »

Would be interesting to try in Stockfish. It would result in a stupidly materialistic eval.

I bet it would be a 100 elo regression, or worse.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
lauriet
Posts: 199
Joined: Sun Nov 03, 2013 9:32 am

Re: Evaluation function

Post by lauriet »

but for the hundred and one positions that should be less than one pawn...........
does everyone check all these positions so that the value < 100
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Evaluation function

Post by mar »

lauriet wrote:but for the hundred and one positions that should be less than one pawn...........
does everyone check all these positions so that the value < 100
nobody does that, it's nonsense. you need to adjust (tune) you eval weights.
easier said than done of course.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Evaluation function

Post by Sven »

lauriet wrote:but for the hundred and one positions that should be less than one pawn...........
does everyone check all these positions so that the value < 100
[D]8/8/7k/P5p1/5pKp/8/8/8 w - - 0 1
The unstoppable passer should be worth much more than two pawns in this case.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Evaluation function

Post by hgm »

There are plenty of advantages worth more than a Pawn. If you score positional advantages that are worth less than a Pawn above 100, you should simply lower their score, because then apparently you overestimated them.

There is no logic in the idea that 3 advantages each worth half a Pawn should not add up to 1.5 Pawn. In fact if there is anything non-additive there, it would be that advantages amplify each other, rather than saturate.
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Evaluation function

Post by Daniel Anulliero »

I think the danger is in a false "> 100 " positionnal advantage , returned by an evaluation function bad tuned .
We can have a positionnal avantage worth more than a pawn if it is a real avantage right? Unless our engine can't win a game positionaly, it'll search only for a material avantage no?
Here is the dificulty:
It need a good eval very well tuned , it's the game of chess programming , it's all the fun for me : playing with the eval (and the search) &#128521;