Presentation is loading. Please wait.

Presentation is loading. Please wait.

חיפוש בינה מלאכותית אבי רוזנפלד. סוגי חיפוש כלליים UNINFORMED SEARCH -- חיפושים לא מיודעים במרחי מצבים – BFS – DFS INFORMED SEARCH – חיפושים מיודעים –

Similar presentations


Presentation on theme: "חיפוש בינה מלאכותית אבי רוזנפלד. סוגי חיפוש כלליים UNINFORMED SEARCH -- חיפושים לא מיודעים במרחי מצבים – BFS – DFS INFORMED SEARCH – חיפושים מיודעים –"— Presentation transcript:

1 חיפוש בינה מלאכותית אבי רוזנפלד

2 סוגי חיפוש כלליים UNINFORMED SEARCH -- חיפושים לא מיודעים במרחי מצבים – BFS – DFS INFORMED SEARCH – חיפושים מיודעים – Dijkstra – GREEDY – A* – http://en.wikipedia.org/wiki/Dijkstra's_algorithm http://en.wikipedia.org/wiki/Dijkstra's_algorithm – HILLCLIMBING

3 חיפוש נגד יריב ( משחקים ) איזה מידע יש בתוך המודל ( עץ ) איך היריב משחק ? –אופטימאלי / לא אופטימאלי איך אפשר להוריד את מרחב החיפוש – Alpha / Beta Pruning ( גיזום של העץ ) –יצירת החישוב (Evaluation function) – The Horizon Effect

4 4 סוגי משחקים

5 5 Game tree (2-player, deterministic, turns)

6 Minimax Create a utility function – Evaluation of board/game state to determine how strong the position of player 1 is. – Player 1 wants to maximize the utility function – Player 2 wants to minimize the utility function Minimax tree – Generate a new level for each move – Levels alternate between “max” (player 1 moves) and “min” (player 2 moves)

7 Minimax עץ ה Max Min Max Min

8 Minimax Tree Evaluation הנחה : יש פונקציה UTILITY ( לא הנחה פשוטה ) כל צד רוצה למקסם את הצד שלו יש מספיק מידע בתוך העץ לעשות את החישובים

9 עץ של המשחק (Minimax) Max Min Max Min 100 -24-8-14-73-100-5-70-12-470412-3212823

10 עץ של המשחק (Minimax) Max Min Max Min 100 -24-8-14-73-100-5-70-12-470412-3212823 28-3 1270-4-73-14 -8

11 עץ של המשחק (Minimax) Max Min Max Min 100 -24-8-14-73-100-5-70-12-470412-3212823 21-3 1270-4-73-14 -8 -3 -4 -73

12 עץ של המשחק (Minimax) Max Min Max Min 100 -24-8-14-73-100-5-70-12-470412-3212823 21-3 1270-4-73-14 -8 -3 -4 -73 -3

13 Minimax Evaluation Given average branching factor b, and depth m: – A complete evaluation takes time b m – A complete evaluation takes space bm Usually, we cannot evaluate the complete state, since it’s too big Instead, we limit the depth based on various factors, including time available.

14 14 עוד דוגמא של Minimax

15 גיזום של α-β אני יודע שאתה יודע שאני יודע... שווה להוריד אופציות כדי שאפשר לחפש יותר הפתרון : גיזום –כל צד מוריד דבר שהוא בטוח שהצד השני

16  α ו ל α : ( שמחפשים )MAX, אם הערך הנוכחי קטן מערך בענף אחר, תוריד את הענף (PRUNE) ל β, ( שמחפשים )MIN, אם הערך הנוכחי גדול מערך בענף אחר, תוריד את הענף (PRUNE)

17 17 α-β pruning example

18 18 α-β pruning example

19 19 α-β pruning example

20 20 α-β pruning example

21 21 α-β pruning example

22  Cut example 10021-31270-4-73-14 -3-4 -3 -73 Max Min

23  Cut example Depth first search along path 1 10021-312-70-4-73-14 Max Min

24  Cut example 21 is minimum so far (second level) Can’t evaluate yet at top level 10021-312-70-4-73-14 Max Min 21

25  Cut example -3 is minimum so far (second level) -3 is maximum so far (top level) 10021-312-70-4-73-14 Max Min -3

26  Cut example 12 is minimum so far (second level) -3 is still maximum (can’t use second node yet) 10021-312-70-4-73-14 Max Min -3 12

27  Cut example -70 is now minimum so far (second level) -3 is still maximum (can’t use second node yet) 10021-312-70-4-73-14 Max Min -3 -70

28  Cut example Since second level node will never be > -70, it will never be chosen by the previous level We can stop exploring that node 10021-312-70-4-73-14 Max Min -3 -70

