mobility evaluation of stockfish

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Uri Blass
Posts: 10267
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

mobility evaluation of stockfish

Post by Uri Blass »

I looked at the code of stockfish1.9 and it seems to me that the mobility evaluation is linear in the number of squares(except big number of squares and the difference in evaluation between controling 0 squares and controling 2 seaures is generally the same as the difference in evaluation between controling 4 squares and controling 2 squares)

I think that it is not logical to do it and it is may be better to reduce the mobility score for controling small number of squares.

stockfish has the following code

Code: Select all

const Score MobilityBonus[][32] = {
     {}, {},
     { S(-38,-33), S(-25,-23), S(-12,-13), S( 0, -3), S(12,  7), S(25, 17), // Knights
       S( 31, 22), S( 38, 27), S( 38, 27) },
     { S(-25,-30), S(-11,-16), S(  3, -2), S(17, 12), S(31, 26), S(45, 40), // Bishops
       S( 57, 52), S( 65, 60), S( 71, 65), S(74, 69), S(76, 71), S(78, 73),
       S( 79, 74), S( 80, 75), S( 81, 76), S(81, 76) },
     { S(-20,-36), S(-14,-19), S( -8, -3), S(-2, 13), S( 4, 29), S(10, 46), // Rooks
       S( 14, 62), S( 19, 79), S( 23, 95), S(26,106), S(27,111), S(28,114),
       S( 29,116), S( 30,117), S( 31,118), S(32,118) },
     { S(-10,-18), S( -8,-13), S( -6, -7), S(-3, -2), S(-1,  3), S( 1,  8), // Queens
       S(  3, 13), S(  5, 19), S(  8, 23), S(10, 27), S(12, 32), S(15, 34),
       S( 16, 35), S( 17, 35), S( 18, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35), S( 20, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35), S( 20, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35) }
  };
I suggest to change it to reduce the numbers of every line by
15(for 0 squares),10 (for 1 squares),6 (for 2 squares) 3 (for 3 squares),
1 (for 4 squares)

I wonder if somebody tested this idea or is interested in testing it.
Damir
Posts: 2801
Joined: Mon Feb 11, 2008 3:53 pm
Location: Denmark
Full name: Damir Desevac

Re: mobility evaluation of stockfish

Post by Damir »

As Joona&Marco say: since it is your idea, why don't you try and test it ? :)
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: mobility evaluation of stockfish

Post by michiguel »

Uri Blass wrote:I looked at the code of stockfish1.9 and it seems to me that the mobility evaluation is linear in the number of squares(except big number of squares and the difference in evaluation between controling 0 squares and controling 2 seaures is generally the same as the difference in evaluation between controling 4 squares and controling 2 squares)

I think that it is not logical to do it and it is may be better to reduce the mobility score for controling small number of squares.

stockfish has the following code

Code: Select all

const Score MobilityBonus[][32] = {
     {}, {},
     { S(-38,-33), S(-25,-23), S(-12,-13), S( 0, -3), S(12,  7), S(25, 17), // Knights
       S( 31, 22), S( 38, 27), S( 38, 27) },
     { S(-25,-30), S(-11,-16), S(  3, -2), S(17, 12), S(31, 26), S(45, 40), // Bishops
       S( 57, 52), S( 65, 60), S( 71, 65), S(74, 69), S(76, 71), S(78, 73),
       S( 79, 74), S( 80, 75), S( 81, 76), S(81, 76) },
     { S(-20,-36), S(-14,-19), S( -8, -3), S(-2, 13), S( 4, 29), S(10, 46), // Rooks
       S( 14, 62), S( 19, 79), S( 23, 95), S(26,106), S(27,111), S(28,114),
       S( 29,116), S( 30,117), S( 31,118), S(32,118) },
     { S(-10,-18), S( -8,-13), S( -6, -7), S(-3, -2), S(-1,  3), S( 1,  8), // Queens
       S(  3, 13), S(  5, 19), S(  8, 23), S(10, 27), S(12, 32), S(15, 34),
       S( 16, 35), S( 17, 35), S( 18, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35), S( 20, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35), S( 20, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35) }
  };
I suggest to change it to reduce the numbers of every line by
15(for 0 squares),10 (for 1 squares),6 (for 2 squares) 3 (for 3 squares),
1 (for 4 squares)

I wonder if somebody tested this idea or is interested in testing it.
what is the S ()? What is that macro doing? is that changing the values and composing only one of with both?

I cannot comment without knowing that the above is doing, but I agree that mobility should NOT be linear, but the curvature should be the opposite of what you suggest!

It is more critical to have a piece that goes from 0 to 2 squares, than going from 12 to 14.

Miguel
Ralph Stoesser
Posts: 408
Joined: Sat Mar 06, 2010 9:28 am

Re: mobility evaluation of stockfish

Post by Ralph Stoesser »

It's a macro for composing a score value from a midgame and an endgame value.

I think this is a good idea, therefore I test it right now @5sec per game...
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: mobility evaluation of stockfish

