This version of Stockfish:
http://cap.connx.com/chess-engines/new- ... x64_ja.rar
Scales null move smoothly. I get about +150 Elo so far in my testing. How about yours?
Smooth scaling stockfish
Moderators: hgm, Rebel, chrisw
-
- Posts: 12542
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
-
- Posts: 1154
- Joined: Fri Jun 23, 2006 5:18 am
Re: Smooth scaling stockfish
I am not sure what you mean by smooth scaling, and don't see any attached source code.Dann Corbit wrote:This version of Stockfish:
http://cap.connx.com/chess-engines/new- ... x64_ja.rar
Scales null move smoothly. I get about +150 Elo so far in my testing. How about yours?
-Sam
-
- Posts: 12542
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Smooth scaling stockfish
Here are the changes from version 1.61:BubbaTough wrote:I am not sure what you mean by smooth scaling, and don't see any attached source code.Dann Corbit wrote:This version of Stockfish:
http://cap.connx.com/chess-engines/new- ... x64_ja.rar
Scales null move smoothly. I get about +150 Elo so far in my testing. How about yours?
-Sam
http://cap.connx.com/chess-engines/new-approach/sfc.zip
Note that I do not have the 1.62 sources, which have additional corrections.
I guess that the curve can be greatly improved. It was a first hack eyeball guestimate.
-
- Posts: 12542
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Smooth scaling stockfish
I think probably that my MS build will be needed to see the improvement, since it does not come into play unless the macro SMOOTH_SCALING is defined and I neglected to mention it to Jim. My MS build:Dann Corbit wrote:Here are the changes from version 1.61:BubbaTough wrote:I am not sure what you mean by smooth scaling, and don't see any attached source code.Dann Corbit wrote:This version of Stockfish:
http://cap.connx.com/chess-engines/new- ... x64_ja.rar
Scales null move smoothly. I get about +150 Elo so far in my testing. How about yours?
-Sam
http://cap.connx.com/chess-engines/new-approach/sfc.zip
Note that I do not have the 1.62 sources, which have additional corrections.
I guess that the curve can be greatly improved. It was a first hack eyeball guestimate.
http://cap.connx.com/chess-engines/new- ... sh.exe.bz2
The source changes:
http://cap.connx.com/chess-engines/new-approach/sfc.zip
The only thing changed in misc.cpp is the version number (I added an 's' so that the difference would be known).
-
- Posts: 1154
- Joined: Fri Jun 23, 2006 5:18 am
Re: Smooth scaling stockfish
Ahh, gotcha. I did something similar in LearningLemming, and I think I got the idea from something Michael Sherwin was trying in Romi (though I think he scaled it differently) so I imagine Romi also does it. Its nice to see it work for someone else too. It always amazes me that some ideas can work so well for some authors, and not for others.Dann Corbit wrote:Here are the changes from version 1.61:BubbaTough wrote:I am not sure what you mean by smooth scaling, and don't see any attached source code.Dann Corbit wrote:This version of Stockfish:
http://cap.connx.com/chess-engines/new- ... x64_ja.rar
Scales null move smoothly. I get about +150 Elo so far in my testing. How about yours?
-Sam
http://cap.connx.com/chess-engines/new-approach/sfc.zip
Note that I do not have the 1.62 sources, which have additional corrections.
I guess that the curve can be greatly improved. It was a first hack eyeball guestimate.
-Sam
-
- Posts: 12542
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Smooth scaling stockfish
I made two simple changes to the code. First, I used TT entries slightly more (because I figured that a hash table entry with search {no matter how shallow} was better than a quick evaluation estimate. Second, I scale the null move depth as a function of difference between beta and evaluation estimate and also of depth.
Anyway, all significant changes are in this patch of code:
Anyway, all significant changes are in this patch of code:
Code: Select all
// search() is the search function for zero-width nodes.
Value search(Position& pos, SearchStack ss[], Value beta, Depth depth,
int ply, bool allowNullmove, int threadID, Move excludedMove) {
assert(beta >= -VALUE_INFINITE && beta <= VALUE_INFINITE);
assert(ply >= 0 && ply < PLY_MAX);
assert(threadID >= 0 && threadID < ActiveThreads);
Move movesSearched[256];
EvalInfo ei;
StateInfo st;
const TTEntry* tte;
Move ttMove, move;
Depth ext, newDepth;
Value approximateEval, nullValue, value, futilityValue, futilityValueScaled;
bool isCheck, useFutilityPruning, singleReply, moveIsCheck, captureOrPromotion, dangerous;
bool mateThreat = false;
int moveCount = 0;
Value bestValue = -VALUE_INFINITE;
if (depth < OnePly)
return qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
// Initialize, and make an early exit in case of an aborted search,
// an instant draw, maximum ply reached, etc.
init_node(ss, ply, threadID);
// After init_node() that calls poll()
if (AbortSearch || thread_should_stop(threadID))
return Value(0);
if (pos.is_draw())
return VALUE_DRAW;
if (ply >= PLY_MAX - 1)
return pos.is_check() ? quick_evaluate(pos) : evaluate(pos, ei, threadID);
// Mate distance pruning
if (value_mated_in(ply) >= beta)
return beta;
if (value_mate_in(ply + 1) < beta)
return beta - 1;
// We don't want the score of a partial search to overwrite a previous full search
// TT value, so we use a different position key in case of an excluded move exsists.
Key posKey = excludedMove ? pos.get_exclusion_key() : pos.get_key();
// Transposition table lookup
tte = TT.retrieve(posKey);
ttMove = (tte ? tte->move() : MOVE_NONE);
if (tte)
{
if (ok_to_use_TT(tte, depth, beta, ply))
{
ss[ply].currentMove = ttMove; // Can be MOVE_NONE
return value_from_tt(tte->value(), ply);
}
else
{
approximateEval = value_from_tt(tte->value(), ply); // Should be a very good estimate
}
}
else
approximateEval = quick_evaluate(pos); // only call this if we miss in the TT altogether
isCheck = pos.is_check();
// Null move search
if ( allowNullmove
&& depth > OnePly
&& !isCheck
&& !value_is_mate(beta)
&& ok_to_do_nullmove(pos)
&& approximateEval >= beta - NullMoveMargin)
{
ss[ply].currentMove = MOVE_NULL;
pos.do_null_move(st);
#ifdef SMOOTH_REDUCTION
double delta = approximateEval - beta;
delta = max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int R = int(r);
#else
// Null move dynamic reduction based on depth
int R = (depth >= 5 * OnePly ? 4 : 3);
// Null move dynamic reduction based on value
if (approximateEval - beta > PawnValueMidgame)
R++;
#endif
nullValue = -search(pos, ss, -(beta-1), depth-R*OnePly, ply+1, false, threadID);
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: Smooth scaling stockfish
I never got that idea to work, but I did test it quite a few years ago when depths were not as significant. In fact, Ernst and I developed the "adaptive null-move idea" independently. John Stanback had suggested the basics for the idea around 1995 or so. Initially it was a question of R=1 or R=2, but eventually became R=2 or R=3. I used to have fractional plies, and tried a gradual and continuous (smooth) reduction as it approached the frontier nodes, but never found something that worked any better than the simple R=3 closer to the root, R=2 closer to the leaves.Dann Corbit wrote:This version of Stockfish:
http://cap.connx.com/chess-engines/new- ... x64_ja.rar
Scales null move smoothly. I get about +150 Elo so far in my testing. How about yours?
-
- Posts: 10312
- Joined: Thu Mar 09, 2006 12:37 am
- Location: Tel-Aviv Israel
Re: Smooth scaling stockfish
<snipped>
The idea is that the difference between the quick evaluation and the real evaluation is usually in the same direction and if some side has positional advantage that the quick evaluation does not see then it is going to continue to have the same positional evaluation later.
It may be possible simply to improve the quick evaluation estimate by having an average number for the difference between the real evaluation and the quick evaluation from white point of view and adding this number to the estimate.
I guess that it is not going to be expensive to do quick evaluation every time that you do the expensive evaluation(because the expensive part is the not quick evaluation that you already did).
Uri
I think that it may be possible to make another improvement.Dann Corbit wrote:I made two simple changes to the code. First, I used TT entries slightly more (because I figured that a hash table entry with search {no matter how shallow} was better than a quick evaluation estimate. Second, I scale the null move depth as a function of difference between beta and evaluation estimate and also of depth.
The idea is that the difference between the quick evaluation and the real evaluation is usually in the same direction and if some side has positional advantage that the quick evaluation does not see then it is going to continue to have the same positional evaluation later.
It may be possible simply to improve the quick evaluation estimate by having an average number for the difference between the real evaluation and the quick evaluation from white point of view and adding this number to the estimate.
I guess that it is not going to be expensive to do quick evaluation every time that you do the expensive evaluation(because the expensive part is the not quick evaluation that you already did).
Uri
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: Smooth scaling stockfish
Dann Corbit wrote:Here are the changes from version 1.61:BubbaTough wrote:I am not sure what you mean by smooth scaling, and don't see any attached source code.Dann Corbit wrote:This version of Stockfish:
http://cap.connx.com/chess-engines/new- ... x64_ja.rar
Scales null move smoothly. I get about +150 Elo so far in my testing. How about yours?
-Sam
http://cap.connx.com/chess-engines/new-approach/sfc.zip
Note that I do not have the 1.62 sources, which have additional corrections.
I guess that the curve can be greatly improved. It was a first hack eyeball guestimate.
Ahaaaaa you changed the indentation of the functions !!!
In a project where more then one people work changing indentation of the whole file is never a good idea. It becomes difficult to spot the real differences for no gain at all.
Anyhow thanks !!! I will test for sure
-
- Posts: 613
- Joined: Sun Jan 18, 2009 7:03 am
Re: Smooth scaling stockfish
+150elo???
If we can get even close to this, I think that this is really great news for whole chess community!!
Balancing this equation is perhaps the next challenge? I need to think about this...
If we can get even close to this, I think that this is really great news for whole chess community!!
Code: Select all
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
Joona Kiiski