29  Cut example Evaluation at second level is -73 10021-312-70-4-73-14 Max Min -3 -70 -73

30  Cut example Again, can apply  cut since the second level node will never be > -73, and thus will never be chosen by the previous level 10021-312-70-4-73-14 Max Min -3 -70 -73

31  Cut example As a result, we evaluated the Max node without evaluating several of the possible paths 10021-312-70-4-73-14 Max Min -3 -70 -73

32  cuts Similar idea to  cuts, but the other way around If the current minimum is less than the successor’s max value, don’t look down that max tree any more

33  Cut example Some subtrees at second level already have values > min from previous, so we can stop evaluating them. 10021-31270-473-14 Min Max 21 7073

34 עובד  -  Pruning למה לצד של MAX, 70 יותר טוב אבל, אין מצב ש MIN ייקח אותו במקום 21. 100 21-3 1270-4 21 70

35  -  Pruning היתרון ל אין השפעה על תוצאת MINIMAX –כן עוזר לרדת יותר עמוק בתוך העץ מאוד תלוי ב " מזל " בסידור של העץ –במצב הכי טוב, הוא מכפיל הגודל שאפשר לחפש בו

36 איך בונים את העצים ?! מאוד תלוי במשחק יש צורך לראות את ה - כ - ל עד סוף המשחק (!) ברמה הפשוטה : 1 אם אני מנצח, 1- אם אתה מנצח, 0 במצב תיקו. ברוב המשחקים יש ה - ר - ב - ה מצבים באמצע –שמחט –דמקה –רצף ארבע (!)

37 בניית פונקציות UTILITY למשחק לכל מצב יש ציון בשחמט מלכה שווה 10, אביר שווה 3 וכו ' בהרבה מקרים, הערכים הסתברותיים. – utility =  a +  b +  c

38 For chess, typically linear weighted sum of features Eval(s) = w 1 f 1 (s) + w 2 f 2 (s) + … + w n f n (s) e.g., w 1 = 9 with f 1 (s) = (number of white queens) – (number of black queens), etc. 38 Utility Function

39 לא ניתן לראות קדימה עד סוף המשחק ( אין סוף ) בונים עוץ בגודל מסויים (Cut Off) בלי גיזום ALPHA BETA, ה Cut Off בשחמט למחשב נורמאלי הוא " רק " גובה של 4 –שזה שווה לבנאדם רגיל אם ALPHA BETA, זה מגיע ל 8! אבל Kasparov ו Deep Blue עבדו עד לגובה של 12. 39 הגבלות בפועל

40 הערכים לא משפעים על איזה פעולה לעשות ! 40 בהרבה מקרים גם הערכה היא " מספיק טובה "

41 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 443,748,401,247 positions. A precomputed endgame database? Would it be possible to extend the “endgame” all the way back to the beginning of the game, essentially “solving” checkers? 41 Deterministic games in practice

42 Originally published in Science Express on 19 July 2007 Science 14 September 2007: Vol. 317, no. 5844, pp. 1518 – 1522 Jonathan Schaeffer (University of Alberta), Neil Burch, Yngvi Björnsson, Akihiro Kishimoto, Martin Müller, Robert Lake, Paul Lu, Steve Sutphen The game of checkers has roughly 500 billion billion possible positions (5 x 10 20 ). The task of solving the game, determining the final result in a game with no mistakes made by either player, is daunting. Since 1989, almost continuously, dozens of computers have been working on solving checkers, applying state-of-the-art artificial intelligence techniques to the proving process. This paper announces that checkers is now solved: Perfect play by both sides leads to a draw. This is the most challenging popular game to be solved to date, roughly one million times as complex as Connect Four. Artificial intelligence technology has been used to generate strong heuristic-based game-playing programs, such as Deep Blue for chess. Solving a game takes this to the next level by replacing the heuristics with perfection. 42 Checkers is Solved

43 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. Rybka was the 2008 and 2009 computer chess champion (uses an off-the-shelf 8-core 3.2GHz Intel Xeon processor), but was stripped of its titles for having plagiarized two other programs… Othello: Logistello beats human world champion in 1997; 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. 43 Deterministic games in practice

44 משחקים הם לא משחק ילדים לאנשי מערכות מידע... איך הסוכן שלכם יעבוד !!! 44 סיכום


Download ppt "חיפוש בינה מלאכותית אבי רוזנפלד. סוגי חיפוש כלליים UNINFORMED SEARCH -- חיפושים לא מיודעים במרחי מצבים – BFS – DFS INFORMED SEARCH – חיפושים מיודעים –"

Similar presentations


Ads by Google