Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: The usefull-ness of PVS

Author: Michel Langeveld

Date: 08:53:38 01/14/04

Go up one level in this thread


This is how I implemented PVS now:

/* think() calls search() iteratively. Search statistics
   are printed depending on the value of output */
void think()
{
   int i, x, middle;
   int window = 30;
   int low_window, high_window;

   /* try the opening book first */
   pv[0][0].u = book_move();
   if (pv[0][0].u != -1)
      return;

   /* some code that lets us longjmp back here and return
      from think() when our time is up */
   stop_search = FALSE;
   setjmp(env);
   if (stop_search) {

      /* make sure to take back the line we were searching */
      while (ply) {
         //nullmove?
         if (hist_dat[hply-1].m.u == 0)
            takebacknullmove();
         else
            takeback();
      }
      return;
   }

   start_time = get_ms();
   stop_time = start_time + max_time;

   ply = 0;
   nodes = 0;
   memset(pv, 0, sizeof(pv));
   memset(history, 0, sizeof(history));

   middle = eval();

   if (output == 1)
      printf("ply   time     nodes  score  pv\n");
   for (i = 1; i <= max_depth; ++i) {
      follow_pv = TRUE;

      low_window = middle - window;
      high_window = middle + window;

research:
      printf("searching [%d,%d]\n", low_window, high_window);
      x = search(low_window, high_window, i, TRUE);
      do_output(i, x, TRUE);

      //are we mate?
      if (x > 9000 || x < -9000)  break;

      //research?
      if (x <= low_window || x >= high_window) {
         low_window = -10000;
         high_window = 10000;
         printf("research\n");
         goto research;
      }

      middle = x;

      movecount = 0;
   }
}

The strange thing I tested 2 positions:
- starting position
- tactical position

In the first aspiration windows is a tiny bith faster in the other pos it is big
way slower.  Is the asp window implemented as you expected I do I have to make
it smarter?

starting position 8 ply:

-asp -pvs
 8*   1762   2987720     -9  b1c3 d7d5 i1h3 i8h6 h3f4 d5d4 c3e4 c8f5

-asp +pvs:
 8*   1028   1689903     -9  b1c3 d7d5 i1h3 i8h6 h3f4 d5d4 c3e4 c8f5

+asp -pvs
 8*   1054   1702334     -9  b1c3 d7d5 i1h3 i8h6 h3f4 d5d4 c3e4 c8f5

+asp +pvs:
 8*    996   1631105     -9  b1c3 d7d5 i1h3 i8h6 h3f4 d5d4 c3e4 c8f5

think you are right for this one 5.5% improvement.

tactical position 8 ply:

-asp -pvs:
 7    1234   2303662  -9990  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5
 7*   1234   2303662  -9990  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5

-asp +pvs:
 7*    160    328189  -9990  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5

+asp +pvs (asp makes it slower):
 7*    329    675245  -9990  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5

+asp -pvs (asp makes it slower):
 7*   1459   2862993  -9990  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5

The problem with adding asp on the tactical position is that it had to do the
research the entire ply full with again, as follows:

ply   time     nodes  score  pv
searching [412,472]
 1       0        77    427  i3j3 f8d8
 1*      0        77    427  i3j3 f8d8
searching [397,457]
 2       0       993    442  i3j3 f8d8 j1g1
 2*      0       993    442  i3j3 f8d8 j1g1
searching [412,472]
 3       1      3499    412  i3j3 g2h2 j3i3 h2g2
 3*      1      3499    412  i3j3 g2h2 j3i3 h2g2
research
searching [-10000,10000]
 3       3      5285      0  i3j3 g2h2 j3i3 h2g2
 3*      3      5285      0  i3j3 g2h2 j3i3 h2g2
searching [-30,30]
 4       4      8100      0  i3j3 g2h2 j3i3 h2g2
 4*      4      8100      0  i3j3 g2h2 j3i3 h2g2
searching [-30,30]
 5       6     14075      0  i3j3 g2h2 j3i3 h2g2
 5*      6     14075      0  i3j3 g2h2 j3i3 h2g2
searching [-30,30]
 6      39     77459    -30  i3j3 h5h4 d1j7 i8j7 j1j2 c8e8
 6*     39     77459    -30  i3j3 h5h4 d1j7 i8j7 j1j2 c8e8
research
searching [-10000,10000]
 6      87    175274   -461  i3j3 h5h4 d1j7 i8j7 j3i4 g2h2 i4h4 f8d8 d3b2 h2f2
 6*     87    175274   -461  i3j3 h5h4 d1j7 i8j7 j3i4 g2h2 i4h4 f8d8 d3b2 h2f2
searching [-491,-431]
 7     150    308074   -491  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5
 7*    150    308074   -491  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5
research
searching [-10000,10000]
 7     329    675245  -9990  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5
 7*    329    675245  -9990  i3j3 h5h4 d1j7 i8j7 j3i4 c8e8 i4i5 g2i2 i5j5 e8h5
Time: 3297 ms




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.