IFD vs IID

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Sergei S. Markoff
Posts: 227
Joined: Mon Sep 12, 2011 11:27 pm
Location: Moscow, Russia

IFD vs IID

Post by Sergei S. Markoff »

IID is one of the imporant parts of most modern engines. SmarThink, for example, spending a huge part of it's search in IID subtrees. I'm using IID when depth >= 5 plies, no TT move and in pv node or if static_eval > alpha – 50.
One of the interesting questions — a reduction factor. Previously I user 4 plies for exact nodes and 10 plies for remaining ones, but IID depth should be at least 1 ply (not quiescent).
But is it really neccessary to use reducted depth here? One of the ideas that working is to add also max depth value — IID subtree depth should not exceed 4 plies for pv node and 2 plies for non-pv. For me it works.
Final variation is something like internal fixed deepening (IFD) :)
I think someone should try it in SF))

Code: Select all

	// IID

	if (Depth >= 5 * INCPLY && !TranspositionMove)
	{
		if (node_type == NODE_TYPE_EXACT)
		{
			if &#40;static_eval < beta + 50&#41;
			&#123;
				NextSearch&#40;alpha - 50, beta + 50, 0, FALSE, NODE_TYPE_EXACT&#41;;
				if &#40;thread_board->stopped&#41; return 0;
			&#125;
			else
			&#123;
				thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove = 0;
			&#125;

			if (!thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove&#41;
			&#123;
				int iid_depth = MIN&#40;4 * INCPLY, MAX&#40;INCPLY, Depth - 4 * INCPLY&#41;);
				best = NextSearch&#40;alpha - 50, beta + 50, iid_depth, FALSE, NODE_TYPE_EXACT&#41;;

				if &#40;thread_board->stopped&#41; return 0;

				if &#40;best <= alpha - 50&#41;
				&#123;
					NextSearch&#40;-INFINITY, beta, iid_depth, FALSE, NODE_TYPE_EXACT&#41;;
					if &#40;thread_board->stopped&#41; return 0;
				&#125;
			&#125;

			TranspositionMove = thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove;
			thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove = 0;
		&#125;
		else if &#40;static_eval + 50 > alpha&#41;
		&#123;
			if &#40;static_eval < beta + 50&#41;
			&#123;
				NextSearch&#40;alpha - 100, beta, 0, FALSE, node_type&#41;;
				if &#40;thread_board->stopped&#41; return 0;
			&#125;
			else
			&#123;
				thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove = 0;
			&#125;

			if (!thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove&#41;
			&#123;
				int iid_depth = MIN&#40;2 * INCPLY, MAX&#40;INCPLY, Depth - 10 * INCPLY&#41;);
				best = NextSearch&#40;alpha - 100, beta, iid_depth, FALSE, node_type&#41;;
				if &#40;thread_board->stopped&#41; return 0;

				if &#40;best <= alpha - 100&#41;
				&#123;
					NextSearch&#40;-INFINITY, beta, iid_depth, FALSE, node_type&#41;;
					if &#40;thread_board->stopped&#41; return 0;
				&#125;
			&#125;

			TranspositionMove = thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove;
			thread_tree&#91;threads&#91;CURRENT_THREAD&#93;.ply&#93;.LastThreatMove = 0;
		&#125;
	&#125;
[/code]
The Force Be With You!
User avatar
hgm
Posts: 27813
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: IFD vs IID

Post by hgm »

I often wondered how sensible it is to use a TT move at full depth, when the listed score is not enough to effect a curtoff (becasue the root score changed since the previous search). The chance that the move will fail low is appreciable, and you would then be blindly looking for an alterative at full depth.
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: IFD vs IID

Post by Joerg Oster »

Why don't you simply use 4 * INCPLY for NODE_TYPE_EXACT and 2 * INCPLY otherwise?
Jörg Oster