Page 2 of 2

Re: Outpost evaluation

Posted: Sun Mar 18, 2012 11:29 pm
by PK
The term "outpost" is confusing, because it is close, but not identical, to a piece in the hole of enemy pawn structure. Nimzowitsch in "Mein System" required a defending pawn and a half-open file, showing explicit examples like white pawns on c2 and e4, black pawns on c7, d6 and e5, white knight on d5. Black might play c7-c6, but then he is saddled with an undefended pawn on d6.

Having said that, I was always better off evaluating "holes" rather than "outposts" (but adding additional bonus for a defending pawn). Furthermore, I know of no program making use of a "half open file" requirement.

Re: Outpost evaluation

Posted: Mon Mar 19, 2012 1:20 pm
by Rebel
lucasart wrote:
Rebel wrote:I have a parameter for Knight outposts (I don't do Bishop outpost) and my notes state:

[Strong Squares = 125] 0=46.0% | 100=50.0% | 200=48.2% | 150=48.7%

Meaning, when I remove it (value 0) it gives a drop of 4% (28 elo).

Perhaps your bonus is too high?
Seems you're right:
1/ bishop outpost are probably not a great idea. knight only seems to be better.
2/ my values were too high. As a human player, I tend to think that an outposted enemy knight into my territory, that I can't remove by pawns or exchange is a real menace, sometimes worth a pawn perhaps (maybe even the exchange in certain situations). But that's essentially my "risk aversion": I am worried to make calculation mistakes with this constant menace, so I prefer to pay the price of a pawn to get rid of it. A computer on the other hand makes much less calculation mistakes, so it should have a much smaller risk aversion, hence the smaller value :D
You got it :wink:

Typical additions to knight outposts:

1. Don't bonus when the opponent has less than 5 pawns.

2. Extra bonus if the knight is well covered, the opponent can't make a simple R vs N+P sacrifice.

3. Extra bonus if the knight blocks a pawn of the opponent.

Re: Outpost evaluation

Posted: Tue Mar 20, 2012 8:14 am
by micron
Rebel wrote: 1. Don't bonus when the opponent has less than 5 pawns
Thanks for the hint. My previous outpost code was barely effective (less than 5 Elo).
After I added that condition it began working much better, well enough to be tunable, and I ended up with nearly 20 Elo.

Re: Outpost evaluation

Posted: Fri Apr 13, 2012 10:00 pm
by gleperlier
Hi,

So an idea could be :

#define KNIGHT_OUTPOST_BONUS 10

#0. Bonus only if defended by one pawn
#1. Extra bonus if defended by 2 pawns +10
#2. Don't bonus when the opponent has less than 5 pawns -10
#3. Extra bonus if the knight blocks a pawn of the opponent +10
#4. Extra bonus if the Knight is on half-open file +10

Would someone be very nice and post here a code that can be copy/past in Tom Kerrigan's Simple Chess Program (TSCP) eval ? or send me by pm ?

Cheers,

Gab

Re: Outpost evaluation

Posted: Sat Apr 14, 2012 3:34 am
by Ferdy
gleperlier wrote:Hi,

So an idea could be :

#define KNIGHT_OUTPOST_BONUS 10

#0. Bonus only if defended by one pawn
#1. Extra bonus if defended by 2 pawns +10
#2. Don't bonus when the opponent has less than 5 pawns -10
#3. Extra bonus if the knight blocks a pawn of the opponent +10
#4. Extra bonus if the Knight is on half-open file +10

Would someone be very nice and post here a code that can be copy/past in Tom Kerrigan's Simple Chess Program (TSCP) eval ? or send me by pm ?

Cheers,

Gab
Try this out for a start, basic knight not attacked by enemy pawn and knight protected by friendly pawn, note this is only for white, you take care for the black :) .

Code: Select all

case KNIGHT:
					score[LIGHT] += knight_pcsq[i];

					//knight outpost for white
					//consider only if it is located inside rank 4 to 6 and file b to g (std board)
					if&#40;COL&#40;i&#41; >= 1 && COL&#40;i&#41; <= 6 && ROW&#40;i&#41; <= 4 && ROW&#40;i&#41; >= 2&#41;&#123;
						//if square i is not attacked by enemy pawn
						if&#40;piece&#91;i-9&#93; != PAWN || color&#91;i-9&#93; != DARK&#41;&#123;
							if&#40;piece&#91;i-7&#93; != PAWN || color&#91;i-7&#93; != DARK&#41;&#123;

								//visual debug
								//print_board&#40;);
								//printf&#40;"square %d, is not attacked by enemy pawn\n", i&#41;;

								score&#91;LIGHT&#93; += 4;

								//add bonus if this knight is protected by friendly pawn
								//left pawn
								if&#40;piece&#91;i+7&#93; == PAWN && color&#91;i+7&#93; == LIGHT&#41;&#123;
									score&#91;LIGHT&#93; += 2;
									//visual debug
								&#125;
								//right pawn
								if&#40;piece&#91;i+9&#93; == PAWN && color&#91;i+9&#93; == LIGHT&#41;&#123;
									score&#91;LIGHT&#93; += 2;
									//visual debug
								&#125;
							&#125;
						&#125;
					&#125;

					break;

Re: Outpost evaluation

