6.Adversarial search(Minmax and α–β pruning )

In AI, a game* is often a deterministic, turn-taking, two- player, zero-sum game of perfect information:
1.deterministic
2.two agents
3.whose action alternate
4.utility values are opposite e.g. (+1,-1) fully observable

Defination of Game

A Game consists of:
1.sets of players P, states S (board and player to play), and moves M.
2.an initial state s0 ∈ S which specifies how the game is set up.
3.Player(s)∈ P : defines the player to move in state s.
4.Moves(s)∈ 2M : defines the set of legal moves in state s.
5.Result(s,m)∈ S: defines the result of perfoming move m in state s.
6.Terminal(s)∈ B: the terminal test says whether the game is over.
7.Utility(s,p)∈ R: the utility function gives a numeric value to terminal states from the point of view of a given player, e.g. {+1, ?1, 0} for chess.

A Game is defined by an initial state, a successor function, a terminal test, and a utility function

Defination of Minimax

Perfect play for deterministic, two-player, zero-sum, perfect-information games.

Idea: choose move to position with highest minimax value
= best achievable utility against best possible opponent

Computing the Minimax value:

  1. Apply utility function to each leaf of the game tree
  2. Back-up values from the leaves through inner nodes up to the root:
    (a) min node: compute the min of its children values
    (b) max node: compute the max of its children values
  3. At the root: choose the move leading to the child of highest value
Minimax-Value(s) =
Utility(s, max)                           if Terminal(s)
maxm∈Moves(s) Minimax-Value(Result(s, m)) if Player(s) = max 
minm∈Moves(s) Minimax-Value(Result(s, m)) if Player(s) = min

Minimax algorithm:
function Minimax-Decision(state) returns a move
function Max-Value(state) returns a utility value
function Min-Value(state) returns a utility value

The minimax algorithm select optimal actions for two-player zero-sum games of perfect information by a depth first exploration of the game-tree

α–β pruning

A parent node passes its current values for α and β to its children in turn. A child passes back up its value v to the parent.
The parent compares v to α (min) or β (max) to decide whether to prune the child’s sibling and if so return v to the parent.
Otherwise, it updates its current values for α (max) or β (min) using v and go on.

Example of α–β pruning

Alpha-beta pruning does not compromise optimality but increases efficiency by eliminating provably irrelevant subtrees.
Good move ordering improves effectiveness of pruning. Perfect ordering (unachievable): increasing order for max and decreasing order for min.

Changes to Minmax(in realtime situation)

Limit search depth and estimate expected utility

1.Use Cutoff test instead of Terminal test
– Cutoff(s,d): true iff the state s encountered at depth d in the tree must be considered as a leaf (or s is terminal).

2.Use Eval instead of Utility
– Eval(s,p) i.e., evaluation function that estimates the expected utility of cutoff state s wrt player p, and correlates with chances of winning

Minimax-Value(s, d) =
Eval(s, max)                                       if Cutoff(s, d)
maxm∈Moves(s)D-Minimax-Value(Result(s,m),d+1)      ifPlayer(s)=max 
minm∈Moves(s) D-Minimax-Value(Result(s, m), d + 1) if Player(s) = min

It is not feasible to consider the whole game tree (even with alpha-beta), so we need to cut the search off at some point and apply an evaluation function that gives an estimate of the expected utility of a state

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末须妻,一起剝皮案震驚了整個(gè)濱河市棉浸,隨后出現(xiàn)的幾起案子鬼悠,更是在濱河造成了極大的恐慌沉帮,老刑警劉巖,帶你破解...
    沈念sama閱讀 221,820評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡闷串,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,648評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門(mén)筋量,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)烹吵,“玉大人,你說(shuō)我怎么就攤上這事桨武±甙危” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 168,324評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵玻募,是天一觀的道長(zhǎng)只损。 經(jīng)常有香客問(wèn)我,道長(zhǎng)七咧,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 59,714評(píng)論 1 297
  • 正文 為了忘掉前任叮叹,我火速辦了婚禮艾栋,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘蛉顽。我一直安慰自己蝗砾,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,724評(píng)論 6 397
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著悼粮,像睡著了一般闲勺。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上扣猫,一...
    開(kāi)封第一講書(shū)人閱讀 52,328評(píng)論 1 310
  • 那天菜循,我揣著相機(jī)與錄音,去河邊找鬼申尤。 笑死癌幕,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的昧穿。 我是一名探鬼主播勺远,決...
    沈念sama閱讀 40,897評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼时鸵!你這毒婦竟也來(lái)了胶逢?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 39,804評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤饰潜,失蹤者是張志新(化名)和其女友劉穎宪塔,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體囊拜,經(jīng)...
    沈念sama閱讀 46,345評(píng)論 1 318
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡某筐,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,431評(píng)論 3 340
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了冠跷。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片南誊。...
    茶點(diǎn)故事閱讀 40,561評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖蜜托,靈堂內(nèi)的尸體忽然破棺而出抄囚,到底是詐尸還是另有隱情,我是刑警寧澤橄务,帶...
    沈念sama閱讀 36,238評(píng)論 5 350
  • 正文 年R本政府宣布幔托,位于F島的核電站,受9級(jí)特大地震影響蜂挪,放射性物質(zhì)發(fā)生泄漏重挑。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,928評(píng)論 3 334
  • 文/蒙蒙 一棠涮、第九天 我趴在偏房一處隱蔽的房頂上張望谬哀。 院中可真熱鬧,春花似錦严肪、人聲如沸史煎。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,417評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)篇梭。三九已至氢橙,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間恬偷,已是汗流浹背悍手。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,528評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留喉磁,地道東北人谓苟。 一個(gè)月前我還...
    沈念sama閱讀 48,983評(píng)論 3 376
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像协怒,于是被迫代替她去往敵國(guó)和親涝焙。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,573評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容

  • 文件獲仍邢尽:鏈接:http://pan.baidu.com/s/1bp6bjx9 密碼:72wh 實(shí)驗(yàn)吧鐵人三項(xiàng)之m...
    Sund4y閱讀 3,251評(píng)論 0 1
  • 昨晚我輸給一輛AE86仑撞,他用慣性飄移過(guò)彎,他的車(chē)很快妖滔,我只看到他有個(gè)豆腐店的招牌隧哮,你知道嗎?如果你知道他是誰(shuí)的話座舍,...
    TKJun閱讀 219評(píng)論 0 4
  • 如何使用requests登錄豆瓣并且爬取內(nèi)容Note:1.如果登錄之后要去其他頁(yè)面查看相關(guān)內(nèi)容得記錄session...
    法號(hào)少林閱讀 549評(píng)論 0 1
  • 強(qiáng)制退出應(yīng)用程序 Command + Shift + esc 組合鍵沮翔,會(huì)出現(xiàn)一個(gè)窗口讓你強(qiáng)退軟件 Mac神器 1....
    任夢(mèng)RM閱讀 288評(píng)論 0 0
  • 章節(jié),第七節(jié) 內(nèi)容曲秉,用全身心傾聽(tīng) 探討如何傾聽(tīng)他人采蚀,了解他們的觀察、感受承二、需要和請(qǐng)求榆鼠,并給予反饋。 不論別人以什么...
    霄歌閱讀 286評(píng)論 0 0