Post by mcostalba »

Uri Blass wrote: I wonder if somebody tested this idea or is interested in testing it.
We have made some tests of non-linear mobility (after Don posted his experience on Talkchess), until now we go from "no difference" to "worst"...but perhaps we still have to find correct receipe.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: mobility evaluation of stockfish

Post by michiguel »

mcostalba wrote:
Uri Blass wrote: I wonder if somebody tested this idea or is interested in testing it.
We have made some tests of non-linear mobility (after Don posted his experience on Talkchess), until now we go from "no difference" to "worst"...but perhaps we still have to find correct receipe.
The problem is that mobility parameters are correlated with everything else. They are impossible to tune w/o touching other parameters such as piece values.

Miguel
Ralph Stoesser
Posts: 408
Joined: Sat Mar 06, 2010 9:28 am

Re: mobility evaluation of stockfish

Post by Ralph Stoesser »

Experiment finished. After 2000 5 sec self play games there is barely a difference. +516, -507, =976 (+2 Elo) in favor for Uri's values.
Uri Blass
Posts: 10267
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: mobility evaluation of stockfish

Post by Uri Blass »

Ralph Stoesser wrote:Experiment finished. After 2000 5 sec self play games there is barely a difference. +516, -507, =976 (+2 Elo) in favor for Uri's values.
Thanks

I read claims by Don Daily that mobility helps more at long time control so it may be interesting to see the results with longer time control than 5 seconds for all the game(alternatively it may be also interesting to see the results with bigger difference in the evaluation to the same direction)
Uri Blass
Posts: 10267
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: mobility evaluation of stockfish

Post by Uri Blass »

michiguel wrote:
Uri Blass wrote:I looked at the code of stockfish1.9 and it seems to me that the mobility evaluation is linear in the number of squares(except big number of squares and the difference in evaluation between controling 0 squares and controling 2 seaures is generally the same as the difference in evaluation between controling 4 squares and controling 2 squares)

I think that it is not logical to do it and it is may be better to reduce the mobility score for controling small number of squares.

stockfish has the following code

Code: Select all

const Score MobilityBonus[][32] = {
     {}, {},
     { S(-38,-33), S(-25,-23), S(-12,-13), S( 0, -3), S(12,  7), S(25, 17), // Knights
       S( 31, 22), S( 38, 27), S( 38, 27) },
     { S(-25,-30), S(-11,-16), S(  3, -2), S(17, 12), S(31, 26), S(45, 40), // Bishops
       S( 57, 52), S( 65, 60), S( 71, 65), S(74, 69), S(76, 71), S(78, 73),
       S( 79, 74), S( 80, 75), S( 81, 76), S(81, 76) },
     { S(-20,-36), S(-14,-19), S( -8, -3), S(-2, 13), S( 4, 29), S(10, 46), // Rooks
       S( 14, 62), S( 19, 79), S( 23, 95), S(26,106), S(27,111), S(28,114),
       S( 29,116), S( 30,117), S( 31,118), S(32,118) },
     { S(-10,-18), S( -8,-13), S( -6, -7), S(-3, -2), S(-1,  3), S( 1,  8), // Queens
       S(  3, 13), S(  5, 19), S(  8, 23), S(10, 27), S(12, 32), S(15, 34),
       S( 16, 35), S( 17, 35), S( 18, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35), S( 20, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35), S( 20, 35), S(20, 35), S(20, 35), S(20, 35),
       S( 20, 35), S( 20, 35) }
  };
I suggest to change it to reduce the numbers of every line by
15(for 0 squares),10 (for 1 squares),6 (for 2 squares) 3 (for 3 squares),
1 (for 4 squares)

I wonder if somebody tested this idea or is interested in testing it.
what is the S ()? What is that macro doing? is that changing the values and composing only one of with both?

I cannot comment without knowing that the above is doing, but I agree that mobility should NOT be linear, but the curvature should be the opposite of what you suggest!

It is more critical to have a piece that goes from 0 to 2 squares, than going from 12 to 14.

Miguel
I think that it is exactly what I suggest and I suggested to increase the difference between 0 squares and 2 squares by 15-6=9 units of evaluation and to increase the difference bewtween 2 squares and 4
squares by 6-1=5 units of evaluation.

Note that for big numbers this is already the case in stockfish and there is
practically no difference between knight that control 7 squares and knight that control 8 squares and very little difference between rook that controls 13 squares and rook that control 14 squares.
Uri Blass
Posts: 10267
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: mobility evaluation of stockfish

Post by Uri Blass »

Damir wrote:As Joona&Marco say: since it is your idea, why don't you try and test it ? :)
First it is not only my idea.

The only part that Don daily did not suggest was to suggest
exact numbers but the idea is clearly used by Don daily and by other programmers.

Second thing is that not everyone has to test ideas and people are free to suggest ideas without testing them.

Third thing is that even if I think to test something then asking if people tested it can be productive to avoid spending time on testing ideas that give nothing or ideas that other already test.