Posted: Sat Apr 14, 2012 6:16 am
by bob
lucasart wrote:
Rebel wrote:I have a parameter for Knight outposts (I don't do Bishop outpost) and my notes state:

[Strong Squares = 125] 0=46.0% | 100=50.0% | 200=48.2% | 150=48.7%

Meaning, when I remove it (value 0) it gives a drop of 4% (28 elo).

Perhaps your bonus is too high?
Seems you're right:
1/ bishop outpost are probably not a great idea. knight only seems to be better.
2/ my values were too high. As a human player, I tend to think that an outposted enemy knight into my territory, that I can't remove by pawns or exchange is a real menace, sometimes worth a pawn perhaps (maybe even the exchange in certain situations). But that's essentially my "risk aversion": I am worried to make calculation mistakes with this constant menace, so I prefer to pay the price of a pawn to get rid of it. A computer on the other hand makes much less calculation mistakes, so it should have a much smaller risk aversion, hence the smaller value :D
Bishop outpost can work. We use one in Crafty, and removing it hurts. But like all eval terms, it requires tuning.

Re: Outpost evaluation

Posted: Sat Apr 14, 2012 9:24 am
by gleperlier
Thanks Ferdinand !

Gab

Re: Outpost evaluation

Posted: Sat Apr 14, 2012 4:28 pm
by lucasart
Ferdy wrote: Try this out for a start, basic knight not attacked by enemy pawn and knight protected by friendly pawn, note this is only for white, you take care for the black :) .

Code: Select all

case KNIGHT&#58;
					score&#91;LIGHT&#93; += knight_pcsq&#91;i&#93;;

					//knight outpost for white
					//consider only if it is located inside rank 4 to 6 and file b to g &#40;std board&#41;
					if&#40;COL&#40;i&#41; >= 1 && COL&#40;i&#41; <= 6 && ROW&#40;i&#41; <= 4 && ROW&#40;i&#41; >= 2&#41;&#123;
						//if square i is not attacked by enemy pawn
						if&#40;piece&#91;i-9&#93; != PAWN || color&#91;i-9&#93; != DARK&#41;&#123;
							if&#40;piece&#91;i-7&#93; != PAWN || color&#91;i-7&#93; != DARK&#41;&#123;

								//visual debug
								//print_board&#40;);
								//printf&#40;"square %d, is not attacked by enemy pawn\n", i&#41;;

								score&#91;LIGHT&#93; += 4;

								//add bonus if this knight is protected by friendly pawn
								//left pawn
								if&#40;piece&#91;i+7&#93; == PAWN && color&#91;i+7&#93; == LIGHT&#41;&#123;
									score&#91;LIGHT&#93; += 2;
									//visual debug
								&#125;
								//right pawn
								if&#40;piece&#91;i+9&#93; == PAWN && color&#91;i+9&#93; == LIGHT&#41;&#123;
									score&#91;LIGHT&#93; += 2;
									//visual debug
								&#125;
							&#125;
						&#125;
					&#125;

					break;
Thank you Fernando. After so many failed attempts, I finally got a significant improvement with an implementation inspired by your code. Here's what I do in case anyone is interested:
1/ if a knight is in the outpost zone (File C->F, Rank 4->6), bonus +2 (centipawns)
2/ if a knight that verifies 1/ is also defended by a friendly pawn then I score an additional +3

And I did the same with bishops with +1 and +2 instead of +2 and +3, and that gave a further (small but significant).

My code is a bit more bitboard oriented and avoids loops:

Code: Select all

	static const uint64_t OutPostZone&#91;NB_COLOR&#93; = &#123;
		0x00003C3C3C000000ULL,	// Rank 4->6, File C->F
		0x0000003C3C3C0000ULL	// Rank 3->5, File C->F
	&#125;;
...
		/* Knight outposts */
		fss = B->b&#91;us&#93;&#91;Knight&#93; & OutPostZone&#91;us&#93; & ~B->st->attacks&#91;them&#93;&#91;Pawn&#93;;
		if (&#40;count = count_bit&#40;fss&#41;)) &#123;
			e->op&#91;us&#93; += count * 2;
			e->eg&#91;us&#93; += count * 2;
			
			if (&#40;count = count_bit&#40;fss & B->st->attacks&#91;us&#93;&#91;Pawn&#93;))) &#123;
				e->op&#91;us&#93; += count * 3;
				e->eg&#91;us&#93; += count * 3;
			&#125;
		&#125;

		/* Bishop outposts */
		fss = B->b&#91;us&#93;&#91;Bishop&#93; & OutPostZone&#91;us&#93; & ~B->st->attacks&#91;them&#93;&#91;Pawn&#93;;
		if (&#40;count = count_bit&#40;fss&#41;)) &#123;
			e->op&#91;us&#93; += count;
			e->eg&#91;us&#93; += count;
			
			if (&#40;count = count_bit&#40;fss & B->st->attacks&#91;us&#93;&#91;Pawn&#93;))) &#123;
				e->op&#91;us&#93; += count * 2;
				e->eg&#91;us&#93; += count * 2;
			&#125;
		&#125;

Re: Outpost evaluation

Posted: Sat Apr 14, 2012 6:34 pm
by Ferdy
Another flavor is even if that piece is not on the outpost zone, if it is located instead in the enemyKingWeakZone, perhaps this can also be applied,
but you have to review if you already have a king tropism scoring.