Lazy eval vs. lazy QSearch

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27837
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Lazy eval vs. lazy QSearch

Post by hgm »

The side that does the last move before the horizon has the tendency to grab whatever it can. QSearch was invented to punish this greediness. But like any alpha-beta search, QSearch is lazy, and often does as poor a job as it can get away with.

What I wondered about in particular is how to treat a leaf where you should fail high, because you were well ahead in the branch leading up to it, but on the last move the opponent plays a capture that approximately evens the score. You might be able to secure the fail high by standing pat, but due to the near equality, you cannot decide that based on a lazy eval, but would need a full (expensive) evaluation.

An alternative would be to play the recapture. This restores your advantage, or even increases your lead (if the capture at d=1 was unsound). The recapture would lead to an all-node, but the opponent might not have a 'repeat performance' after having burnt his capture that was just good enough, all remaining captures falling well short of alpha. So you can declare them futile based on a lazy eval, and would never have to do a full eval. This could well make up for the cost of doing the extra node. As an additional award, it could give you a much sharper lower bound on the score. (E.g. if you were at beta+960cP, but he can trade Q on the horizon, the full eval might give you LB=beta+10cP, but recapturing the Queen leaving only some of your minors attacked would give LB=beta+600cP-lazyEvalMargin.)

So being less lazy in QS (searching the move rather than going for the stand pat) allows you to be more lazy in eval in such cases, with a much better (and more certain!) pay-off.

Are there engines that make use of this method?
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Lazy eval vs. lazy QSearch

Post by diep »

hgm wrote:The side that does the last move before the horizon has the tendency to grab whatever it can. QSearch was invented to punish this greediness. But like any alpha-beta search, QSearch is lazy, and often does as poor a job as it can get away with.

What I wondered about in particular is how to treat a leaf where you should fail high, because you were well ahead in the branch leading up to it, but on the last move the opponent plays a capture that approximately evens the score. You might be able to secure the fail high by standing pat, but due to the near equality, you cannot decide that based on a lazy eval, but would need a full (expensive) evaluation.

An alternative would be to play the recapture. This restores your advantage, or even increases your lead (if the capture at d=1 was unsound). The recapture would lead to an all-node, but the opponent might not have a 'repeat performance' after having burnt his capture that was just good enough, all remaining captures falling well short of alpha. So you can declare them futile based on a lazy eval, and would never have to do a full eval. This could well make up for the cost of doing the extra node. As an additional award, it could give you a much sharper lower bound on the score. (E.g. if you were at beta+960cP, but he can trade Q on the horizon, the full eval might give you LB=beta+10cP, but recapturing the Queen leaving only some of your minors attacked would give LB=beta+600cP-lazyEvalMargin.)

So being less lazy in QS (searching the move rather than going for the stand pat) allows you to be more lazy in eval in such cases, with a much better (and more certain!) pay-off.

Are there engines that make use of this method?
Calling qsearch "lazy, just like an alphabeta search" is dead wrong.

You do a full evaluation on top of the qsearch, so you get a very accurate evaluation there.

If you'd do a lazy evaluation on top of the qsearch - you basically have no clue about the score of the position.

If we look in other areas where the word 'lazy' gets used, like in functional programming, then that always means: "delaying" the things you don't need to do yet.

Which is already quite different from the definition as it gets used in computerchess, namely having some sort of *replacement* of a full evaluation.

So crossmixing the word 'lazy' is very dangerous in that respect, as it means total different things and using the word lazy for search would completely overload the definition of what lazy is as it historically has been used in computerchess.

I'm under the impression you mix the computer chess definition with the word 'lazy' as the superslow languages are using it. Also if i may remind, functional programs easily are factor 10000x slower than a fast C version doing lossless the same, whereas in the functional program it's called 'lazy evaluation of the lists and arrays', whereas the C version the word 'lazy' doesn't apply yet it's factor 10k faster than this 'great' mechanism in that functional language.

Ok enough feeding of the dogs...

Vincent
User avatar
hgm
Posts: 27837
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Lazy eval vs. lazy QSearch

Post by hgm »

Lazy = not doing as much as you should do, because you think you can get away with it.

Standing pat when there are still captures that would gain you material, just because you already areabove beta, does qualify as 'lazy' in this definition.

You should not confuse the word 'lazy' with the word 'evaluation'. These are orthogonal concepts. Anything or anyone can be lazy. And things can be evaluated with any degree of zealousness.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Lazy eval vs. lazy QSearch

Post by diep »

hgm wrote:Lazy = not doing as much as you should do, because you think you can get away with it.

Standing pat when there are still captures that would gain you material, just because you already areabove beta, does qualify as 'lazy' in this definition.

You should not confuse the word 'lazy' with the word 'evaluation'. These are orthogonal concepts. Anything or anyone can be lazy. And things can be evaluated with any degree of zealousness.
To know you're above beta you need to know somehow a static score for this position.

Doing that without full evaluation we call a lazy evaluation and nothing else.
User avatar
hgm
Posts: 27837
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Lazy eval vs. lazy QSearch

Post by hgm »

Indeed. And to stand pat when there is still material up for grabs, I call lazy QSearch, and nothing else...