adversarial search جستجوی تخاصمی

24
124/ Adversarial Search ی م ص ا خ تی و ج ت س جChapter 6 Section 1 – 4 Modified by Vali Derhami

Upload: brede

Post on 12-Feb-2016

62 views

Category:

Documents


0 download

DESCRIPTION

Adversarial Search جستجوی تخاصمی. Chapter 6 Section 1 – 4 Modified by Vali Derhami. Outline. Optimal decisions α-β pruning Imperfect, real-time decisions. Games vs. search problems. "Unpredictable" opponent  specifying a move for every possible opponent reply - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Adversarial Search جستجوی تخاصمی

124/

Adversarial Searchتخاصمی جستجوی

Chapter 6Section 1 – 4

Modified by Vali Derhami

Page 2: Adversarial Search جستجوی تخاصمی

224/

Outline

• Optimal decisions

• α-β pruning

• Imperfect, real-time decisions

Page 3: Adversarial Search جستجوی تخاصمی

324/

Games vs. search problems

• "Unpredictable" opponent specifying a move for

every possible opponent reply

• . است محدود زمان ها بازی اکثر درتصمیم • بهترین آوردن بدست است Optimal Decisionممکن

. . شود می انتخاب معقول حل راه لذا نباشد پذیر امکان•. >= شود زده تخمین باید هدف زمانی های محدودیت

Page 4: Adversarial Search جستجوی تخاصمی

424/

جستجو مسأله یک عنوان به بازی• : حرکت نوبت تعیین و بازی صفحه موقعیت اولیه حالت

کننده MAXفرض: شروع• :) بازیکن ) هر مجاز های حرکت عملگرها پسین تابع•. : بازی اتمام تعیین پایانی آزمون•. : پایانی حاالت به مقدار اختصاص سودمندی تابع

– : شدن برنده مقدار MAXباالترین– : شدن برنده مقدار ترین MINپایین– : تساوی میانی مقدارMAX حرکات به توجه با که بیابد اقتضایی راهبرد یک باید

MIN. بشود آن شدن برنده به منجر

Page 5: Adversarial Search جستجوی تخاصمی

524/

Game tree )2-player, deterministic, turns(

Page 6: Adversarial Search جستجوی تخاصمی

624/

Minimax• Perfect play for deterministic games

حریف حرکت بهترین مقابل در یافتنی دست امکان بهترینخودمان سطح در و مینیمم حریف سطح . (MAX)در گیریم می

• E.g., 2-ply game:

• Idea: choose move to position with highest minimax value = best achievable payoff against best play

Page 7: Adversarial Search جستجوی تخاصمی

724/

Minimax algorithm

Page 8: Adversarial Search جستجوی تخاصمی

824/

Properties of minimax• Complete? Yes )if tree is finite(• Optimal? Yes )against an optimal opponent(

! است بهینه هم روش کند، بهینه حرکت حریف اگر• Time complexity? O)bm(

•. شود بررسی باید جستجو درخت کل• Space complexity? O)bm( )depth-first exploration(• For chess, b ≈ 35, m ≈100 for "reasonable" games

exact solution completely infeasible

•••

Page 9: Adversarial Search جستجوی تخاصمی

924/

α-β pruning example

Page 10: Adversarial Search جستجوی تخاصمی

1024/

α-β pruning example

Page 11: Adversarial Search جستجوی تخاصمی

1124/

α-β pruning example

Page 12: Adversarial Search جستجوی تخاصمی

1224/

α-β pruning example

Page 13: Adversarial Search جستجوی تخاصمی

1324/

α-β pruning example

Page 14: Adversarial Search جستجوی تخاصمی

1424/

Properties of α-β• Pruning does not affect final result

ندارند تاثیری نهایی نتیجه در که هایی شاخه هرس

• Good move ordering improves effectiveness of pruningdoubles depth of search

α :) گرOه ) برای شده یافت مقدار بهترین مقدار MAXبیشترینβ :) گره) برای شده یافت مقدار بهترین مقدار MINکمترین

مقدار از جاری گره مقدار آنکه محض سطح ) αبه سطح) βو( MAXبرای بدتر( MINبرای. شوند می هرOس گره از مانده باقی های شاخه شود

• With "perfect ordering," time complexity = O)bm/2(

Page 15: Adversarial Search جستجوی تخاصمی

1524/

Why is it called α-β?• α is the value of the

best )i.e., highest-value( choice found so far at any choice point along the path for MAX

• If v is worse than α, MAX will avoid it prune that branch

• Define β similarly for MIN•

Page 16: Adversarial Search جستجوی تخاصمی

1624/

The α-β algorithm

Page 17: Adversarial Search جستجوی تخاصمی

1724/

The α-β algorithm

Page 18: Adversarial Search جستجوی تخاصمی

1824/

Example

Page 19: Adversarial Search جستجوی تخاصمی

1924/

Resource limitsمنابع های محدودیت

بازی درخت کامل بررسی امکان پیچیده مسایل در . واضح نمونه ندارد وجود فضا و زمان مشکل بخاطر

است شطرنج مساله .آنStandard approach:• cutoff test: ) هدف آزمون جای به قطع محل )تست

e.g., depth limit )perhaps add quiescence search(• evaluation function ) تابع بجای ارزش تخمین)سودمندی= estimated desirability of position

––

Page 20: Adversarial Search جستجوی تخاصمی

2024/

Evaluation functions• For chess, typically linear weighted sum of features

Eval(s) = w1 f1)s( + w2 f2)s( + … + wn fn)s(

• e.g., w1 = 9 with

f1)s( = )number of white queens( – )number of black queens(, etc.

•: ارزش تخمین تابع یک های ویژگی–. کند مرتب سودمندی تابع همانند را انتهایی حاالتکOم – محاسباتی حجمشدن – برنده شانس به Oمناسب وابستگی

Page 21: Adversarial Search جستجوی تخاصمی

2124/

Page 22: Adversarial Search جستجوی تخاصمی

2224/

Cutting off searchMinimaxCutoff is identical to MinimaxValue except

شکل در ها Oجایگزینی اگر است هم مانند روش داده 17و 16اسالیدهای 7-6دو.شود

1. Terminal? is replaced by Cutoff?2. Utility is replaced by Eval

Does it work in practice?باشد داشته ثانیه در نود میلیون یک ارزیابی توان ما کامپیوتر اگرbm = 106, b=35 m=4

4-ply lookahead is a hopeless chess player!– 4-ply ≈ human novice– 8-ply ≈ typical PC, human master– 12-ply ≈ Deep Blue, Kasparov

Page 23: Adversarial Search جستجوی تخاصمی

2324/

Deterministic games in practice• Checkers: Chinook ended 40-year-reign of human world champion

Marion Tinsley in 1994. Used a precomputed endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 444 billion positions.

• Chess: Deep Blue defeated human world champion Garry Kasparov in a six-game match in 1997. Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply.

• Othello: human champions refuse to compete against computers, who are too good.

• Go: human champions refuse to compete against computers, who are too bad. In go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves.

Page 24: Adversarial Search جستجوی تخاصمی

2424/

Summary

• Games are fun to work on!• They illustrate several important points

about AI• perfection is unattainable must

approximate• good idea to think about what to think

about• بخوانید خودتان را شانس عامل دارای بازیهای