When is correct to use the ttvalue as static evaluation without calling the evaluation function?
The ttvalue is not returned to the lower level if (ttdepth<depth) or (ttnode==CUTNODE && ttvalue<beta) or (ttnode==ALLNODE && ttvalue>alpha).
if ttdepth<depth && ttnode==PVNODE I have an exact score and I can use as static evaluation without problems but in the other cases It's better to call the evaluation function or it's good to use a lower or upper bound without calling the evaluation?
Use of ttvalue as static evaluation
Moderators: hgm, Rebel, chrisw
-
- Posts: 217
- Joined: Fri Apr 11, 2014 10:45 am
- Full name: Fabio Gobbato
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: Use of ttvalue as static evaluation
I could be wrong, but it looks to me that Stockfish always call eval function and after it try to refine eval with ttvalue.
Code: Select all
if (ttValue != VALUE_NONE)
if (tte->bound() & (ttValue > eval ? BOUND_LOWER : BOUND_UPPER))
eval = ttValue;
-
- Posts: 217
- Joined: Fri Apr 11, 2014 10:45 am
- Full name: Fabio Gobbato
Re: Use of ttvalue as static evaluation
Code: Select all
// TT lookup
uint64_t key = get_key(B);
hash_t *tte = tt_find(key);
if (tte) {
if (tte->depth > 0)
si->tt = tte->move;
current_eval = tte->eval;
if (ply > 0 && can_return_tt(is_pv, tte, depth, beta, ply)) {
tt_refresh(tte);
return adjust_tt_score(tte->score, ply);
}
} else
current_eval = in_check ? -INF : calc_eval(B);
It seems correct to me to use only a PVNODE eval
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: Use of ttvalue as static evaluation
Hi fabio, I don't understand your post.
in the code you posted from discocheck it looks like tte->eval if the result of calc_eval(B) saved in TT.
so it simply avoid a calc_eval call because it has previously saved the result in the TT.
The code i posted is from stckfish and it is eval refinement, it replace static-eval with result of search
in the code you posted from discocheck it looks like tte->eval if the result of calc_eval(B) saved in TT.
so it simply avoid a calc_eval call because it has previously saved the result in the TT.
The code i posted is from stckfish and it is eval refinement, it replace static-eval with result of search
-
- Posts: 217
- Joined: Fri Apr 11, 2014 10:45 am
- Full name: Fabio Gobbato
Re: Use of ttvalue as static evaluation
It seems to me that stockfish and discocheck use a similar idea. In the code from discocheck curret_eval = tte->eval if there is a tt hit. Else current_eval is the result from calc_eval(). Where current_eval is the static evaluation of the position used for pruning decisions.
I don't understand at all why is a good thing to update always static eval with the ones in the tt entry.
If the tt entry is a lower or upper bound you could have a big difference between this value and a good one, maybe in this cases it's good to update the static evaluation making a call to the evaluation function .
I don't understand at all why is a good thing to update always static eval with the ones in the tt entry.
If the tt entry is a lower or upper bound you could have a big difference between this value and a good one, maybe in this cases it's good to update the static evaluation making a call to the evaluation function .
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: Use of ttvalue as static evaluation
you don't understand
in discocheck tte->score is the score of the search, which could be exact result, a lower bound or an higher bound
tte->eval is the result of calc_eval(B)
he saves both score and static eval in the Trasposition table!!
in discocheck tte->score is the score of the search, which could be exact result, a lower bound or an higher bound
tte->eval is the result of calc_eval(B)
he saves both score and static eval in the Trasposition table!!