I'm going to test the following parameters:
Every safe square that a piece can reach on the board, time this constant, divided by 100.
MOBILITY_SAFE_MULTI = 500
Safe squares = 4
Equals 500*4/100 = 20 centipawns bonus
Every safe squares, plus every nonsafe square (i.e. squares that are protected by less valued pieces). Same equation as above.
If the piece on has one safe square it's penalized by the rank it's on plus 1. (and weighed as above)
If the piece has no safe squares it's penalized by the rank it's on plus 1. (and weighed as above)
After 1100 games I got the following numbers
MOBILITY_SAFE_MULTI = -141
MOBILITY_UNSAFE_MULTI = 865
MOBILITY_ONE_TRAPPED_MULTI = -174
MOBILITY_ZERO_TRAPPED_MULTI = -133
Not too happy about those negative numbers, but this would result in in the following scoring for say bishop with 4 safe and 1 unsafe squares (quite reasonable assumption):
-141*4/100 + 865*5/100 = 39
So basically it's favoring the unsafe squares and trying to reduce the safe squares evaluation. (I wonder if this is indicative of all squares, rather than safe/unsafe squares being preferable)
I'll leave it overnight and see what it comes up with.