<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>阅微堂 &#187; 帽子游戏</title>
	<atom:link href="http://zhiqiang.org/blog/tag/%e5%b8%bd%e5%ad%90%e6%b8%b8%e6%88%8f/feed" rel="self" type="application/rss+xml" />
	<link>http://zhiqiang.org/blog</link>
	<description>理工科背景的证券从业人员</description>
	<lastBuildDate>Sun, 05 Feb 2012 03:59:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>帽子游戏二</title>
		<link>http://zhiqiang.org/blog/science/game-two-hats.html</link>
		<comments>http://zhiqiang.org/blog/science/game-two-hats.html#comments</comments>
		<pubDate>Mon, 25 Jun 2007 07:52:14 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[自然科学]]></category>
		<category><![CDATA[头脑风暴]]></category>
		<category><![CDATA[帽子游戏]]></category>
		<category><![CDATA[概率]]></category>
		<category><![CDATA[面试题]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/608.html</guid>
		<description><![CDATA[博客 » 自然科学 » 头脑风暴 » 系列：头脑风暴 查看该系列所有文章 系列：面试题 查看该系列所有文章 这个题目听说是MSRA的面试题。 在这个游戏的开头，我们设想自己要参加一个电视游戏大奖赛。规则呢，是这样。我们有 n 个人，作为一个小组来参加游戏。游戏中，主持人会给我们每人头上戴一顶帽子。帽子有黑白两种颜色，可以认为它们在我们各自头上的分布是临时随...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science">自然科学</a> » <a href='http://zhiqiang.org/blog/tag/%e5%a4%b4%e8%84%91%e9%a3%8e%e6%9a%b4'>头脑风暴</a>  » </p><div class="series"><span>系列：<b>头脑风暴</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e5%a4%b4%e8%84%91%e9%a3%8e%e6%9a%b4">查看该系列所有文章</a>
<div id='series'></div>
</div>  <div class="series"><span>系列：<b>面试题</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>这个题目听说是MSRA的面试题。</p>
<p>在这个游戏的开头，我们设想自己要参加一个电视游戏大奖赛。规则呢，是这样。我们有 n 个人，作为一个小组来参加游戏。游戏中，主持人会给我们每人头上戴一顶帽子。帽子有黑白两种颜色，可以认为它们在我们各自头上的分布是临时随机决定的。小组中的每一个人，可以看到其他人的帽子颜色，但不知道自己的帽子颜色。每个游戏成员都被要求回答自己帽子的颜色（且必须回答，而且是独立回答的）。只有当所有人都回答正确（注意这里与<a href="http://zhiqiang.org/blog/science/game-one-hat.html">帽子游戏一</a>的区别），他们才能获胜，一起获得最后的大奖。</p>
<p>这个游戏还有最关键的一点：在游戏开始前(帽子戴上之前)，有一个“协商时间”，小组成员可以聚在一起，讨论决定小组应采取什么样的策略。但这个交流过程在游戏开始时自然终止。</p>
<p>现在的问题是：小组选择什么样的策略，才有最大的机会获胜呢？</p>
<p>因为任何一个人没有关于自己的帽子的任何信息，所以正确率不可能超过1/2。关键是怎么让所有人要么同时正确，以达到这个1/2的正确率。</p>
<p>所以，正确的策略应该是每个观众回答其余所有观众的帽子的异或（0表示白帽子，1表示黑帽子，则第i个人回答<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_2d767b1247a05b4629d433b91f162f6d.gif' style='vertical-align: middle; border: none; ' class='tex' alt="\oplus_{j\not=i}^n x_j" /></span><script type='math/tex'>\oplus_{j\not=i}^n x_j</script>。</p>
<p>OK，现在这个问题到这里已经完整了。但令人惊奇的是，在两个星期前，来自伦敦大学的Taoyang Wu给了一个非常有趣的讲座，上面这个游戏恰是这个讲座的一个特例。</p>
<p>上面的问题其实是说有一个完全的有向图，每个顶点上有一个随机的变量。每一个点都知道它的邻居（连向它的点）的变量，需要猜测自己的信息。问以怎么样的策略能够使得所有点同时正确的概率最大？</p>
<p>显然，这个概率（记作<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_ce880105a27f199c255b7b07e99fde30.gif' style='vertical-align: middle; border: none; ' class='tex' alt="p(G)" /></span><script type='math/tex'>p(G)</script>）与这个图G的结构密切相关，这样，<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_ce880105a27f199c255b7b07e99fde30.gif' style='vertical-align: middle; border: none; ' class='tex' alt="p(G)" /></span><script type='math/tex'>p(G)</script>某种意义上是这个图的结构的一个度量，称为Guessing Number，等于<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_124f27c711a4c096795683147521c4dd.gif' style='vertical-align: middle; border: none; ' class='tex' alt="g(G)=n+\log p(G)" /></span><script type='math/tex'>g(G)=n+\log p(G)</script>。根据前面所说，完全图的Guessing Number为n-1。另易知一个单环的Guessing Number等于1。而对一般图Guessing Number问题，无论是从直接求解（猜测是<a target="_blank" href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html">NP-hard</a>），还是其性质分析，都还留下很多未解决的问题。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/game-one-hat.html">帽子游戏一</a></li><li><a href="http://zhiqiang.org/blog/science/googles-crazy-face-questions.html">Google的疯狂面试题</a></li><li><a href="http://zhiqiang.org/blog/science/when-to-stop.html">何时适可而止?</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/an-algorithm-face-interviews-question-test.html">一个算法面试题 &#038; 面试题库</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html">Perfect Shuffle的算法</a></li><li><a href="http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html">2008年10月EMC笔试</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html">网易笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/worldquant-written-test-2007.html">WorldQuant的笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html">毛毛虫爬棍子面试题</a></li><li><a href="http://zhiqiang.org/blog/review/fooled-by-randomnes.html">《随机致富的傻瓜》</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2007. | <a href="http://zhiqiang.org/blog/science/game-two-hats.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/game-two-hats.html#comments">6 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/game-two-hats.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>帽子游戏一</title>
		<link>http://zhiqiang.org/blog/science/game-one-hat.html</link>
		<comments>http://zhiqiang.org/blog/science/game-one-hat.html#comments</comments>
		<pubDate>Tue, 19 Jun 2007 15:01:21 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[自然科学]]></category>
		<category><![CDATA[头脑风暴]]></category>
		<category><![CDATA[帽子游戏]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/607.html</guid>
		<description><![CDATA[博客 » 自然科学 » 头脑风暴 » 系列：头脑风暴 查看该系列所有文章 在这个游戏的开头，我们设想自己要参加一个电视游戏大奖赛。规则呢，是这样。我们有 n 个人，作为一个小组来参加游戏。游戏中，主持人会给我们每人头上戴一顶帽子。帽子有黑白两种颜色，可以认为它们在我们各自头上的分布是临时随机决定的。小组中的每一个人，可以看到其他人的帽子颜色，但不...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science">自然科学</a> » <a href='http://zhiqiang.org/blog/tag/%e5%a4%b4%e8%84%91%e9%a3%8e%e6%9a%b4'>头脑风暴</a>  » </p><div class="series"><span>系列：<b>头脑风暴</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e5%a4%b4%e8%84%91%e9%a3%8e%e6%9a%b4">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>在这个游戏的开头，我们设想自己要参加一个电视游戏大奖赛。规则呢，是这样。我们有 n 个人，作为一个小组来参加游戏。游戏中，主持人会给我们每人头上戴一顶帽子。帽子有黑白两种颜色，可以认为它们在我们各自头上的分布是临时随机决定的。小组中的每一个人，可以看到其他人的帽子颜色，但不知道自己的帽子颜色。每个游戏成员都被要求回答自己帽子的颜色。我们各人面前有三个按钮，可以选择“黑色”“白色”或“弃权”(也就是 pass，不作猜测的意思)。小组成员彼此之间没有任何信息交流，他们必须各自独立地作出自己的选择，并且谁也不知道其他人的选择。如果小组成员全部选择了 pass，也就是每个人都弃权，则他们输了；如果有小组成员作出了明确的猜测，但某个人猜错了，则结果也是输。只有当小组中有人做出猜测，并且每个做出猜测的人都猜对了，他们才能获胜，一起获得最后的大奖。</p>
<p>这个游戏还有最关键的一点：在游戏开始前(帽子戴上之前)，有一个“协商时间”，小组成员可以聚在一起，讨论决定小组应采取什么样的策略。但这个交流过程在游戏开始时自然终止。</p>
<p>现在的问题是：小组选择什么样的策略，才有最大的机会获胜呢？</p>
<p>在<a href="http://jamiso.ycool.com/post.2758864.html">这里</a>用<a href="http://en.wikipedia.org/wiki/Hamming_code" target="_blank">Hamming码</a>给出了问题在<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_de647681d7be02ef8eb84379cf390e53.gif' style='vertical-align: middle; border: none; ' class='tex' alt="n=2^k-1" /></span><script type='math/tex'>n=2^k-1</script>时候的一种解释和策略，成功概率为<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_dcac898d26731f27f342ab79696d5f01.gif' style='vertical-align: middle; border: none; ' class='tex' alt="1-1/2^k" /></span><script type='math/tex'>1-1/2^k</script>。但这个问题为什么最后归结于Hamming码，这种方法为什么是最优的呢？这里再讨论一下。</p>
<p>模型：帽子的黑白状态为一个n长的串，可以用一个n维的超立方体G的顶点坐标<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_f6d6bd936ade0be97c88e1ad68e35a5a.gif' style='vertical-align: middle; border: none; ' class='tex' alt="(x_1," /></span><script type='math/tex'>(x_1,</script>,<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_ecbc6dc6acb95b067392b8ee1899a8a0.gif' style='vertical-align: middle; border: none; ' class='tex' alt="x_2, \cdots, x_n)" /></span><script type='math/tex'>x_2, \cdots, x_n)</script>来表示，坐标为0表示白帽子，1表示黑帽子。G上两顶点相邻当且仅当它们之间仅相差一位，这样每个顶点恰与n个点相邻。</p>
<p>目标：主持人在G上随机选取一个顶点P，第i个观众知道这个顶点除第i个之外的n-1个坐标值，给出一种回答策略，使得所有问答的观众都答对了正确的P。</p>
<p>这个问题的关键是怎么把“策略”模型化。</p>
<p>注意到在游戏中，每个人他能观测n-1个坐标值，也就是他能够确定P为G上某条边<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_f406f917636fcaa71ae578800a9700f5.gif' style='vertical-align: middle; border: none; ' class='tex' alt="(u, v)" /></span><script type='math/tex'>(u, v)</script>的两个顶点之一。他在游戏中的策略具体表现为，当他观测到这条边时，他选择这条边的哪个顶点，或者不做选择。</p>
<p>如果观测到<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_f406f917636fcaa71ae578800a9700f5.gif' style='vertical-align: middle; border: none; ' class='tex' alt="(u, v)" /></span><script type='math/tex'>(u, v)</script>，策略选择了<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_7b774effe4a349c6dd82ad4f4f21d34c.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="u" /></span><script type='math/tex'>u</script>，则在G上连一条有向边<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_fdac5c636c1b951c586fa48d615dd63e.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="u\rightarrow v" /></span><script type='math/tex'>u\rightarrow v</script>。</p>
<p>策略：一个策略C可以表示为G的某些边的有向化。</p>
<p>引理：如果P点处出度（即P连出的边数）等于0——没有人回答错误，且入度（连向P的边数）大于0——至少有一人回答，则当主持人选择P点，观众获胜。否则观众失败。</p>
<p>在策略C下，错误点构成的集合记作<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_91bc4af75ef682d2852db3b466b2fd2e.gif' style='vertical-align: middle; border: none; ' class='tex' alt="R_C" /></span><script type='math/tex'>R_C</script>。此时，观众成功的概率为<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_eca23d18b69feda42e16d45a3a50a1ea.gif' style='vertical-align: middle; border: none; ' class='tex' alt="1-|R_C|/2^n" /></span><script type='math/tex'>1-|R_C|/2^n</script>.</p>
<p>定义：图G(V,E)上，V的子集D称为G的Dominating Set当且仅当G的任何顶点要么在D中，要么与D的某个顶点相邻。</p>
<p>定理：G的顶点集<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_e1e1d3d40573127e9ee0480caf1283d6.gif' style='vertical-align: middle; border: none; ' class='tex' alt="R" /></span><script type='math/tex'>R</script>为某个策略C的错误点集<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_91bc4af75ef682d2852db3b466b2fd2e.gif' style='vertical-align: middle; border: none; ' class='tex' alt="R_C" /></span><script type='math/tex'>R_C</script>当且仅当<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_e1e1d3d40573127e9ee0480caf1283d6.gif' style='vertical-align: middle; border: none; ' class='tex' alt="R" /></span><script type='math/tex'>R</script>为G（无向图下）的Dominating Set。其中<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_d912457befd8e4afeea47b53432c02b9.gif' style='vertical-align: middle; border: none; ' class='tex' alt="C=\{u\rightarrow v: u\in R, (u, v)\in E(G)\}" /></span><script type='math/tex'>C=\{u\rightarrow v: u\in R, (u, v)\in E(G)\}</script>。</p>
<p>对于一般图，求Dominating Set是NP完全问题。对于这个超立方体而言，一方面有下界：</p>
<p>定理：<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_40d92f13c2351b32d4d2288227cc2875.gif' style='vertical-align: middle; border: none; ' class='tex' alt="R_C \geq 2^n/(n+1) " /></span><script type='math/tex'>R_C \geq 2^n/(n+1) </script>. 相应的，观众成功的概率不可能大于 <span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_1a3a9ca5d176f363fb36e44d31295b58.gif' style='vertical-align: middle; border: none; ' class='tex' alt="n/(n+1)" /></span><script type='math/tex'>n/(n+1)</script>.</p>
<p>而在<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_de647681d7be02ef8eb84379cf390e53.gif' style='vertical-align: middle; border: none; ' class='tex' alt="n=2^k-1" /></span><script type='math/tex'>n=2^k-1</script>时，上面的等号可以取到，构造<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_9e2c22a045d187603abb6d2bc844e1ca.gif' style='vertical-align: middle; border: none; ' class='tex' alt="2^{2^k-k-1}" /></span><script type='math/tex'>2^{2^k-k-1}</script>个<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_458a9216b81aa45a64505a870735d44a.gif' style='vertical-align: middle; border: none; ' class='tex' alt="2^k-1" /></span><script type='math/tex'>2^k-1</script>长度的01串，任何两个之间的距离大于2（即为纠错度为1的纠错码）。</p>
<p>讨论：如果帽子颜色有三种，又该如何？</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/game-two-hats.html">帽子游戏二</a></li><li><a href="http://zhiqiang.org/blog/science/tcs-classroom-notes-the-best-dating-strategy.html">最佳约会策略</a></li><li><a href="http://zhiqiang.org/blog/science/strategy-games-doctors-and-patients-i.html">策略游戏：医生和病人（I）</a></li><li><a href="http://zhiqiang.org/blog/science/how-to-oil-airplain.html">飞机加油问题</a></li><li><a href="http://zhiqiang.org/blog/science/rotate-coin-games.html">硬币游戏</a></li><li><a href="http://zhiqiang.org/blog/science/rotate-coin-game-solution.html">硬币游戏的答案</a></li><li><a href="http://zhiqiang.org/blog/science/a-tencent-interview-problem.html">一个腾讯游戏策划部门的面试题</a></li><li><a href="http://zhiqiang.org/blog/science/when-to-stop.html">何时适可而止?</a></li><li><a href="http://zhiqiang.org/blog/science/a-square-game.html">取格子游戏的构造性策略</a></li><li><a href="http://zhiqiang.org/blog/science/compute-anonymous-statistics.html">如何匿名统计平均收入</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2007. | <a href="http://zhiqiang.org/blog/science/game-one-hat.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/game-one-hat.html#comments">9 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/game-one-hat.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

