{"id":409,"date":"2009-11-08T05:11:50","date_gmt":"2009-11-08T05:11:50","guid":{"rendered":"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/?p=409"},"modified":"2009-11-08T05:11:50","modified_gmt":"2009-11-08T05:11:50","slug":"minimax-search-knowledge","status":"publish","type":"post","link":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/artificial-intelligence\/minimax-search-knowledge.php","title":{"rendered":"Minimax Search [Knowledge]"},"content":{"rendered":"<p>Let&rsquo;s say your program is in a competitive situation against others, and must predict possible consequences of actions to select the one with the best outcome.  This is the case in many logic games like Tic-Tac-Toe, Othello, Chess or Go.  The minimax algorithm can be applied here as long as:<\/p><ul><li><strong>The current state is (at least partly) available to the program.<\/strong>  For example, the program knows the position of the pieces on the game board.<\/li><li><strong>It&rsquo;s possible to search through successor states in the future.<\/strong>  The program knows how the pieces end up when a move is made.<\/li><li><strong>There&rsquo;s a way to evaluate the utility of certain states.<\/strong>  For instance, knowing when about the winning\/loosing conditions.<\/li><\/ul><p>Since this is a competitive setting, you can assume that the others pick actions resulting in a worse outcome for your program.  Then, minimax works by taking the predictions of future states, and working back to determine the utility of predecessor states.  When your program has estimated the utility of the next states, it can easily select the best.<\/p><h3>Description<\/h3><p>Minimax is a policy to select optimal utility actions assuming the worst from other programs.  Typically, minmax is combined with a depth-first search algorithm that traverses the game tree, predicting what the opponents are likely to do and what your program should do.  As such, there are two different levels in the search tree: 1) for the opponents and 2) for team-members.<\/p><ol><li>The level in the game tree dealing with opponents is known as <tt>MIN<\/tt>, since they will typically <strong>minimize<\/strong> the utility of the outcome state.<\/li><li>Conversely, the search tree&rsquo;s level dealing with team-members is known as <tt>MAX<\/tt>, since they will typically <strong>maximize<\/strong> the utility of the outcome state.<\/li><\/ol><p>The minimax search, in effect, minimizes the maximum possible loss, or looking at it the other way, maximizes the minimum gain.<\/p><p><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/47380_minimax.png\" alt=\"Min\/Max Search in Game Tree\" style=\"padding-left:10px; padding-right: 10px;\"><\/p><h3>Application<\/h3><p>Minimax is applied to many games with great success, especially when the branching factor is small (i.e. there are few options each turn), when the situation is deterministic, and the state is fully observable.<\/p><p>However, in practice, there are significant challenges to applying Minimax to a logic game.  Notably, the game tree is usually too large to search until the end, so good estimator functions are required for any state (and not just terminal states).  This is not a trivial problem, and significantly affects the outcome of the algorithm.  Most state estimation functions are hand written for each problem by experts.<\/p><p>The pseudo-code for a minimax search looks like this:<\/p><div><div><pre><span>def<\/span> minimax<span>(<\/span>node, depth<span>)<\/span>    <span>if<\/span> node.<span>is_terminal<\/span><span>(<\/span><span>)<\/span> <span>or<\/span> depth == <span>0<\/span>:         <span>return<\/span> node.<span>calculate_heuristic<\/span><span>(<\/span><span>)<\/span>    <span>if<\/span> node.<span>is_opponent<\/span><span>(<\/span><span>)<\/span>:         a = +inf         <span>for<\/span> child <span>in<\/span> node.<span>get_children<\/span><span>(<\/span><span>)<\/span>:             a = <span>min<\/span><span>(<\/span>a, minimax<span>(<\/span>child, depth<span>-1<\/span><span>)<\/span><span>)<\/span>    <span>else<\/span>:        a = -inf        <span>for<\/span> child <span>in<\/span> node.<span>get_children<\/span><span>(<\/span><span>)<\/span>:             a = <span>max<\/span><span>(<\/span>a, minimax<span>(<\/span>child, depth<span>-1<\/span><span>)<\/span><span>)<\/span>    <span>return<\/span> a<\/pre><\/div><\/div><p>On the bright side, alpha-beta pruning can be implemented easily to improve the efficiency of the search.<\/p><h3>Theory<\/h3><p>In classical statistical decision theory, an estimator <img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/47380_77a3b715842b45e440a5bee15357ad29_1.0pt.gif\" title=\"\\delta\" alt=\"\\delta\" style=\"padding-left:10px; padding-right: 10px;\"> is used to estimate a parameter <img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/47380_c4da9a79ba148a2e9a7bcd92255680be_1.39098pt.gif\" title=\"\\theta \\in \\Theta\" alt=\"\\theta \\in \\Theta\" style=\"padding-left:10px; padding-right: 10px;\">.  Also assume a risk function <img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/77477_6a17165cc8bd2870b628562e395773c2_3.5pt.gif\" title=\"R(\\theta,\\delta)\" alt=\"R(\\theta,\\delta)\" style=\"padding-left:10px; padding-right: 10px;\">, usually specified as the integral of a loss function. Given this framework, <img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/77477_d99d347424268567155c1e3e57e466e0_1.0pt.gif\" title=\"\\tilde{\\delta}\" alt=\"\\tilde{\\delta}\" style=\"padding-left:10px; padding-right: 10px;\"> is called &ldquo;<em>minimax<\/em>&rdquo; if it satisfies:<\/p><p><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/77477_67b428b3c397981a5a7f4481a50c69d8_3.5pt.gif\" title=\"\\sup_\\theta R(\\theta,\\tilde{\\delta}) = \\inf_\\delta \\sup_\\theta R(\\theta,\\delta)\" alt=\"\\sup_\\theta R(\\theta,\\tilde{\\delta}) = \\inf_\\delta \\sup_\\theta R(\\theta,\\delta)\" style=\"padding-left:10px; padding-right: 10px;\"><\/p><h3>Resources<\/h3><ul><li>See papers on <a href=\"http:\/\/ai-depot.com\/resources\/minimax_search\">minimax search<\/a> in the resources section on <b>AI Depot<\/b>.<\/li><\/ul><p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/77477_ggU8IJ70bVQ\" height=\"1\" width=\"1\" style=\"padding-left:10px; padding-right: 10px;\"><\/p>","protected":false},"excerpt":{"rendered":"<p>Let&rsquo;s say your program is in a competitive situation against others, and must predict possible consequences of actions to select the one with the best outcome. This is the case in many logic games like Tic-Tac-Toe, Othello, Chess or Go. &hellip; <a href=\"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/artificial-intelligence\/minimax-search-knowledge.php\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"limit_modified_date":"","last_modified_date":"","_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[13],"tags":[],"class_list":["post-409","post","type-post","status-publish","format-standard","hentry","category-artificial-intelligence"],"modified_by":null,"_links":{"self":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/409"}],"collection":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/comments?post=409"}],"version-history":[{"count":0,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/409\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/media?parent=409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/categories?post=409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/tags?post=409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}