Razoring / Lazy eval question

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Rebel
Posts: 7299
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Razoring / Lazy eval question

Post by Rebel »

One more time :wink:

You are at RD <=0 depths and you have to decide whether to do a full eval or just a quick lazy one.

What you want to know is: when doing a full eval at this point can the current_material score + safety_margin (LE) bring the value above ALPHA or not. If not return material score + safety_margin, else full eval.

That's the basic idea.

And it's full of dangers when the safety_margin is small (say 0.50) or not effective when the safety_margin is large (say 5.00).

And yet there is an easy solution. I am using 0.50 myself and can do that because I keep track of the difference between material_score and the eval_score of RD+1. And that value is simply added to current_material score (the green above) when doing LE and thus overcoming the problems with large eval scores.

Think about the logic behind, basically you are saying: 0.50 is a reasonable compromise the evaluation will increase compared to the previous one (RD+1).

========

The thing I have how LE is described on the CPW is involving BETA as well. I recently I have tried it anyway and as expected it did not work. It may differ from engine to engine and the search techniques involved but doing BETA-LE is asking for researches.
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: Razoring / Lazy eval question

Post by Michel »

So if understand correctly the idea is to a full eval at distance 1 from the leaves and use this to make a lazy eval decision at the leaves.

Now how do you know for example that you are at a leaf? This hinges on the fact that you
will stand pat at this node which you can not know without having searched the other moves.
User avatar
Rebel
Posts: 7299
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Razoring / Lazy eval question

Post by Rebel »

Michel wrote:So if understand correctly the idea is to a full eval at distance 1 from the leaves and use this to make a lazy eval decision at the leaves.
Yep.

Same applies for QS (RD<0)

Once you have this working apply the same for futility pruning.
Now how do you know for example that you are at a leaf? This hinges on the fact that you will stand pat at this node which you can not know without having searched the other moves.
I don't understand the connection when the subject is full eval or LE.
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: Razoring / Lazy eval question

Post by Michel »

I don't understand the connection when the subject is full eval or LE.
If you are not at a leaf you do full eval by definition. So this means you must know in advance when you are at a leaf... So you must know in advance if you are going to stand pat at this node or not... (if you do not stand pat then you are not at a leaf).
ZirconiumX
Posts: 1349
Joined: Sun Jul 17, 2011 11:14 am
Full name: Hannah Ravensloft

Re: Razoring / Lazy eval question

Post by ZirconiumX »

Michel, AFAICT, Ed does a full eval at depth = 1, and every node that isn't pruned in QS, and stores this somewhere.

He goes into horizon depth, and subsequently QS (what he might call leaves) and every time eval() is called, he checks lazy eval - like this:

Code: Select all

if (!in_check() && !move_is_check(move) && !special_position()) {
  int i_score = board_material() + board_pst();
  int margin = 50 + (previous_full_eval - i_score);

  if (i_score + margin < alpha) skip_move();
}
This is theoretically sound, as
  • he does not prune against beta (a good move is a good move)
  • he has plenty of restrictions - it is a pruning technique after all.
  • he checks the previous full eval - a useless move will keep eval similar.
meaning that "the gain/pain ratio" is largely favourable.

Matthew:out
tu ne cede malis, sed contra audentior ito
User avatar
Rebel
Posts: 7299
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Razoring / Lazy eval question

Post by Rebel »

Correct summary.
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: Razoring / Lazy eval question

Post by Michel »

if (!in_check() && !move_is_check(move) && !special_position()) {
int i_score = board_material() + board_pst();
int margin = 50 + (previous_full_eval - i_score);

if (i_score + margin < alpha) skip_move();
}
So previous_full_eval is not necessarily the parent then? This is not how Ed was explaining it.
ZirconiumX
Posts: 1349
Joined: Sun Jul 17, 2011 11:14 am
Full name: Hannah Ravensloft

Re: Razoring / Lazy eval question

Post by ZirconiumX »

previous_full_eval will _always_ be the parent - it becomes theoretically unsound if it isn't.

Matthew:out
tu ne cede malis, sed contra audentior ito
jd1
Posts: 269
Joined: Wed Oct 24, 2012 2:07 am

Re: Razoring / Lazy eval question

Post by jd1 »

Hi Matthew,

A question about the code as you posted. I'm not sure I understand it.
Since margin = previous_full_eval - i_score +50, surely
i_score + margin = previous_full_eval + 50?

Then it does not matter how good the move appears to be by lazy eval. For example the move captures a queen. i_score goes up by a queen, but the margin will become negative. Or am I missing something?

Jerry
User avatar
Rebel
Posts: 7299
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Razoring / Lazy eval question

Post by Rebel »

jd1 wrote:Hi Matthew,

A question about the code as you posted. I'm not sure I understand it.
Since margin = previous_full_eval - i_score +50, surely
i_score + margin = previous_full_eval + 50?

Then it does not matter how good the move appears to be by lazy eval. For example the move captures a queen. i_score goes up by a queen, but the margin will become negative. Or am I missing something?

Jerry
Once you get the logic there are no questions left. Perhaps a few diagrams are helpful, see: [ http://www.top-5000.nl/authors/rebel/chess840.htm ] and pick Lazy Eval from the menu.