Evaluation idea

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Evaluation idea

Post by Kempelen »

I have been making progress in my (weak) engine "Rodin". From last release, in the develpment one, I think it has improved around 75 or 100 elo points. During tests I had an evaluation idea with I am currently testing. It is possible that this idea has been used for somebody before me.....

The idea is simple: In normal condicions we add a bonus/malus for each evaluation term. What I have been testing is have a counter for each weakness I found (currently only for pawn and king-safety weakness). At the end of the evaluation part I add a malus depending how many weakness I have. I add zero if only 0 or 1 weakness, and a few centipawns for each weakness more than zero.

The idea is than having two weakness is worse than the addition of both, but having cero or only one has no addition effect;

I dont know If I am explaining this well. In code it would be:

Code: Select all

int deb[20] = { 0, 0, -5, -10, -16, -22, -29, ....etc }
int n_w = 0;  /* counter for weakness */

if (double_pawns) n_w++;
if (isolated_pawn) n_w++;
if (king_is_not_safe) n_w++;
etc....

final_score += deb[n_w];
return final_score;
In my test I have only seen little improvements, but what I like is that Rodin is playing in a more dynamic way, and that enjoy to me. :)

Have anyone tried this before? what your opinion about this idea?.

Best regards,
Fermín
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
frankp
Posts: 233
Joined: Sun Mar 12, 2006 3:11 pm

Re: Evaluation idea

Post by frankp »

Yes.

Are you double counting eg because you already give penalties for each structural weakness which are summed - or are you scaling as in
n * f(n)
where n is the number of weaknesses.

If seems logical that if you have several weaknesses your position is under strain and may crack in the future. However, sometimes one 'big' weakness is worse than several smaller ones eg king exposed compared to several backward pawns.

Testing is the key and part of the fun of chess programming. [Do I mean fun or addiction ;-) ]
Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 9:19 pm
Location: Oslo, Norway

Re: Evaluation idea

Post by Tord Romstad »

Kempelen wrote:The idea is than having two weakness is worse than the addition of both, but having cero or only one has no addition effect;

I dont know If I am explaining this well. In code it would be:

Code: Select all

int deb[20] = { 0, 0, -5, -10, -16, -22, -29, ....etc }
int n_w = 0;  /* counter for weakness */

if (double_pawns) n_w++;
if (isolated_pawn) n_w++;
if (king_is_not_safe) n_w++;
etc....

final_score += deb[n_w];
return final_score;
In my test I have only seen little improvements, but what I like is that Rodin is playing in a more dynamic way, and that enjoy to me. :)

Have anyone tried this before?
Yes, I did exactly the same in Glaurung 1:

Code: Select all

// Penalty for multiple pawn structure defects:
const int MdpPenalty[9] = {0, 0, 3, 10, 25, 50, 60, 60, 60};
In the pawn structure evaluation, I counted the number of weaknesses, and in addition to having a penalty for each weakness by itself, I used the MdpPenalty[] array to add an additional penalty for multiple weaknesses.

I also did something similar for penalizing multiple passive pieces:

Code: Select all

const int MultiplePassivePenalty[8] = {0, 2, 6, 20, 50, 80, 120, 120};
The evaluation function counts the number of passive pieces for each side (a piece is defined to be passive if its mobility is below a certain threshold, which depends on the piece type), and penalizes multiple passive pieces by the scores in the MultiplePassivePenalty[] array.
what your opinion about this idea?.
I don't know, but it's certainly worth trying. That I don't use it in Glaurung 2 yet is not because I no longer believe in the idea, but simply because I haven't found the time to try it yet. It is on my ever-growing todo list.

Tord
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Evaluation idea

Post by bob »

Kempelen wrote:I have been making progress in my (weak) engine "Rodin". From last release, in the develpment one, I think it has improved around 75 or 100 elo points. During tests I had an evaluation idea with I am currently testing. It is possible that this idea has been used for somebody before me.....

The idea is simple: In normal condicions we add a bonus/malus for each evaluation term. What I have been testing is have a counter for each weakness I found (currently only for pawn and king-safety weakness). At the end of the evaluation part I add a malus depending how many weakness I have. I add zero if only 0 or 1 weakness, and a few centipawns for each weakness more than zero.

The idea is than having two weakness is worse than the addition of both, but having cero or only one has no addition effect;

I dont know If I am explaining this well. In code it would be:

Code: Select all

int deb[20] = { 0, 0, -5, -10, -16, -22, -29, ....etc }
int n_w = 0;  /* counter for weakness */

if (double_pawns) n_w++;
if (isolated_pawn) n_w++;
if (king_is_not_safe) n_w++;
etc....

final_score += deb[n_w];
return final_score;
In my test I have only seen little improvements, but what I like is that Rodin is playing in a more dynamic way, and that enjoy to me. :)

Have anyone tried this before? what your opinion about this idea?.

Best regards,
Fermín
An "exponential" evaluation term is pretty common. And you can take it further. In Crafty, I count up the "defects" in the king's pawn shelter, and then I count up the number of close attacks by pieces (sliders attack squares near the king, non-sliders close to the king, etc). I then combine those via a 2d array so that more of either increases the penalty, more of both really increases the penalty...