Most common/top evaluation features?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: How to measure mobility?

Post by bob »

BeyondCritics wrote:In responses to the question, nearly every programmer had "mobility" on top of its list. It must be an important concept.
However looking up sources (https://chessprogramming.wikispaces.com/Mobility) it is not altogether clear, how to measure "mobility" correctly.

So for starters: How would you recommened to implement the concept of mobility? Any pitfalls?
Two issues:

(1) which squares do you count? Any square the piece can reach legally, any square it can reach pseudo-legally? Any squares except those attacked by enemy pawn? Any square except those attacked by an enemy piece of lesser value? And do you count all squares equally, or favor central squares more, etc?

(2) what is the cost computationally? This is a biggie because you do this for every node reached in the q-search at least.

Often you choose to do a sub-optimal mobility because of the higher cost of doing it more accurately.
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: How to measure mobility?

Post by Daniel Anulliero »

I compute only the mobility for knights in ISA (I have no mobility in my old engines Jars and yoda) just every squares , every knights can reach.
For the bishop I check the diagonals "open" (0 pawns on it) or séminaire open (1 pawn on it)
I dont know if it's a good idea...
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to measure mobility?

Post by hgm »

I always wondered whether mobility isn't just a poor-man's substitute for 'board control'. These are partly doing the same thing. But where more-advanced mobilty calculations value extra moves less on a piece that already has many moves, board control should devaluate extra moves to a square that has already more moves to it, or moves with lower-valued pieces to it.
op12no2
Posts: 490
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: How to measure mobility?

Post by op12no2 »

When computing mobility is it worth trying to favour pieces with little or no mobility over those with existing good mobility. May be with a multiplier that goes 8,4,2,1,1,1,1.... or something.
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to measure mobility?

Post by hgm »

I think this is the standard method. E.g. Fruit gives 4 mobility points per move for B and N, 2 for R and 1 for Q. But this can be interpreted in many ways. Like that an extra move on a piece that already has many moves is worth less. But also as that moves of a valuable piece like Queen are much less likely to be acceptable moves in practice, because statistically many of them will go to squares covered by a Rook or minor, to which in practice you cannot go at all without immediately losing the game. While for Knights a much larger fraction of its legal moves will go to acceptable square.
kbhearn
Posts: 411
Joined: Thu Dec 30, 2010 4:48 am

Re: How to measure mobility?

Post by kbhearn »

hgm wrote:I always wondered whether mobility isn't just a poor-man's substitute for 'board control'. These are partly doing the same thing. But where more-advanced mobilty calculations value extra moves less on a piece that already has many moves, board control should devaluate extra moves to a square that has already more moves to it, or moves with lower-valued pieces to it.
I'd have to say mobility is more than just board control. A mobile piece is more than just the squares it controls, it's the options to control different ones and this is where nonlinear safe mobility makes a lot of sense. a low mobility bishop not only doesn't control much now, it doesn't have many options to move to improve what it controls. Multilayered mobility i would think would be an improvement on this: how many squares can i get to within two moves to 'safe' squares? I think some variation of this would be particularly useful to knights and detecting knights on a bad tour (i think the squares it could get to should be weighted or possibly just filtered in addition so that the ability of a black knight on d7 to move to a8 in two moves is not considered as valuable as the ability to make it to e4).

I also disagree with your notion that multiple attacks on the same square are somewhat redundant in the case of board control as it's the foundation of most attacks to oversupport a key advanced square and then land a piece there. Some squares are certainly more valuable to control than others though.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: How to measure mobility?

Post by bob »

hgm wrote:I always wondered whether mobility isn't just a poor-man's substitute for 'board control'. These are partly doing the same thing. But where more-advanced mobilty calculations value extra moves less on a piece that already has many moves, board control should devaluate extra moves to a square that has already more moves to it, or moves with lower-valued pieces to it.
There's a lot of redundancy. For example "rook on open file". What better way to improve mobility? Centralizing knights? Same thing.
op12no2
Posts: 490
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: How to measure mobility?

Post by op12no2 »

hgm wrote:I think this is the standard method. E.g. Fruit gives 4 mobility points per move for B and N, 2 for R and 1 for Q. But this can be interpreted in many ways. Like that an extra move on a piece that already has many moves is worth less. But also as that moves of a valuable piece like Queen are much less likely to be acceptable moves in practice, because statistically many of them will go to squares covered by a Rook or minor, to which in practice you cannot go at all without immediately losing the game. While for Knights a much larger fraction of its legal moves will go to acceptable square.
OK thanks. What about for the same piece. Say the mob multiplier is 4 for a knight as you describe and there are 2 on the board, one with 6 moves and the other with 1 move. Let's say after some move, that changes to 7 and 2. AIUI that would be evaluated as 4*7 and 4*2 - but - what I was wondering is - how about evaluating that as say (A*4 + B*4 + C*4 + D*4 + 4 + 4 + 4) and (A*4 + B*4) to overtly try and give the knight with little mobility a kick. Or does it not follow that that is necessarily an advantage; or maybe it doesn't even make sense...
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to measure mobility?

Post by hgm »

I think it does make sense, and I believe that some programs actually do that. The best way to implement it would be to use the number of moves of each piece as an index in a table for that piece type. Then you can tune the weight of the 1st, 2nd, ... move of the piece all independently. And presumably the 1st move would be worth a lot more than the 8th, for a Knight.
op12no2
Posts: 490
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: How to measure mobility?

Post by op12no2 »

hgm wrote:I think it does make sense, and I believe that some programs actually do that. The best way to implement it would be to use the number of moves of each piece as an index in a table for that piece type. Then you can tune the weight of the 1st, 2nd, ... move of the piece all independently. And presumably the 1st move would be worth a lot more than the 8th, for a Knight.
OK, thanks; seems like a good plan, since it's essentially nil overhead; just more tuning. There again I made the huge mistake of developing Lozza based on 40/1 games so when it started playing at 3'+n", 40/4 and 40/25 it got beat by engines it was previously winning against; so it all needs re-tuning anyway...