0% found this document useful (0 votes)
11 views14 pages

AI Ch3.2

Artifical Intelligence
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views14 pages

AI Ch3.2

Artifical Intelligence
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Chapter 3 Part 2

Lecture Outline
 Uninformed (Blind) search

 Informed (Heuristic) search

Uninformed Search

• It’s also called Blind , Exhaustive or Brute-Force search strategy.

• These strategies have no additional information about states beyond that provided in the
problem definition.

• All they can do is generate successors and distinguish a goal state from a non-goal state.

• All search strategies are distinguished by the order in which nodes are expanded.

.‫• ُتسمى أيًض ا استراتيجية البحث العمياء أو الشاملة أو القوة الجبرية‬

‫• تتميز هذه االستراتيجيات بعدم وجود معلومات إضافية حول الحاالت بعد تلك المقدمة في تعريف‬
.‫المشكلة‬

.‫• كل ما يمكنها القيام به هو توليد الحاالت الفرعية وتمييز حالة الهدف عن حالة غير الهدف‬

.‫• تتميز جميع استراتيجيات البحث بالترتيب الذي يتم فيه توسيع العقد‬

• Blind (Un-informed) Strategies

Step cost = 1

• Breadth-first search

 Bidirectional
Step cost = 1 Step cost =

• Depth-first search

 Depth-limited
 Iterative deepening
Step cost =
cost(action) >

• Uniform-Cost search

Page 1 of 14
By: Muhammad Mahmoud
Breadth first search
• idea: Expand shallowest unexpanded node
• Implementation: frontier is a FIFO queue, i.e. successors go in at the end of the queue.
• New nodes are inserted at the End of Frontier

• Frontier=(A)
• Explored=()

‫ توسيع العقد غير الموسعة األكثر سطحية‬:‫فكرة‬


• ‫ الحدود هي طابور انتظار‬:‫ التنفيذ‬FIFO، ‫أي يدخل األفرع على طرف الطابور‬.
• ‫يتم إدراج العقد الجديدة في نهاية الحدود‬

• Frontier=(B,C)
• Explored=(A) ‫اتحذف‬

• Frontier=(C,D,E)
Explored=(A,B)

Page 2 of 14
By: Muhammad Mahmoud
Frontier=(D,E,F,G)
Explored=(A,B,C)

Breadth-First Search Algorithm

Page 3 of 14
By: Muhammad Mahmoud
Breadth-First Search Example Romania

Expand for the Node

important Definitions for evaluation


Page 4 of 14
By: Muhammad Mahmoud
 Strategies are evaluated along the following dimensions:
‫تعريفات مهمة للتقييم‬

 completeness: does it always find a solution if one exists? :‫ُتقّيم االستراتيجيات على األبعاد التالية‬
‫ هل تجد دائًما حًال إذا كان هناك حًال؟‬:‫االكتمال‬
 time complexity: number of nodes generated
‫ عدد العقد المولدة‬:‫تعقيد الوقت‬
 space complexity: maximum number of nodes in memory ‫ الحد األقصى لعدد العقد في‬:‫تعقيد المساحة‬
 optimality: does it always find a least-cost solution? ‫الذاكرة‬
‫ هل تجد دائًما حًال بأقل تكلفة؟‬:‫األمثلية‬
 Time and space complexity are measured in terms of

 b: maximum branching factor of the search tree ‫يتم قياس تعقيد الوقت والمساحة بالنسبة ل‬

 d: depth of the least-cost solution ‫ العامل التفرع األقصى لشجرة البحث‬:‫ب‬

 m: maximum depth of the state space (may be ∞) ‫ عمق الحل ذي التكلفة األقل‬:‫د‬
