using PVS with tt , prunining ,...etc ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 11:54 pm

using PVS with tt , prunining ,...etc ?

Post by MahmoudUthman »

I want to transition from using a normal Alpha Beta search to PVS , I have implemented a TT used null move pruning ,quiescence, history, killers, SEE, etc. & ensured their correctness, now I want to use the following Algorithm but I don't know how to use the mentioned techniques with it :

Code: Select all

int pvSearch( int alpha, int beta, int depth ) {
   if( depth == 0 ) return quiesce(alpha, beta);
   bool bSearchPv = true;
   for ( all moves)  {
      make
      if ( bSearchPv ) {
         score = -pvSearch(-beta, -alpha, depth - 1);
      } else {
         score = -zwSearch(-alpha, depth - 1);
         if ( score > alpha ) // in fail-soft ... && score < beta ) is common
            score = -pvSearch&#40;-beta, -alpha, depth - 1&#41;; // re-search
      &#125;
      unmake
      if&#40; score >= beta )
         return beta;   // fail-hard beta-cutoff
      if&#40; score > alpha ) &#123;
         alpha = score; // alpha acts like max in MiniMax
         bSearchPv = false;   // *1&#41;
      &#125;
   &#125;
   return alpha;
&#125;
 
// fail-hard zero window search, returns either beta-1 or beta
int zwSearch&#40;int beta, int depth ) &#123;
   // alpha == beta - 1
   // this is either a cut- or all-node
   if&#40; depth == 0 ) return quiesce&#40;beta-1, beta&#41;;
   for ( all moves&#41;  &#123;
     make
     score = -zwSearch&#40;1-beta, depth - 1&#41;;
     unmake
     if&#40; score >= beta )
        return beta;   // fail-hard beta-cutoff
   &#125;
   return beta-1; // fail-hard, return alpha
&#125;
for example:
1-should the ordering differ from PVS to zwSearch .
2-what techniques should be used in PVS and in zwSearch, for example should null & late pruning be used in both.
3-how should I use the ttvalues in both searches and what result should I store ?
4-if fail-soft gives different results in normal alpha beta routine than fail hard , does this indicate a problem or is it a normal search instability.
5-is it worth it to use an aspiration window with PVS ?
6-right now the evaluation is based on material difference ,mobility ,some pawn stuff (passed ,double,..) what is the next most important aspect to implement ?
zd3nik
Posts: 193
Joined: Wed Mar 11, 2015 3:34 am
Location: United States

Re: using PVS with tt , prunining ,...etc ?

Post by zd3nik »

MahmoudUthman wrote: 1-should the ordering differ from PVS to zwSearch .
2-what techniques should be used in PVS and in zwSearch, for example should null & late pruning be used in both.
3-how should I use the ttvalues in both searches and what result should I store ?
4-if fail-soft gives different results in normal alpha beta routine than fail hard , does this indicate a problem or is it a normal search instability.
5-is it worth it to use an aspiration window with PVS ?
6-right now the evaluation is based on material difference ,mobility ,some pawn stuff (passed ,double,..) what is the next most important aspect to implement ?
1. I don't think so. but perhaps in zwSearch if you get a good first move from the TT or killer or refutation table etc it's not necessary to spend time scoring/ordering remaining moves? I've never made a distinction between pvSearch and zwSearch for move ordering in any of my engines though.

2. I tend to stay away from forward pruning techniques in pvSearch but use them heavily in zwSearch. The only exception would be Null Move pruning. I suspect you'll get a lot of different responses to this question.

3. Again this is just me. But I use TT results without restriction in zwSearch, but only return TT values from pvSearch if the TT entry came from pvSearch. So most of the time TT values just end up setting the first move in pvSearch in my engines.

4. Not sure I understand the question. Fail-soft fame works do tend to have more search instability I think, but I'm not sure if that's what you're asking.

5. Another one I suspect you'll get a lot of different responses on. I think moderate use of aspiration windows is still useful with PVS search because it keeps the pvSearches from going berserk. It has no effect on the zwSearches. So it's a matter of what percentage your engine spends it's time in pvSearch vs zwSearch. If you've tuned things really well and only spend a small percentage of time in pvSearch then perhaps you don't need aspiration windows.

6. Good question I'd like to know the answer to this one too.
Karlo Bala
Posts: 373
Joined: Wed Mar 22, 2006 10:17 am
Location: Novi Sad, Serbia
Full name: Karlo Balla

Re: using PVS with tt , prunining ,...etc ?

Post by Karlo Bala »

MahmoudUthman wrote: 6-right now the evaluation is based on material difference ,mobility ,some pawn stuff (passed ,double,..) what is the next most important aspect to implement ?
6. Perhaps a second most important thing after material - king safety, including castling. Not an easy task.
Best Regards,
Karlo Balla Jr.
jdart
Posts: 4367
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: using PVS with tt , prunining ,...etc ?

Post by jdart »

Re 6, king safety is very important. If you do not have decent code for this you will lose a lot of games to engines that do (and possibly to tactically-aware humans).

--Jon
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: using PVS with tt , prunining ,...etc ?

Post by Ferdy »

MahmoudUthman wrote: 6-right now the evaluation is based on material difference ,mobility ,some pawn stuff (passed ,double,..) what is the next most important aspect to implement ?
Probably try the threat eval. Usually high_value_piece threaten to capture low_value_piece.
The low_value_piece captures high_value_piece will be taken cared of by the qsearch.

There is some sort of king safety in this threat eval. For example if any of your pieces (guarding your king) are threatened by the pieces of your opponent,
then your king safety score would be below normal. This kind of eval is very important in games where dropping pieces are allowed like in crazyhouse and shogi games.