Changes

Jump to: navigation, search

Razoring

14,388 bytes added, 20:48, 29 April 2018
Created page with "'''Home * Search * Selectivity * Reductions * Razoring''' FILE:William of Ockham - Logica 1341.jpg|border|right|thumb|[https://en.wikipedia.org/wi..."
'''[[Main Page|Home]] * [[Search]] * [[Selectivity]] * [[Reductions]] * Razoring'''

[[FILE:William of Ockham - Logica 1341.jpg|border|right|thumb|[https://en.wikipedia.org/wiki/Occam%27s_razor Occam's razor] <ref>[https://en.wikipedia.org/wiki/William_of_Ockham William of Ockham] – Sketch labeled "frater Occham iste", from a manuscript of Ockham's Summa Logicae, 1341</ref> ]]

Unlike [[Alpha-Beta]], classical '''Razoring''' <ref>[[John Birmingham]], [[Peter Kent]] ('''1977'''). ''Tree-searching and tree-pruning techniques''. [[Advances in Computer Chess 1]], reprinted 1988 in [[Computer Chess Compendium]]</ref> [[Pruning|prunes]] branches forward, if the static evaluation of a move is less than or equal to [[Alpha]]. It assumes that from any given position my opponent will be able to find at least one move that improves his position, the [[Null Move Observation]]. There are various implementations of Razoring, somehow diminishing [[Pruning|pruning]] and [[Reductions|reductions]] near the [[Horizon Node|horizon]]. Razoring either prunes forward based on a reduced search, even the [[Quiescence Search|quiescence search]], or it reduces based on [[Evaluation|evaluation]] or quiescence search as well.

=Pre Frontier Nodes=
The idea introduced by [[John Birmingham]] and [[Peter Kent]] <ref>[[John Birmingham]], [[Peter Kent]] ('''1977'''). ''Tree-searching and tree-pruning techniques''. [[Advances in Computer Chess 1]], reprinted 1988 in [[Computer Chess Compendium]]</ref> was applied at so-called [[Pre Frontier Node|pre frontier]] (<span style="background-color: #d6d6d6;">depth = 2</span>) expected [[Node Types#ALL|All-Nodes]]. Before searching deeper, all [[Move Generation|moves were generated]], [[Make Move|made]], [[Evaluation|evaluated]], [[Unmake Move|unmade]] and then inserted inside a sorted [[Move List|move list]]. While fetching the sorted moves in decreasing order - as long as the evaluation of each move exceeds [[Alpha|alpha]] - they were tried as usual. Once a move statically does no longer improve [[Alpha|alpha]], this and all further moves (sorted below) are pruned without any further investigation.

=Deep Razoring=
There is even a more aggressive pruning technique at <span style="background-color: #d6d6d6;">depth = 4</span> nodes, called Deep Razoring. The weaker assumption is my opponent will be able to improve his position with a ''yourmove-mymove-yourmove'' sequence.
<span id="LimitedRazoring"></span>
=Limited Razoring=
[[Ernst A. Heinz]] introduced ''Limited Razoring'', pushing the idea of [[Futility Pruning|futility pruning]] one step further to pre-pre-frontier nodes (<span style="background-color: #d6d6d6;">depth = 3</span>), he combines it with the depth-reduction mechanism of deep razoring <ref>[[Ernst A. Heinz]] ('''1998'''). ''[http://people.csail.mit.edu/heinz/dt/node18.html Extended Futility Pruning].'' [[ICGA Journal#21_2|ICCA Journal, Vol. 21, No. 2]], including [http://people.csail.mit.edu/heinz/dt/node28.html Limited Razoring at Pre-Pre-Frontier Nodes]</ref> .
<pre>
fscore = mat_balance(current) + razor_margin;
if (!extend
&& (depth == PRE_PRE_FRONRIER)
&& (fscore <= alpha)
&& (opposing_pieces(current) > 3)
) depth = PRE_FRONRIER;
</pre>

=Amir Ban's Definition=
[[Amir Ban]] in a [[CCC]] discussion with [[Robert Hyatt]] on Razoring versus [[Pruning]] <ref>[https://www.stmintz.com/ccc/index.php?id=41065 Re: Razoring?] by [[Amir Ban]], [[CCC]], January 27, 1999</ref> :
Razoring is supposed to be a sort of forward pruning where rather than skipping an entire subtree, you search it to a reduced depth, typically one less than normal depth. The advantage is that you get most of the saving but with much lower risk than pruning entire subtrees. Razoring is the only forward pruning technique [[Junior]] uses, with a depth reduction of one (half-ply). Seems like [[Crafty]] uses the same definition ...

=Implementations=
==Crafty 15.17==
This code snippet appears in [[Crafty|Crafty 15.17]] <ref>[ftp://ftp.cis.uab.edu/pub/hyatt Robert Hyatt's FTP Page], <source> [ftp://ftp.cis.uab.edu/pub/hyatt/source/crafty-15.17.zip crafty-15.17.zip], search.c</ref> (~1998) <ref>[http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=439367&t=41597 Re: Razoring] by [[Sven Schüle]], [[CCC]], December 25, 2011</ref> with [[Extensions#FractionalExtensions|fractional]] reductions based on [[Evaluation|evaluation]] at [[Pre Frontier Node|pre frontier nodes]] (<span style="background-color: #d6d6d6;">depth = 2</span>), already controversially discussed between [[Vincent Diepeveen]] and [[Robert Hyatt]] in 2002 <ref>[https://www.stmintz.com/ccc/index.php?id=246598 razoring in crafty version 16.9, mid 1999] by [[Vincent Diepeveen]], August 21, 2002</ref> :
<pre>
/*
----------------------------------------------------------
| |
| now we toss in the "razoring" trick, which simply says |
| if we are doing fairly badly, we can reduce the depth |
| an additional ply, if there was nothing at the current |
| ply that caused an extension. |
| |
----------------------------------------------------------
*/
if (depth<3*INCREMENT_PLY && depth>=2*INCREMENT_PLY &&
!tree->in_check[ply] && extensions == -60) {
register int value=-Evaluate(tree,ply+1,ChangeSide(wtm),
-(beta+51),-(alpha-51));
if (value+50 < alpha) extensions-=60;
}
</pre>
==Dropping into Q-search==
A different razoring approach was proposed by [[Robert Hyatt]] in [[CCC]] <ref>[http://www.talkchess.com/forum/viewtopic.php?t=24286 Razoring...] by [[Robert Hyatt]], [[CCC]], October 09, 2008</ref> based on an idea by [[Tord Romstad]] <ref>[http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=439431&t=41597 Re: Razoring] by [[Marco Costalba]], [[CCC]], December 26, 2011</ref> , and abandoned in Crafty after cluster testing <ref>[http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=291637&t=29777 Re: futility pruning - razoring] by [[Robert Hyatt]], [[CCC]], September 16, 2009</ref> . Dropping into the [[Quiescence Search|quiescence search]] is intended inside a [[Principal Variation Search|PVS]] framework at strong expected [[Node Types#ALL|All-nodes]] near the tips (pre-pre-frontier nodes or below, <span style="background-color: #d6d6d6;">depth <= 3</span>), that is a [[Null Window|null window]] (<span style="background-color: #d6d6d6;">alpha = beta - 1</span>) is passed, and the static [[Evaluation|evaluation]] is by a margin (~three pawns) below beta (or <= alpha). If under these conditions the quiescence search confirms the fail-low characteristics, its score is trusted and returned.
<pre>
/*
************************************************************
* *
* now we try a quick Razoring test. If we are within 3 *
* plies of a tip, and the current eval is 3 pawns (or *
* more) below beta, then we just drop into a q-search *
* to try to get a quick cutoff without searching more in *
* a position where we are way down in material. *
* *
************************************************************
*/
if (razoring_allowed && depth <= razor_depth) {
if (alpha == beta - 1) { // null window ?
if (Evaluate(tree, ply, wtm, alpha, beta) + razor_margin < beta) { // likely a fail-low node ?
value = QuiesceChecks(tree, alpha, beta, wtm, ply);
if (value < beta)
return value; // fail soft
}
}
}
</pre>
==Strelka==
Similar code appears in [[Jury Osipov|Jury Osipov's]] [[Open Source Engines|open source engine]] [[Strelka|Strelka 2.0]] <ref>[http://www.sdchess.ru/download_engines.htm Download] by [http://www.sdchess.ru/ sdchess.ru]</ref> , failing a bit harder. The interesting thing is the missing <span style="background-color: #d6d6d6;">new_value < beta</span> condition in the <span style="background-color: #d6d6d6;">depth = 1</span> case. If the static [[Evaluation|evaluation]] indicates a [[Node Types#ALL|fail-low node]], but q-search [[Fail-High|fails high]], the score of the reduced fail-high search is returned, since there was obviously a winning capture raising the score, and one assumes a [[Quiet Moves|quiet move]] near the horizon will not do better <ref>[http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/8695c3373be2b379# Razoring] by [[Joe Stella]], [[Computer Chess Forums|rgcc]], August 31, 1995</ref> .

''Strelka.c line 393'' (slightly modified for clarification) [[user:GerdIsenberg]]
<pre>
value = eval + 125;
if (value < beta) {
if (depth == 1) {
new_value = qsearch(...);
return max(new_value, value);
}
value += 175;
if (value < beta && depth <= 3) {
new_value = qsearch(...);
if (new_value < beta)
return max(new_value, value);
}
}
</pre>
In the [[Computer Chess Forums|Rybka Forum]] thread on [[Strelka|Strelka 2.0]] <ref>[http://rybkaforum.net/cgi-bin/rybkaforum/topic_show.pl?tid=3006 Strelka 2.0] by [[Vasik Rajlich]], [[Computer Chess Forums|Rybka Forum]], January 11, 2008</ref> , [[Anthony Cozzie]] states on this feature <ref>[http://rybkaforum.net/cgi-bin/rybkaforum/topic_show.pl?tid=3006;pg=4 Strelka 2.0 pg 4] by [[Anthony Cozzie]], [[Computer Chess Forums|Rybka Forum]], January 11, 2008</ref> :
{| class="wikitable"
|-
| I'm also pretty amazed at how aggressively the search prunes. Not only will Strelka drop straight into the q-search on a depth-3 search, but because it orders all captures first, it will reduce almost all noncapture/check moves.
|}

=See also=
Classical Razoring is known for being risky. It likely was a progress in [[Claude Shannon|Shannon]] [[Type B Strategy|Type-B]] programs and a fixed width. Todays programs more likely rely on:
* [[Futility Pruning]]
* [[Futility Pruning#Extendedfutilityprunning|Extended Futility Pruning]]
* [[AEL-Pruning]]
* [[Null Move Pruning]]
* and various [[Reductions]] (and [[Extensions]]) depending on depth left, and probably expected node type.

=Publications=
* [[John Birmingham]], [[Peter Kent]] ('''1977'''). ''Tree-searching and tree-pruning techniques''. [[Advances in Computer Chess 1]], reprinted 1988 in [[Computer Chess Compendium]]
* [[Ernst A. Heinz]] ('''1998'''). ''[http://people.csail.mit.edu/heinz/dt/node18.html Extended Futility Pruning].'' [[ICGA Journal#21_2|ICCA Journal, Vol. 21, No. 2]], including [http://people.csail.mit.edu/heinz/dt/node28.html Limited Razoring at Pre-Pre-Frontier Nodes]

=Forum Posts=
==1995 ...==
* [https://www.stmintz.com/ccc/index.php?id=28706 limited razoring question] by [[Werner Inmann]], [[CCC]], October 03, 1998
* [https://www.stmintz.com/ccc/index.php?id=40931 Razoring?] by [[Steve Maughan]], [[CCC]], January 26, 1999
* [https://www.stmintz.com/ccc/index.php?id=64838 razoring?] by [[Scott Gasch]], [[CCC]], August 16, 1999
==2000 ...==
* [https://www.stmintz.com/ccc/index.php?id=246598 razoring in crafty version 16.9, mid 1999] by [[Vincent Diepeveen]], August 21, 2002
==2005 ...==
* [http://www.talkchess.com/forum/viewtopic.php?t=24286 Razoring...] by [[Robert Hyatt]], [[CCC]], October 09, 2008
* [http://www.talkchess.com/forum/viewtopic.php?t=29777 futility pruning - razoring] by [[Don Dailey]], [[CCC]], September 16, 2009 » [[Futility Pruning]]
* [http://www.talkchess.com/forum/viewtopic.php?t=30802 Futility pruning, Ext futility pruning and Limited Razoring] by Jesper Nielsen, [[CCC]], November 26, 2009
==2010 ...==
* [http://www.talkchess.com/forum/viewtopic.php?t=38407 Bad Pruning] by [[Onno Garms]], [[CCC]], March 13, 2011 » [[Onno]]
* [http://www.open-chess.org/viewtopic.php?f=3&t=1477&start=20#p13017 Re: Still waiting on Ed] by [[Robert Hyatt]], [[Computer Chess Forums|OpenChess Forum]], July 07, 2011 » on [[Crafty]] 22.1 vs. 23.4. differences
* [http://www.talkchess.com/forum/viewtopic.php?t=43165 futility pruning, razoring question] by [[Marco Belli]], [[CCC]], April 04, 2012 » [[Futility Pruning]]
* [http://www.talkchess.com/forum/viewtopic.php?t=46130 Razoring / Lazy eval question] by [[Jerry Donald]], [[CCC]], November 24, 2012 » [[Lazy Evaluation]]
* [http://www.talkchess.com/forum/viewtopic.php?t=49863 Null move, razoring and mate threats] by [[Jon Dart]], [[CCC]], October 28, 2013 » [[Null Move Pruning]]
==2015 ...==
* [http://www.talkchess.com/forum/viewtopic.php?t=57287 Razoring vs Futility pruning] by [[Shawn Chidester]], [[CCC]], August 16, 2015 » [[Futility Pruning]]
* [http://www.talkchess.com/forum/viewtopic.php?t=57843 Verification of pruning techniques] by [[Shawn Chidester]], [[CCC]], October 04, 2015 » [[Pruning]]

=External Links=
* [https://en.wikipedia.org/wiki/Razor Razor from Wikipedia]
* [https://en.wikipedia.org/wiki/Razor_Blade Razor Blade from Wikipedia]
* [https://en.wikipedia.org/wiki/Razor_cut Razor (hair) cut from Wikipedia]
* [http://liswiki.org/wiki/Razoring Razoring] from [http://liswiki.org/wiki/Main_Page Library and Information Science Wiki]
* [http://www.computermuseum.li/Testpage/UNISYS-History.htm#RemRandShaver UNISYS-History - A 1955 Remington Rand electric shaver]
* [https://en.wikipedia.org/wiki/Philishave Philishave from Wikipedia]
* [https://en.wikipedia.org/wiki/Occam%27s_razor Occam's razor from Wikipedia]
* [[Videos#FrankZappa|Frank Zappa]] - [http://wiki.killuglyradio.com/wiki/Occam%27s_Razor Occam's Razor] from [https://en.wikipedia.org/wiki/One_Shot_Deal One Shot Deal], [https://en.wikipedia.org/wiki/YouTube YouTube] Video
: [[Videos#FrankZappa|Frank Zappa]], [https://en.wikipedia.org/wiki/Warren_Cuccurullo Warren Cuccurullo], [https://wiki.killuglyradio.com/wiki/Denny_Walley Denny Walley], [https://en.wikipedia.org/wiki/Ike_Willis Ike Willis], [https://en.wikipedia.org/wiki/Tommy_Mars Tommy Mars], [https://en.wikipedia.org/wiki/Peter_Wolf_%28producer%29 Peter Wolf], [https://en.wikipedia.org/wiki/Arthur_Barrow Arthur Barrow], [[Videos#VinnieColaiuta|Vinnie Colaiuta]], [https://en.wikipedia.org/wiki/Ed_Mann Ed Mann]
: {{#evu:https://www.youtube.com/watch?v=dp93bcp4HCM|alignment=left|valignment=top}}

=References=
<references />

'''[[Reductions|Up one Level]]'''

Navigation menu