Multi dimensional score

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

nionita
Posts: 175
Joined: Fri Oct 22, 2010 9:47 pm
Location: Austria

Multi dimensional score

Post by nionita »

This idea I had when thinking about scores coming from different depths. I was thinking that scores coming from deeper evaluations should be somehow better, although the static score is the same. So that variants (with the same score but higher depth) should be preferred. Which means, from 2 variants, take the variant with the higher score, otherwise, given the same score, take the variant with better depth. Of course there is a problem in PV or even alpha-beta search because coming with a score of alpha (after already having a pv) does actually mean "at most alpha" (the score is an upper limit). This is the point where I missed it when tried to implement the idea and then I forgot about it for a while.

But later, I was thinking that:
1. there could be some work-around about this problem (we could for example search with a "closed" window of 1 instead of 0, i.e. with -(alpha+2), -alpha, in order to catch equal scores)
2. it must not be always the depth, we could consider other characteristica too, based on which we could have preferences; for example, choose open positions instead of closed, and such.

Actually there could be really just 2 or maximal 3 components of the score: the real score, some other "interesting" part - call it preference - and then perhaps depth, which altogether for sure is not a problem to fit in an integer (e.g. 32 bits). When coming from the transposition table we already have depth there, so only a few further bits should be added per entry.

One benefit I can imagine: if we know types of positions where our engine is strong, we can prefer them with the second component, while avoiding the ones where the engine is known to be weak.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Multi dimensional score

Post by mcostalba »

nionita wrote:This idea I had when thinking about scores coming from different depths. I was thinking that scores coming from deeper evaluations should be somehow better, although the static score is the same. So that variants (with the same score but higher depth) should be preferred. Which means, from 2 variants, take the variant with the higher score, otherwise, given the same score, take the variant with better depth. Of course there is a problem in PV or even alpha-beta search because coming with a score of alpha (after already having a pv) does actually mean "at most alpha" (the score is an upper limit). This is the point where I missed it when tried to implement the idea and then I forgot about it for a while.
In SF we call this refined evaluation:


Code: Select all

  // refine_eval() returns the transposition table score if possible, otherwise
  // falls back on static position evaluation.

  Value refine_eval(const TTEntry* tte, Value v, Value defaultEval) {

      assert(tte);

      if (   ((tte->type() & BOUND_LOWER) && v >= defaultEval)
          || (&#40;tte->type&#40;) & BOUND_UPPER&#41; && v < defaultEval&#41;)
          return v;

      return defaultEval;
  &#125;
nionita
Posts: 175
Joined: Fri Oct 22, 2010 9:47 pm
Location: Austria

Re: Multi dimensional score

Post by nionita »

mcostalba wrote: In SF we call this refined evaluation:


Code: Select all

  // refine_eval&#40;) returns the transposition table score if possible, otherwise
  // falls back on static position evaluation.

  Value refine_eval&#40;const TTEntry* tte, Value v, Value defaultEval&#41; &#123;

      assert&#40;tte&#41;;

      if (   (&#40;tte->type&#40;) & BOUND_LOWER&#41; && v >= defaultEval&#41;
          || (&#40;tte->type&#40;) & BOUND_UPPER&#41; && v < defaultEval&#41;)
          return v;

      return defaultEval;
  &#125;
So you call refine_eval with the static value as default.

But this is something I really don't understand how it works: comparing a raw static evaluation score with a score coming from at least a quiescent search. While after QS the score still comes from a static evaluation, that position is still much more quiet (let's say it contains at most unsearched negative SEE moves), while the raw static evaluation could be far away from it, because in the next move we could for example loose the queen.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Multi dimensional score

Post by mcostalba »

nionita wrote:While after QS the score still comes from a static evaluation, that position is still much more quiet (let's say it contains at most unsearched negative SEE moves), while the raw static evaluation could be far away from it, because in the next move we could for example loose the queen.
That's why we prefer the first as long as it is usable....