‫ الحد األقصى لعمق المساحة الحالية (قد‬:‫م‬
∞ ‫يكون‬

Breadth-first search: Properties

Time and Memory Requirements for BFS

Page 5 of 14
By: Muhammad Mahmoud
Depth First Search
‫ توسيع العقد غير الموسعة األعمق‬:‫• الفكرة‬

• idea: Expand deepest unexpanded node


‫ أي‬،)‫ (مكدس‬LIFO ‫ الحدود هي طابور انتظار‬:‫• التنفيذ‬
.‫• يتم إدراج العقد الجديدة في الجزء األمامي من الحدود‬

• Implementation: frontier is a LIFO queue (a stack), i.e.

• New nodes are inserted at the Front of Frontier.

• Frontier=(A)
Explored=()

• Frontier=(B,C)
Explored=(A)

• Frontier=(D,E,C)
Explored=(A,B)

Page 6 of 14
By: Muhammad Mahmoud
• New nodes are inserted at the Front of FRONTIER.

• Frontier=(H,I,E,C)
Explored=(A,B,D)

• New nodes are inserted at the Front of FRONTIER.

• Frontier=(I,E,C)
Explored=(A,B,D,H)

• New nodes are inserted at the Front of FRONTIER.

• Frontier=(E,C)
Explored=(A,B,D,H,I)

Page 7 of 14
By: Muhammad Mahmoud
• New nodes are inserted at the Front of FRONTIER.

• Frontier=(J,K,C)

• Explored=(A,B,D,H,I,E)

• New nodes are inserted at the Front of FRONTIER.


• Frontier=(K,C)
Explored=(A,B,D,H,I,E,J)

• New nodes are inserted at the Front of FRONTIER.

• Frontier=(C)
• Explored=(A,B,D,H,I,E,J,K)

• New nodes are inserted at the Front of FRONTIER.

• Frontier=(F,G)

• Explored=(A,B,D,H,I,E,J,K,C)

Page 8 of 14
By: Muhammad Mahmoud
• New nodes are inserted at the Front of FRONTIER.

• Frontier=(L,M,G)

• Explored=(A,B,D,H,I,E,J,K,C,F)

• New nodes are inserted at the Front of FRONTIER.

• Fringe=(M,G)

• Explored=(A,B,D,H,I,E,J,K,C,F,L)

Depth first Search Properties

It needs to store only a single path from the


root to a leaf node It will explore the entire
left subtree even if a goal
node near the root.

Page 9 of 14
By: Muhammad Mahmoud
Depth-Limited Strategy (DLS)

• Alleviate the problem of DFS in infinite state spaces by supplying it with a predetermined depth
limit l.
• Below this limit L, nodes are not expanded.

• Three possible outcomes:

– Solution
– Failure (no solution)
– Cutoff (no solution within cutoff)
• DLS is incomplete when the shallowest goal is beyond the depth limit (l < d).

• DLS also is not optimal if l > d.


• Time complexity of DLS is O(bl ) in worst case.
• Space complexity of DLS is O(bl).
)DLS( ‫استراتيجية العمق المحدد‬
‫تخفف من مشكلة البحث في العمق في الفضاءات الحالية غير المحدودة عن طريق‬ •
.l ‫تزويده بحد عمق محدد مسبًقا‬
.‫ ال يتم توسيع العقد‬،L ‫تحت هذا الحد‬ •
:‫ثالثة نتائج محتملة‬ •
‫حًال‬ •
)‫ال يوجد حل‬
( ‫فشل‬ •
)‫ال يوجد حل ضمن الحد‬
( ‫قطع‬ •
‫تكون استراتيجية العمق المحدد غير كاملة عندما يكون أقصى هدف أبعد من الحد‬ •
.)l < d( ‫العمقي‬
.l > d ‫ ال تكون استراتيجية العمق المحدد مثلى إذا كان‬،‫أيًضا‬ •
.‫ في أسوأ الحاالت‬O(bl) ‫تعقيد الوقت الستراتيجية العمق المحدد هو‬ •
.O(bl) ‫تعقيد المساحة الستراتيجية العمق المحدد هو‬ •

Page 10 of 14
By: Muhammad Mahmoud
iterative Deepening Search (IDS)

– Applies DLS repeatedly with increasing depth and terminates when a solution is found or no
solutions exists.

– Combines the benefits of BFS and DFS:

– Like BFS, it is complete when the branching factor is finite.


– Like DFS, the memory requirements are very reasonable.

– Seem wasteful - many states are expanded multiple times.


– Almost all of the nodes are in the bottom level, so it does not matter much that the upper levels
are expanded multiple times.
)IDS( ‫تفتيش التعمق التكراري‬
.‫ مراًر ا وتكراًر ا مع زيادة العمق ويتوقف عند العثور على حل أو عدم وجود حل‬DLS ‫ يطبق‬-
:DFS ‫ و‬BFS ‫ يجمع بين فوائد‬-
.‫ فهو كامل عندما يكون معدل التفرع محدوًدا‬،BFS ‫ مثل‬-
.‫ فمتطلبات الذاكرة معقولة جًدا‬،DFS ‫ مثل‬-
.‫ يتم توسيع العديد من الحاالت مراًر ا وتكراًر ا‬- ‫ يبدو أنه يهدر‬-
‫ لذا ال يهم كثيًر ا أن ُتوسع المستويات العليا‬،‫ تكاد جميع العقد تكون في المستوى السفلي‬-
.‫مراًر ا وتكراًر ا‬

Iterative Deepening Strategy

• Repeat for limit l = 0, 1, 2, …:


Perform depth-first with depth limit l

Page 11 of 14
By: Muhammad Mahmoud
Iterative deepening search with depth limit 0

Iterative deepening search with depth limit 1

Iterative deepening search with depth limit 2

Iterative deepening search with depth limit 3

Page 12 of 14
By: Muhammad Mahmoud
Iterative deepening search: Properties

Uniform-Cost search (UCS)/ cheapest

First Search

• Each step has some cost > 0.


• expands the node n with the lowest path cost.
• frontier = priority queue ordered by path cost.
• The cost of the path to each frontier node N is
g(N) = Sum(costs of all steps)
• The goal is to generate a solution path of minimal cost.
• Equivalent to breadth-first if step costs all equal .
• Guarantee first founded solution is the cheapest solution.

‫ أول تفتيش األرخص‬/ )UCS( ‫البحث بتكلفة موّح دة‬


.0 > ‫• كل خطوة لها تكلفة‬
.‫ ذو تكلفة مسار أقل‬n ‫• يوّس ع العقد‬
.‫• الحدود = طابور انتظار ذو أولوية مرتبة حسب تكلفة المسار‬
‫ هي‬N ‫• تكلفة المسار إلى كل عقد حدودي‬
)‫ = مجموع (تكلفة كل الخطوات‬g(N)

Page 13 of 14
By: Muhammad Mahmoud
‫• الهدف هو إنشاء مسار حال ‪.minimal cost‬‬
‫• مكافئ للبحث أوًال إذا كانت تكاليف الخطوات متساوية‪.‬‬
‫• يضمن العثور على الحل األول هو الحل األرخص‪.‬‬

‫)‪Ex: Uniform-Cost search (UCS‬‬

‫‪Page 14 of 14‬‬
‫‪By: Muhammad Mahmoud‬‬

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy