Stand Pat penalty

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Stand Pat penalty

Post by lucasart »

Don wrote: Komodo has symmetrical evaluation but we do give attack bonuses IN the evaluation function and these get larger when multiple pieces are attacked. And it was definitely an improvement but I cannot remember how much (This was done between Komodo 4 and 5 I think.)
DiscoCheck also does this in the eval, using a symmetric term. But the penalties are relatively small and increase linearly with the number of pieces hanging (I've tried non linear versions but I didn't manage to make it work).
Don wrote: I remember experimenting with asymmetrical bonuses (based on the side to move) but nothing came of it. Doesn't mean it's bad though, it just means we did not succeed in figure it out.
Intuitively at least, the idea makes perfect sense. When your opponent has hanging pieces, you don't need to increase your stand pat score, because the search/qsearch will naturally continue and capture what can be captured, rather than standing pat. So it seems better to trust the search here, rather than try to do it through some eval bonus.
But when you have several hanging pieces, you shouldn't stand pat without being penalized.

Anyway, I need to do more experiment with variations of the idea. The penalties for hanging pieces in the eval, as well as the stand_pat_penalty for the side to move with several hanging pieces, have a surprisingly high elo impact in DiscoCheck. So it's worth spending time to improve them.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Stand Pat penalty

Post by Don »

lucasart wrote:
Don wrote: Komodo has symmetrical evaluation but we do give attack bonuses IN the evaluation function and these get larger when multiple pieces are attacked. And it was definitely an improvement but I cannot remember how much (This was done between Komodo 4 and 5 I think.)
DiscoCheck also does this in the eval, using a symmetric term. But the penalties are relatively small and increase linearly with the number of pieces hanging (I've tried non linear versions but I didn't manage to make it work).
Don wrote: I remember experimenting with asymmetrical bonuses (based on the side to move) but nothing came of it. Doesn't mean it's bad though, it just means we did not succeed in figure it out.
Intuitively at least, the idea makes perfect sense. When your opponent has hanging pieces, you don't need to increase your stand pat score, because the search/qsearch will naturally continue and capture what can be captured, rather than standing pat. So it seems better to trust the search here, rather than try to do it through some eval bonus.
But when you have several hanging pieces, you shouldn't stand pat without being penalized.

Anyway, I need to do more experiment with variations of the idea. The penalties for hanging pieces in the eval, as well as the stand_pat_penalty for the side to move with several hanging pieces, have a surprisingly high elo impact in DiscoCheck. So it's worth spending time to improve them.
I keep a file with a list of idea to try and I added this as something to revisit. I'll let you know if I find anything - but it will be some time before I get to this item.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
Rebel
Posts: 6946
Joined: Thu Aug 18, 2011 12:04 pm

Re: Stand Pat penalty

Post by Rebel »

lucasart wrote:Here's an idea I'm experimenting with, that seems to work well in DiscoCheck:

1/ hanging pieces

I have a function that calculates hanging pieces (for the side to move), defined as:
* pieces or pawns that are attacked and not defended
* pieces that are attacked by pawns (regardless of defense)

2/ stand pat penalty

* if there are two or more hanging pieces
* take the lowest one and return half its value.

For example, if the hanging pieces are a Knight and a Rook, return value(Knight)/2. If a Bishop and a Pawn, return Value(Pawn)/2, etc.

=> The stand_pat_penalty() is, as the name suggests, used as a penalty for standing pat, both in the quiescent search, and for eval pruning (ie. when evel is much higher than beta, and we are near the leaves in the search).

The rationale is simple:
* if you have one piece hanging, you're probably fine, as it's your turn to play
* but if you have two, you will most likely need to find a tactical escape. this is exactly what this does, as it prevents the search from choosing the stand pat option, and incentivises it to solve the remaining tactics to choose a more quiet position a few plies later.

The definition of hanging pieces can be improved (that one just happenned to be easy to code and runs fast in DiscoCheck). As well as the definition of the stand pat penalty
- perhaps something could also be done for pinned pieces. For example, if the pinner is least valuable than the pinned piece, penalize by half the difference in value of the pieces to push solving the pin rather than standing pat.
- the half value of the lowest hanging piece is a pure guess. have made no attempt to optimize it.
I do something similar regarding hanging pieces. Throughout the whole tree I reduce one ply comparing Alpha with the optimistic value of eval minus the lowest hanging piece / 2 + 0.50 in case 2 pieces are hanging. There are some further refinements to this basic formula and (surprisingly) it still works quite well after all those years.