SlideShare a Scribd company logo
1 of 57
Download to read offline
MAI611-KECERDASAN BUATAN
Problem Solving and Search
zahnur@unsyiah.ac.id
Jurusan Informatika FMIPA Unsyiah
September 18, 2021
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Problem Solving and Search
Agen cerdas memiliki:
pengetahuan tentang keadaan (state) ”dunia”
gagasan tentang bagaimana tindakan atau operasi
mengubah dunia
beberapa tujuan, atau state dunia, yang ingin diwujudkan,
Menemukan urutan operasi yang mengubah keadaan dunia
ke keadaan tujuan yang diinginkan adalah masalah
pencarian (search problem) atau perencanaan dasar
masalah (basic planning problem).
Algoritma pencarian adalah fondasi dari AI
State: deskripsi dunia pada waktu tertentu
mustahil untuk menggambarkan seluruh dunia
perlu mengabstraksi atribut atau properti yang penting.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Problem Solving and Search
Agen pemecahan masalah (problem-solving agent:
agen yang mampu merencanakan ke depan: untuk
mempertimbangkan urutan tindakan yang membentuk
lintasan menuju state tujuan.
Proses komputasi yang dilakukan disebut pencarian
(search).
Agen yang menggunakan representasi terfaktor
(factored) atau terstruktur (structured) dari state
disebut agen perencanaan (planning agents).
Algoritma informed: agen yang dapat memperkirakan
seberapa jauh state dari tujuan,
Algoritma uninformed: agen yang tidak ada perkiraan
seberapa jauh state dari tujuan yang tersedia.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Problem-Solving Agents
Bayangkan seorang agen menikmati liburan di Rumania.
Sekarang, misalkan agen tersebut saat ini berada di kota Arad
dan memiliki tiket yang tidak dapat dikembalikan untuk
terbang keluar dari Bucharest pada hari berikutnya. Agen
mengamati rambu-rambu jalan dan melihat bahwa ada tiga
jalan menuju keluar dari Arad: Sibiu, Timisoara, dan Zerind.
Tak satu pun dari ini yang menjadi tujuannya, jadi kecuali
agennya familiar dengan geografi Rumania, tidak akan tahu
jalan mana yang harus diikuti.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Problem-Solving Agents
Dengan informasi tersebut, agen dapat mengikuti proses
pemecahan masalah dalam empat fase:
1 Perumusan tujuan (goal formulation):
Tentukan tujuan yang ingin dicapai. Tujuan agen adalah
mencapai kota Bucharest.
2 Perumusan masalah (problem formulation):
Agen menyusun deskripsi tentang state dan tindakan yang
diperlukan untuk mencapai tujuan.
3 Pencarian (search):
Sebelum mengambil tindakan apa pun di dunia nyata, agen
mensimulasikan urutan tindakan dalam modelnya, mencari
sampai menemukan urutan tindakan yang mencapai
tujuan. Urutan tindakan seperti itu disebut solusi.
4 Eksekusi: Agen sekarang dapat menjalankan tindakan
dalam solusi, satu per satu.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Problem-Solving Agents
Giurgiu
Urziceni
Hirsova
Eforie
Neamt
Oradea
Zerind
Arad
Timisoara
Lugoj
Mehadia
Dobreta
Craiova
Sibiu Fagaras
Pitesti
Vaslui
Iasi
Rimnicu Vilcea
Bucharest
71
75
118
111
70
75
120
151
140
99
80
97
101
211
138
146 85
90
98
142
92
87
86
Contoh: Peta jalan di Rumania yang disederhanakan.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Problem-Solving Agents
Perumusan tujuan: Agen berada di kota Bucharest.
Perumusan masalah: Agen menyusun deskripsi tentang
state dan tindakan yang diperlukan untuk mencapai
tujuan.
- State: kota-kota yang dilalui di Rumania.
- Tindakan: menyetir dari kota yang satu ke kota yang
berdekatan berikutnya.
Pencarian: Sebelum mengambil tindakan apa pun di dunia
nyata, agen mensimulasikan urutan tindakan dalam
modelnya, mencari sampai menemukan urutan tindakan
yang mencapai tujuan. Urutan tindakan yang mengarah
dari state awal ke state tujuan disebut solusi (solution).
Rangkaian kota yang dituju, misal :Arad, Sibiu, Fagaras,
Bucharest.
Eksekusi: Agen sekarang dapat menjalankan tindakan
dalam solusi, satu per satu.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Search problems and solutions
Masalah pencarian dapat didefinisikan secara formal sebagai
berikut:
Sekumpulan kemungkinan keadaan (state) pada
lingkungan yang mungkin terjadi disebut ruang keadaan
(state space).
State awal (initial state) yaitu state dimana agen
memulai pencarian. Contoh: Arad.
Himpunan dari satu atau lebih state tujuan.
Action yang tersedia untuk agen. Diberikan state s,
ACTIONS(s) mereturn serangkaian tindakan berhingga
yang dapat dieksekusi dalam s. Kita katakan bahwa setiap
tindakan ini applicable di s.
Sebagai contoh:
ACTIONS(Arad) = {KeSibiu,KeTimisoara,KeZerind}.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Search problems and solutions
Model transisi (transition model), yang menjelaskan
apa yang dilakukan setiap tindakan. RESULT(s, a)
mereturn hasil dari melakukan tindakan a di states.
Sebagai contoh:
RESULT(Arad, ToZerind) = Zerind .
Fungsi biaya tindakan (action cost function),
dilambangkan dengan ACTION-COST(s,a,s’)) atau
c(s,a,s’), yaitu biaya numerik yang diperlukan untuk
menerapkan tindakan a pada state s untuk mencapai state
s’. Agen problem-solving harus menggunakan fungsi biaya
yang mencerminkan ukuran kinerjanya sendiri.
Sebagai contoh: untuk agen pencarian rute, biaya suatu
tindakan mungkin jarak dalam km.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Search problems and solutions
Urutan tindakan (actions) membentuk sebuah lintasan
(path), dan solusi (solution) adalah path dari state awal
ke state tujuan (goal state).
Solusi optimal (optimal solution)adalah path memiliki
biaya terendah di antara semua solusi yang mungkin.
Ruang keadaan dapat direpresentasikan sebagai graf
dimana verteks-verteksnya adalah state dan edge berarah
adalah tindakan.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Formulating problems
Rumusan masalah dimana agen sampai ke Bucharest
adalah sebuah model (deskripsi abstrak matematika) dan
bukan sesuatu yang nyata.
Proses menghilangkan detail dari suatu representasi
disebut abstraksi(abstraction).
Abstraksi valid jika kita dapat menguraikan solusi abstrak
apa pun menjadi solusi yang lebih rinci di dunia nyata.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: vacuum world
R
L
S S
S S
R
L
R
L
R
L
S
S
S
S
L
L
L
L R
R
R
R
States?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: vacuum world
R
L
S S
S S
R
L
R
L
R
L
S
S
S
S
L
L
L
L R
R
R
R
States?:integer kotor dan lokasi vacuum cleaner.
Initial state?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: vacuum world
R
L
S S
S S
R
L
R
L
R
L
S
S
S
S
L
L
L
L R
R
R
R
States?:integer kotor dan lokasi vacuum cleaner.
Initial state?: kotor di kedua lokasi, vacuum di salah
satunya.
Actions?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: vacuum world
R
L
S S
S S
R
L
R
L
R
L
S
S
S
S
L
L
L
L R
R
R
R
States?:integer kotor dan lokasi vacuum cleaner.
Initial state?: kotor di kedua lokasi, vacuum di salah
satunya.
Actions?: Left, Right, Suck
Transition model?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: vacuum world
R
L
S S
S S
R
L
R
L
R
L
S
S
S
S
L
L
L
L R
R
R
R
States?:integer kotor dan lokasi vacuum cleaner.
Initial state?: kotor di kedua lokasi, vacuum di salah
satunya.
Actions?: Left, Right, Suck
Transition model?:
Suck,Forward,Backward,TurnRight,TurnLeft
Goal states?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: vacuum world
R
L
S S
S S
R
L
R
L
R
L
S
S
S
S
L
L
L
L R
R
R
R
States?:integer kotor dan lokasi vacuum cleaner.
Initial state?: kotor di kedua lokasi, vacuum di salah
satunya.
Actions?: Left, Right, Suck
Transition model?:
Suck,Forward,Backward,TurnRight,TurnLeft
Goal states?: tidak ada kotoran pada kedua lokasi
Action cost?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: vacuum world
R
L
S S
S S
R
L
R
L
R
L
S
S
S
S
L
L
L
L R
R
R
R
States?:integer kotor dan lokasi vacuum cleaner.
Initial state?: kotor di kedua lokasi, vacuum di salah
satunya.
Actions?: Left, Right, Suck
Transition model?:
Suck,Forward,Backward,TurnRight,TurnLeft
Goal states?: tidak ada kotoran pada kedua lokasi
Action cost?: 1 untuk setiap langkah (0 untuk NoOP)
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: The 8-puzzle
2
Start State Goal State
1
3 4
6 7
5
1
2
3
4
6
7
8
5
8
Sliding puzzle (sliding block,tile,blocks,pieces puzzle)
States?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: The 8-puzzle
2
Start State Goal State
1
3 4
6 7
5
1
2
3
4
6
7
8
5
8
Sliding puzzle (sliding block,tile,blocks,pieces puzzle)
States?:lokasi integer masing-masing ubin.
Initial state?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: The 8-puzzle
2
Start State Goal State
1
3 4
6 7
5
1
2
3
4
6
7
8
5
8
Sliding puzzle (sliding block,tile,blocks,pieces puzzle)
States?:lokasi integer masing-masing ubin.
Initial state?: puzzle seperti konfugurasi di atas.
Actions?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: The 8-puzzle
2
Start State Goal State
1
3 4
6 7
5
1
2
3
4
6
7
8
5
8
Sliding puzzle (sliding block,tile,blocks,pieces puzzle)
States?:lokasi integer masing-masing ubin.
Initial state?: puzzle seperti konfugurasi di atas.
Actions?: move blank left, right, up, down.
Transition model?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: The 8-puzzle
2
Start State Goal State
1
3 4
6 7
5
1
2
3
4
6
7
8
5
8
Sliding puzzle (sliding block,tile,blocks,pieces puzzle)
States?:lokasi integer masing-masing ubin.
Initial state?: puzzle seperti konfugurasi di atas.
Actions?: move blank left, right, up, down.
Transition model?: Memetakan state dan tindakan ke state
yang dihasilkan.
Goal states?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: The 8-puzzle
2
Start State Goal State
1
3 4
6 7
5
1
2
3
4
6
7
8
5
8
Sliding puzzle (sliding block,tile,blocks,pieces puzzle)
States?:lokasi integer masing-masing ubin.
Initial state?: puzzle seperti konfugurasi di atas.
Actions?: move blank left, right, up, down.
Transition model?: Memetakan state dan tindakan ke state
yang dihasilkan.
Goal states?: goal state (diberikan)
Action cost?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Contoh Problems: The 8-puzzle
2
Start State Goal State
1
3 4
6 7
5
1
2
3
4
6
7
8
5
8
Sliding puzzle (sliding block,tile,blocks,pieces puzzle)
States?:lokasi integer masing-masing ubin.
Initial state?: puzzle seperti konfugurasi di atas.
Actions?: move blank left, right, up, down.
Transition model?: Memetakan state dan tindakan ke state
yang dihasilkan.
Goal states?: goal state (diberikan)
Action cost?: 1 untuk setiap gerakan
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Misalnya, masalah perjalanan udara yang harus diselesaikan
oleh travel-planning Web site:
States?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Misalnya, masalah perjalanan udara yang harus diselesaikan
oleh travel-planning Web site:
States?: setiap state penting seperti lokasi (misalkan
bandara) dan waktu sekarang.
Initial state?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Misalnya, masalah perjalanan udara yang harus diselesaikan
oleh travel-planning Web site:
States?: setiap state penting seperti lokasi (misalkan
bandara) dan waktu sekarang.
Initial state?: bandara keberangkatan user.
Actions?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Misalnya, masalah perjalanan udara yang harus diselesaikan
oleh travel-planning Web site:
States?: setiap state penting seperti lokasi (misalkan
bandara) dan waktu sekarang.
Initial state?: bandara keberangkatan user.
Actions?: melakukan penerbangan dari lokasi sekarang,
pada seat class tertentu, waktu keberangkatan, waktu
transit, dll.
Transition model?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Misalnya, masalah perjalanan udara yang harus diselesaikan
oleh travel-planning Web site:
States?: setiap state penting seperti lokasi (misalkan
bandara) dan waktu sekarang.
Initial state?: bandara keberangkatan user.
Actions?: melakukan penerbangan dari lokasi sekarang,
pada seat class tertentu, waktu keberangkatan, waktu
transit, dll.
Transition model?: state yang dihasilkan penerbangan akan
memiliki tujuan penerbangan sebagai lokasi baru dan
waktu kedatangan penerbangan sebagai waktu baru.
Goal states?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Misalnya, masalah perjalanan udara yang harus diselesaikan
oleh travel-planning Web site:
States?: setiap state penting seperti lokasi (misalkan
bandara) dan waktu sekarang.
Initial state?: bandara keberangkatan user.
Actions?: melakukan penerbangan dari lokasi sekarang,
pada seat class tertentu, waktu keberangkatan, waktu
transit, dll.
Transition model?: state yang dihasilkan penerbangan akan
memiliki tujuan penerbangan sebagai lokasi baru dan
waktu kedatangan penerbangan sebagai waktu baru.
Goal states?: kota tujuan
Action cost?:
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Misalnya, masalah perjalanan udara yang harus diselesaikan
oleh travel-planning Web site:
States?: setiap state penting seperti lokasi (misalkan
bandara) dan waktu sekarang.
Initial state?: bandara keberangkatan user.
Actions?: melakukan penerbangan dari lokasi sekarang,
pada seat class tertentu, waktu keberangkatan, waktu
transit, dll.
Transition model?: state yang dihasilkan penerbangan akan
memiliki tujuan penerbangan sebagai lokasi baru dan
waktu kedatangan penerbangan sebagai waktu baru.
Goal states?: kota tujuan
Action cost?: kombinasi biaya, waktu tunggu, waktu
penerbangan, bea cukai, dan prosedur imigrasi, kelas kursi,
waktu, jenis pesawat, dan sebagainya.
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Real-world problems
Masalah real world lainnya
Touring problems
Traveling salesperson problem (TSP)
VLSI layout
Robot navigation
Automatic assembly sequencing
Protein design
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Search Algorithms
Algoritma pencarian (search algorithm) mengambil
masalah pencarian sebagai input dan mereturn solusi, atau
mengindikasikan algoritma pencarian kegagalan.
Ide dasar dari search tree algorithms:
offline, simulasi eksplorasi ruang state
menghasilkan penerus (successors) dari state yang sudah
dijelajahi (atau memperluas state)
function Tree-Search(problem, strategy) returns a solution, or failure
initialize the search tree using the initial state of problem
loop do
if there are no candidates for expansion then return failure
choose a leaf node for expansion according to strategy
if the node contains a goal state then return the corresponding solution
else expand the node and add the resulting nodes to the search tree
end
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Search Algorithms
Initial state
RimnicuVilcea Lugoj
Zerind
Sibiu
Arad Fagaras Oradea
Timisoara
Arad
Arad Oradea
Arad
Arad Fagaras Oradea Arad
Arad Lugoj
RimnicuVilcea Oradea
Zerind
Arad
Sibiu Timisoara
Lugoj Arad
Arad Oradea
RimnicuVilcea
Zerind
Arad
Sibiu
Arad Fagaras Oradea
Timisoara
Setelah ekspasi Arad RimnicuVilcea Lugoj
Zerind
Sibiu
Arad Fagaras Oradea
Timisoara
Arad
Arad Oradea
Arad
Arad Fagaras Oradea Arad
Arad Lugoj
RimnicuVilcea Oradea
Zerind
Arad
Sibiu Timisoara
Lugoj Arad
Arad Oradea
RimnicuVilcea
Zerind
Arad
Sibiu
Arad Fagaras Oradea
Timisoara
Setelah ekspasi Sibiu
RimnicuVilcea Lugoj
Zerind
Sibiu
Arad Fagaras Oradea
Timisoara
Arad
Arad Oradea
Arad
Arad Fagaras Oradea Arad
Arad Lugoj
RimnicuVilcea Oradea
Zerind
Arad
Sibiu Timisoara
Lugoj Arad
Arad Oradea
RimnicuVilcea
Zerind
Arad
Sibiu
Arad Fagaras Oradea
Timisoara
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Search Algorithms
Urutan search tree yang dihasilkan oleh pencarian graf pada
masalah Rumania.
(a) (b) (c)
Pencarian graf pada masalah kotak persegi panjang (grid).
zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
Implementation: States vs Nodes
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ A state is a (representation of) a physical configuration
❑ A node is a data structure constituting part of a search tree
- includes parent, children, depth, path cost g(x)
❑ States do not have parents, children, depth, or path cost!
❑ The Expand function creates new nodes, filling in the various fields and
using the SuccessorFn of the problem to create the corresponding states
Search Strategies
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ A strategy is defined by picking the order of node expansion
❑ Strategies are evaluated along the following dimensions:
completeness → does it always find a solution if one exists?
time complexity → number of nodes generated/expanded
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 ∞)
Uninformed Search Strategies
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
Uninformed strategies use only the information available in the problem definition
❑ Breadth-first search
❑ Uniform-cost search
❑ Depth-first search
❑ Depth-limited search
❑ Iterative deepening search
Breadth-first Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Expand shallowest unexpanded node
❑ Implementation:
fringe is a FIFO queue, i.e., new successors go at end
Properties of Breadth-first Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Complete?? Yes (if b is finite)
❑ Time?? 1 + b + b2 + b3 + : : : + bd + b(bd - 1) = O(bd+1) , i.e., exp. in d
❑ Space?? O(bd+1) (keeps every node in memory)
❑ Optimal?? Yes (if cost = 1 per step); not optimal in general
Space is the big problem; can easily generate nodes at 100MB/sec;
so 24hrs = 8640GB
Uniform-cost Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Expand least-cost unexpanded node
❑ Implementation:
fringe = queue ordered by path cost, lowest first
❑ Equivalent to breadth-first if step costs all equal
❑ Complete? Yes, if step cost ≥ ∈
❑ Time? # of nodes with g ≤ cost of optimal solution, O(b[C*/∈])
where C∗ is the cost of the optimal solution
❑ Space?? # of nodes with g ≤ cost of optimal solution, O(b[C*/∈])
❑ Optimal?? Yes → nodes expanded in increasing order of g(n)
Depth-first Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Expand deepest unexpanded node
❑ Implementation:
fringe = LIFO queue, i.e., put successors at front
Depth-first Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Expand deepest unexpanded node
❑ Implementation:
fringe = LIFO queue, i.e., put successors at front
Depth-first Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Expand deepest unexpanded node
❑ Implementation:
fringe = LIFO queue, i.e., put successors at front
Depth-first Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Expand deepest unexpanded node
❑ Implementation:
fringe = LIFO queue, i.e., put successors at front
Properties of Depth-first Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Complete? No: fails in infinite-depth spaces, spaces with loops
→ Modify to avoid repeated states along path
→ complete in finite spaces
❑ Time? O(bm): terrible if m is much larger than d
but if solutions are dense, may be much faster than breadth-first
❑ Space? O(bm), i.e., linear space!
❑ Optimal? No
Depth-limited Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Dept-limited search = depth-first search with depth limit l
→ i.e. nodes at depth l have no successors
❑ Recursive implementation:
Iterative Deepening Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
Iterative Deepening Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
Iterative Deepening Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
Properties of Iterative Deepening Search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Complete? Yes
❑ Time? (d + 1)b0 + db1 + (d − 1)b2 + …+ bd = O(bd)
❑ Space? O(bd)
❑ Optimal? Yes, if step cost = 1
→ Can be modified to explore uniform-cost tree
❑ Numerical comparison for b = 10 and d = 5, solution at far-right leaf:
→ N(IDS) = 50 + 400 + 3,000 + 20,000 + 100,000 = 123,450
→ N(BFS) = 10 + 100 + 1,000 + 10,000 + 100,000 + 999,990 = 1,111,100
❑ IDS does better because other nodes at depth d are not expanded
❑ BFS can be modified to apply goal test when a node is generated
Summary of Algorithms
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
Repeated States
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Failure to detect repeated states can turn a linear problem into an exponential one!
Graph search
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
Summary
Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
❑ Problem formulation usually requires abstracting away real-world details to
define a state space that can feasibly be explored
❑ Variety of uninformed search strategies
❑ Iterative deepening search uses only linear space and not much more time
than other uninformed algorithms
❑ Graph search can be exponentially more efficient than tree search
References
[1] Russell, S. J. and Norvig, P., Artificial Intelligence: A Modern Approach,
Third Edition, Prentice Hall, USA, 2010.
Agents and Environments Rationality PEAS Environment Types Agent Types

More Related Content

Recently uploaded

Dampak Pendudukan Jepang.pptx indonesia1
Dampak Pendudukan Jepang.pptx indonesia1Dampak Pendudukan Jepang.pptx indonesia1
Dampak Pendudukan Jepang.pptx indonesia1udin100
 
421783639-ppt-overdosis-dan-keracunan-pptx.pptx
421783639-ppt-overdosis-dan-keracunan-pptx.pptx421783639-ppt-overdosis-dan-keracunan-pptx.pptx
421783639-ppt-overdosis-dan-keracunan-pptx.pptxGiftaJewela
 
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdfsdn3jatiblora
 
Modul Ajar Bahasa Indonesia Kelas 4 Fase B
Modul Ajar Bahasa Indonesia Kelas 4 Fase BModul Ajar Bahasa Indonesia Kelas 4 Fase B
Modul Ajar Bahasa Indonesia Kelas 4 Fase BAbdiera
 
Tugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docx
Tugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docxTugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docx
Tugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docxmawan5982
 
TUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdf
TUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdfTUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdf
TUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdfElaAditya
 
Karakteristik Negara Mesir (Geografi Regional Dunia)
Karakteristik Negara Mesir (Geografi Regional Dunia)Karakteristik Negara Mesir (Geografi Regional Dunia)
Karakteristik Negara Mesir (Geografi Regional Dunia)3HerisaSintia
 
KONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptx
KONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptxKONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptx
KONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptxawaldarmawan3
 
Aksi Nyata Modul 1.1 Calon Guru Penggerak
Aksi Nyata Modul 1.1 Calon Guru PenggerakAksi Nyata Modul 1.1 Calon Guru Penggerak
Aksi Nyata Modul 1.1 Calon Guru Penggeraksupriadi611
 
aku-dan-kebutuhanku-Kelas 4 SD Mapel IPAS
aku-dan-kebutuhanku-Kelas 4 SD Mapel IPASaku-dan-kebutuhanku-Kelas 4 SD Mapel IPAS
aku-dan-kebutuhanku-Kelas 4 SD Mapel IPASreskosatrio1
 
JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5
JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5
JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5ssuserd52993
 
11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptx
11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptx11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptx
11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptxMiftahunnajahTVIBS
 
Lembar Catatan Percakapan Pasca observasidocx
Lembar Catatan Percakapan Pasca observasidocxLembar Catatan Percakapan Pasca observasidocx
Lembar Catatan Percakapan Pasca observasidocxbkandrisaputra
 
PPT Integrasi Islam & Ilmu Pengetahuan.pptx
PPT Integrasi Islam & Ilmu Pengetahuan.pptxPPT Integrasi Islam & Ilmu Pengetahuan.pptx
PPT Integrasi Islam & Ilmu Pengetahuan.pptxnerow98
 
Aksi nyata disiplin positif Hj. Hasnani (1).pdf
Aksi nyata disiplin positif Hj. Hasnani (1).pdfAksi nyata disiplin positif Hj. Hasnani (1).pdf
Aksi nyata disiplin positif Hj. Hasnani (1).pdfDimanWr1
 
Contoh Laporan Observasi Pembelajaran Rekan Sejawat.pdf
Contoh Laporan Observasi Pembelajaran Rekan Sejawat.pdfContoh Laporan Observasi Pembelajaran Rekan Sejawat.pdf
Contoh Laporan Observasi Pembelajaran Rekan Sejawat.pdfCandraMegawati
 
soal AKM Mata Pelajaran PPKN kelas .pptx
soal AKM Mata Pelajaran PPKN kelas .pptxsoal AKM Mata Pelajaran PPKN kelas .pptx
soal AKM Mata Pelajaran PPKN kelas .pptxazhari524
 
AKSI NYATA NARKOBA ATAU OBAT TERLARANG..
AKSI NYATA NARKOBA ATAU OBAT TERLARANG..AKSI NYATA NARKOBA ATAU OBAT TERLARANG..
AKSI NYATA NARKOBA ATAU OBAT TERLARANG..ikayogakinasih12
 
DEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAK
DEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAKDEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAK
DEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAKirwan461475
 
Bab 6 Kreatif Mengungap Rasa dan Realitas.pdf
Bab 6 Kreatif Mengungap Rasa dan Realitas.pdfBab 6 Kreatif Mengungap Rasa dan Realitas.pdf
Bab 6 Kreatif Mengungap Rasa dan Realitas.pdfbibizaenab
 

Recently uploaded (20)

Dampak Pendudukan Jepang.pptx indonesia1
Dampak Pendudukan Jepang.pptx indonesia1Dampak Pendudukan Jepang.pptx indonesia1
Dampak Pendudukan Jepang.pptx indonesia1
 
421783639-ppt-overdosis-dan-keracunan-pptx.pptx
421783639-ppt-overdosis-dan-keracunan-pptx.pptx421783639-ppt-overdosis-dan-keracunan-pptx.pptx
421783639-ppt-overdosis-dan-keracunan-pptx.pptx
 
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdf
 
Modul Ajar Bahasa Indonesia Kelas 4 Fase B
Modul Ajar Bahasa Indonesia Kelas 4 Fase BModul Ajar Bahasa Indonesia Kelas 4 Fase B
Modul Ajar Bahasa Indonesia Kelas 4 Fase B
 
Tugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docx
Tugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docxTugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docx
Tugas 1 pembaruan dlm pembelajaran jawaban tugas tuton 1.docx
 
TUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdf
TUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdfTUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdf
TUGAS GURU PENGGERAK Aksi Nyata Modul 1.1.pdf
 
Karakteristik Negara Mesir (Geografi Regional Dunia)
Karakteristik Negara Mesir (Geografi Regional Dunia)Karakteristik Negara Mesir (Geografi Regional Dunia)
Karakteristik Negara Mesir (Geografi Regional Dunia)
 
KONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptx
KONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptxKONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptx
KONSEP KEBUTUHAN AKTIVITAS DAN LATIHAN.pptx
 
Aksi Nyata Modul 1.1 Calon Guru Penggerak
Aksi Nyata Modul 1.1 Calon Guru PenggerakAksi Nyata Modul 1.1 Calon Guru Penggerak
Aksi Nyata Modul 1.1 Calon Guru Penggerak
 
aku-dan-kebutuhanku-Kelas 4 SD Mapel IPAS
aku-dan-kebutuhanku-Kelas 4 SD Mapel IPASaku-dan-kebutuhanku-Kelas 4 SD Mapel IPAS
aku-dan-kebutuhanku-Kelas 4 SD Mapel IPAS
 
JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5
JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5
JAWAPAN BAB 1 DAN BAB 2 SAINS TINGKATAN 5
 
11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptx
11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptx11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptx
11 PPT Pancasila sebagai Paradigma Kehidupan dalam Masyarakat.pptx
 
Lembar Catatan Percakapan Pasca observasidocx
Lembar Catatan Percakapan Pasca observasidocxLembar Catatan Percakapan Pasca observasidocx
Lembar Catatan Percakapan Pasca observasidocx
 
PPT Integrasi Islam & Ilmu Pengetahuan.pptx
PPT Integrasi Islam & Ilmu Pengetahuan.pptxPPT Integrasi Islam & Ilmu Pengetahuan.pptx
PPT Integrasi Islam & Ilmu Pengetahuan.pptx
 
Aksi nyata disiplin positif Hj. Hasnani (1).pdf
Aksi nyata disiplin positif Hj. Hasnani (1).pdfAksi nyata disiplin positif Hj. Hasnani (1).pdf
Aksi nyata disiplin positif Hj. Hasnani (1).pdf
 
Contoh Laporan Observasi Pembelajaran Rekan Sejawat.pdf
Contoh Laporan Observasi Pembelajaran Rekan Sejawat.pdfContoh Laporan Observasi Pembelajaran Rekan Sejawat.pdf
Contoh Laporan Observasi Pembelajaran Rekan Sejawat.pdf
 
soal AKM Mata Pelajaran PPKN kelas .pptx
soal AKM Mata Pelajaran PPKN kelas .pptxsoal AKM Mata Pelajaran PPKN kelas .pptx
soal AKM Mata Pelajaran PPKN kelas .pptx
 
AKSI NYATA NARKOBA ATAU OBAT TERLARANG..
AKSI NYATA NARKOBA ATAU OBAT TERLARANG..AKSI NYATA NARKOBA ATAU OBAT TERLARANG..
AKSI NYATA NARKOBA ATAU OBAT TERLARANG..
 
DEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAK
DEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAKDEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAK
DEMONSTRASI KONTEKSTUAL MODUL 1.3 PENDIDIKAN GURU PENGGERAK
 
Bab 6 Kreatif Mengungap Rasa dan Realitas.pdf
Bab 6 Kreatif Mengungap Rasa dan Realitas.pdfBab 6 Kreatif Mengungap Rasa dan Realitas.pdf
Bab 6 Kreatif Mengungap Rasa dan Realitas.pdf
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

KecerdasanBuatan03b.pdf

  • 1. MAI611-KECERDASAN BUATAN Problem Solving and Search zahnur@unsyiah.ac.id Jurusan Informatika FMIPA Unsyiah September 18, 2021 zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 2. Problem Solving and Search Agen cerdas memiliki: pengetahuan tentang keadaan (state) ”dunia” gagasan tentang bagaimana tindakan atau operasi mengubah dunia beberapa tujuan, atau state dunia, yang ingin diwujudkan, Menemukan urutan operasi yang mengubah keadaan dunia ke keadaan tujuan yang diinginkan adalah masalah pencarian (search problem) atau perencanaan dasar masalah (basic planning problem). Algoritma pencarian adalah fondasi dari AI State: deskripsi dunia pada waktu tertentu mustahil untuk menggambarkan seluruh dunia perlu mengabstraksi atribut atau properti yang penting. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 3. Problem Solving and Search Agen pemecahan masalah (problem-solving agent: agen yang mampu merencanakan ke depan: untuk mempertimbangkan urutan tindakan yang membentuk lintasan menuju state tujuan. Proses komputasi yang dilakukan disebut pencarian (search). Agen yang menggunakan representasi terfaktor (factored) atau terstruktur (structured) dari state disebut agen perencanaan (planning agents). Algoritma informed: agen yang dapat memperkirakan seberapa jauh state dari tujuan, Algoritma uninformed: agen yang tidak ada perkiraan seberapa jauh state dari tujuan yang tersedia. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 4. Problem-Solving Agents Bayangkan seorang agen menikmati liburan di Rumania. Sekarang, misalkan agen tersebut saat ini berada di kota Arad dan memiliki tiket yang tidak dapat dikembalikan untuk terbang keluar dari Bucharest pada hari berikutnya. Agen mengamati rambu-rambu jalan dan melihat bahwa ada tiga jalan menuju keluar dari Arad: Sibiu, Timisoara, dan Zerind. Tak satu pun dari ini yang menjadi tujuannya, jadi kecuali agennya familiar dengan geografi Rumania, tidak akan tahu jalan mana yang harus diikuti. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 5. Problem-Solving Agents Dengan informasi tersebut, agen dapat mengikuti proses pemecahan masalah dalam empat fase: 1 Perumusan tujuan (goal formulation): Tentukan tujuan yang ingin dicapai. Tujuan agen adalah mencapai kota Bucharest. 2 Perumusan masalah (problem formulation): Agen menyusun deskripsi tentang state dan tindakan yang diperlukan untuk mencapai tujuan. 3 Pencarian (search): Sebelum mengambil tindakan apa pun di dunia nyata, agen mensimulasikan urutan tindakan dalam modelnya, mencari sampai menemukan urutan tindakan yang mencapai tujuan. Urutan tindakan seperti itu disebut solusi. 4 Eksekusi: Agen sekarang dapat menjalankan tindakan dalam solusi, satu per satu. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 6. Problem-Solving Agents Giurgiu Urziceni Hirsova Eforie Neamt Oradea Zerind Arad Timisoara Lugoj Mehadia Dobreta Craiova Sibiu Fagaras Pitesti Vaslui Iasi Rimnicu Vilcea Bucharest 71 75 118 111 70 75 120 151 140 99 80 97 101 211 138 146 85 90 98 142 92 87 86 Contoh: Peta jalan di Rumania yang disederhanakan. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 7. Problem-Solving Agents Perumusan tujuan: Agen berada di kota Bucharest. Perumusan masalah: Agen menyusun deskripsi tentang state dan tindakan yang diperlukan untuk mencapai tujuan. - State: kota-kota yang dilalui di Rumania. - Tindakan: menyetir dari kota yang satu ke kota yang berdekatan berikutnya. Pencarian: Sebelum mengambil tindakan apa pun di dunia nyata, agen mensimulasikan urutan tindakan dalam modelnya, mencari sampai menemukan urutan tindakan yang mencapai tujuan. Urutan tindakan yang mengarah dari state awal ke state tujuan disebut solusi (solution). Rangkaian kota yang dituju, misal :Arad, Sibiu, Fagaras, Bucharest. Eksekusi: Agen sekarang dapat menjalankan tindakan dalam solusi, satu per satu. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 8. Search problems and solutions Masalah pencarian dapat didefinisikan secara formal sebagai berikut: Sekumpulan kemungkinan keadaan (state) pada lingkungan yang mungkin terjadi disebut ruang keadaan (state space). State awal (initial state) yaitu state dimana agen memulai pencarian. Contoh: Arad. Himpunan dari satu atau lebih state tujuan. Action yang tersedia untuk agen. Diberikan state s, ACTIONS(s) mereturn serangkaian tindakan berhingga yang dapat dieksekusi dalam s. Kita katakan bahwa setiap tindakan ini applicable di s. Sebagai contoh: ACTIONS(Arad) = {KeSibiu,KeTimisoara,KeZerind}. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 9. Search problems and solutions Model transisi (transition model), yang menjelaskan apa yang dilakukan setiap tindakan. RESULT(s, a) mereturn hasil dari melakukan tindakan a di states. Sebagai contoh: RESULT(Arad, ToZerind) = Zerind . Fungsi biaya tindakan (action cost function), dilambangkan dengan ACTION-COST(s,a,s’)) atau c(s,a,s’), yaitu biaya numerik yang diperlukan untuk menerapkan tindakan a pada state s untuk mencapai state s’. Agen problem-solving harus menggunakan fungsi biaya yang mencerminkan ukuran kinerjanya sendiri. Sebagai contoh: untuk agen pencarian rute, biaya suatu tindakan mungkin jarak dalam km. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 10. Search problems and solutions Urutan tindakan (actions) membentuk sebuah lintasan (path), dan solusi (solution) adalah path dari state awal ke state tujuan (goal state). Solusi optimal (optimal solution)adalah path memiliki biaya terendah di antara semua solusi yang mungkin. Ruang keadaan dapat direpresentasikan sebagai graf dimana verteks-verteksnya adalah state dan edge berarah adalah tindakan. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 11. Formulating problems Rumusan masalah dimana agen sampai ke Bucharest adalah sebuah model (deskripsi abstrak matematika) dan bukan sesuatu yang nyata. Proses menghilangkan detail dari suatu representasi disebut abstraksi(abstraction). Abstraksi valid jika kita dapat menguraikan solusi abstrak apa pun menjadi solusi yang lebih rinci di dunia nyata. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 12. Contoh Problems: vacuum world R L S S S S R L R L R L S S S S L L L L R R R R States?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 13. Contoh Problems: vacuum world R L S S S S R L R L R L S S S S L L L L R R R R States?:integer kotor dan lokasi vacuum cleaner. Initial state?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 14. Contoh Problems: vacuum world R L S S S S R L R L R L S S S S L L L L R R R R States?:integer kotor dan lokasi vacuum cleaner. Initial state?: kotor di kedua lokasi, vacuum di salah satunya. Actions?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 15. Contoh Problems: vacuum world R L S S S S R L R L R L S S S S L L L L R R R R States?:integer kotor dan lokasi vacuum cleaner. Initial state?: kotor di kedua lokasi, vacuum di salah satunya. Actions?: Left, Right, Suck Transition model?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 16. Contoh Problems: vacuum world R L S S S S R L R L R L S S S S L L L L R R R R States?:integer kotor dan lokasi vacuum cleaner. Initial state?: kotor di kedua lokasi, vacuum di salah satunya. Actions?: Left, Right, Suck Transition model?: Suck,Forward,Backward,TurnRight,TurnLeft Goal states?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 17. Contoh Problems: vacuum world R L S S S S R L R L R L S S S S L L L L R R R R States?:integer kotor dan lokasi vacuum cleaner. Initial state?: kotor di kedua lokasi, vacuum di salah satunya. Actions?: Left, Right, Suck Transition model?: Suck,Forward,Backward,TurnRight,TurnLeft Goal states?: tidak ada kotoran pada kedua lokasi Action cost?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 18. Contoh Problems: vacuum world R L S S S S R L R L R L S S S S L L L L R R R R States?:integer kotor dan lokasi vacuum cleaner. Initial state?: kotor di kedua lokasi, vacuum di salah satunya. Actions?: Left, Right, Suck Transition model?: Suck,Forward,Backward,TurnRight,TurnLeft Goal states?: tidak ada kotoran pada kedua lokasi Action cost?: 1 untuk setiap langkah (0 untuk NoOP) zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 19. Contoh Problems: The 8-puzzle 2 Start State Goal State 1 3 4 6 7 5 1 2 3 4 6 7 8 5 8 Sliding puzzle (sliding block,tile,blocks,pieces puzzle) States?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 20. Contoh Problems: The 8-puzzle 2 Start State Goal State 1 3 4 6 7 5 1 2 3 4 6 7 8 5 8 Sliding puzzle (sliding block,tile,blocks,pieces puzzle) States?:lokasi integer masing-masing ubin. Initial state?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 21. Contoh Problems: The 8-puzzle 2 Start State Goal State 1 3 4 6 7 5 1 2 3 4 6 7 8 5 8 Sliding puzzle (sliding block,tile,blocks,pieces puzzle) States?:lokasi integer masing-masing ubin. Initial state?: puzzle seperti konfugurasi di atas. Actions?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 22. Contoh Problems: The 8-puzzle 2 Start State Goal State 1 3 4 6 7 5 1 2 3 4 6 7 8 5 8 Sliding puzzle (sliding block,tile,blocks,pieces puzzle) States?:lokasi integer masing-masing ubin. Initial state?: puzzle seperti konfugurasi di atas. Actions?: move blank left, right, up, down. Transition model?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 23. Contoh Problems: The 8-puzzle 2 Start State Goal State 1 3 4 6 7 5 1 2 3 4 6 7 8 5 8 Sliding puzzle (sliding block,tile,blocks,pieces puzzle) States?:lokasi integer masing-masing ubin. Initial state?: puzzle seperti konfugurasi di atas. Actions?: move blank left, right, up, down. Transition model?: Memetakan state dan tindakan ke state yang dihasilkan. Goal states?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 24. Contoh Problems: The 8-puzzle 2 Start State Goal State 1 3 4 6 7 5 1 2 3 4 6 7 8 5 8 Sliding puzzle (sliding block,tile,blocks,pieces puzzle) States?:lokasi integer masing-masing ubin. Initial state?: puzzle seperti konfugurasi di atas. Actions?: move blank left, right, up, down. Transition model?: Memetakan state dan tindakan ke state yang dihasilkan. Goal states?: goal state (diberikan) Action cost?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 25. Contoh Problems: The 8-puzzle 2 Start State Goal State 1 3 4 6 7 5 1 2 3 4 6 7 8 5 8 Sliding puzzle (sliding block,tile,blocks,pieces puzzle) States?:lokasi integer masing-masing ubin. Initial state?: puzzle seperti konfugurasi di atas. Actions?: move blank left, right, up, down. Transition model?: Memetakan state dan tindakan ke state yang dihasilkan. Goal states?: goal state (diberikan) Action cost?: 1 untuk setiap gerakan zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 26. Real-world problems Misalnya, masalah perjalanan udara yang harus diselesaikan oleh travel-planning Web site: States?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 27. Real-world problems Misalnya, masalah perjalanan udara yang harus diselesaikan oleh travel-planning Web site: States?: setiap state penting seperti lokasi (misalkan bandara) dan waktu sekarang. Initial state?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 28. Real-world problems Misalnya, masalah perjalanan udara yang harus diselesaikan oleh travel-planning Web site: States?: setiap state penting seperti lokasi (misalkan bandara) dan waktu sekarang. Initial state?: bandara keberangkatan user. Actions?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 29. Real-world problems Misalnya, masalah perjalanan udara yang harus diselesaikan oleh travel-planning Web site: States?: setiap state penting seperti lokasi (misalkan bandara) dan waktu sekarang. Initial state?: bandara keberangkatan user. Actions?: melakukan penerbangan dari lokasi sekarang, pada seat class tertentu, waktu keberangkatan, waktu transit, dll. Transition model?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 30. Real-world problems Misalnya, masalah perjalanan udara yang harus diselesaikan oleh travel-planning Web site: States?: setiap state penting seperti lokasi (misalkan bandara) dan waktu sekarang. Initial state?: bandara keberangkatan user. Actions?: melakukan penerbangan dari lokasi sekarang, pada seat class tertentu, waktu keberangkatan, waktu transit, dll. Transition model?: state yang dihasilkan penerbangan akan memiliki tujuan penerbangan sebagai lokasi baru dan waktu kedatangan penerbangan sebagai waktu baru. Goal states?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 31. Real-world problems Misalnya, masalah perjalanan udara yang harus diselesaikan oleh travel-planning Web site: States?: setiap state penting seperti lokasi (misalkan bandara) dan waktu sekarang. Initial state?: bandara keberangkatan user. Actions?: melakukan penerbangan dari lokasi sekarang, pada seat class tertentu, waktu keberangkatan, waktu transit, dll. Transition model?: state yang dihasilkan penerbangan akan memiliki tujuan penerbangan sebagai lokasi baru dan waktu kedatangan penerbangan sebagai waktu baru. Goal states?: kota tujuan Action cost?: zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 32. Real-world problems Misalnya, masalah perjalanan udara yang harus diselesaikan oleh travel-planning Web site: States?: setiap state penting seperti lokasi (misalkan bandara) dan waktu sekarang. Initial state?: bandara keberangkatan user. Actions?: melakukan penerbangan dari lokasi sekarang, pada seat class tertentu, waktu keberangkatan, waktu transit, dll. Transition model?: state yang dihasilkan penerbangan akan memiliki tujuan penerbangan sebagai lokasi baru dan waktu kedatangan penerbangan sebagai waktu baru. Goal states?: kota tujuan Action cost?: kombinasi biaya, waktu tunggu, waktu penerbangan, bea cukai, dan prosedur imigrasi, kelas kursi, waktu, jenis pesawat, dan sebagainya. zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 33. Real-world problems Masalah real world lainnya Touring problems Traveling salesperson problem (TSP) VLSI layout Robot navigation Automatic assembly sequencing Protein design zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 34. Search Algorithms Algoritma pencarian (search algorithm) mengambil masalah pencarian sebagai input dan mereturn solusi, atau mengindikasikan algoritma pencarian kegagalan. Ide dasar dari search tree algorithms: offline, simulasi eksplorasi ruang state menghasilkan penerus (successors) dari state yang sudah dijelajahi (atau memperluas state) function Tree-Search(problem, strategy) returns a solution, or failure initialize the search tree using the initial state of problem loop do if there are no candidates for expansion then return failure choose a leaf node for expansion according to strategy if the node contains a goal state then return the corresponding solution else expand the node and add the resulting nodes to the search tree end zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 35. Search Algorithms Initial state RimnicuVilcea Lugoj Zerind Sibiu Arad Fagaras Oradea Timisoara Arad Arad Oradea Arad Arad Fagaras Oradea Arad Arad Lugoj RimnicuVilcea Oradea Zerind Arad Sibiu Timisoara Lugoj Arad Arad Oradea RimnicuVilcea Zerind Arad Sibiu Arad Fagaras Oradea Timisoara Setelah ekspasi Arad RimnicuVilcea Lugoj Zerind Sibiu Arad Fagaras Oradea Timisoara Arad Arad Oradea Arad Arad Fagaras Oradea Arad Arad Lugoj RimnicuVilcea Oradea Zerind Arad Sibiu Timisoara Lugoj Arad Arad Oradea RimnicuVilcea Zerind Arad Sibiu Arad Fagaras Oradea Timisoara Setelah ekspasi Sibiu RimnicuVilcea Lugoj Zerind Sibiu Arad Fagaras Oradea Timisoara Arad Arad Oradea Arad Arad Fagaras Oradea Arad Arad Lugoj RimnicuVilcea Oradea Zerind Arad Sibiu Timisoara Lugoj Arad Arad Oradea RimnicuVilcea Zerind Arad Sibiu Arad Fagaras Oradea Timisoara zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 36. Search Algorithms Urutan search tree yang dihasilkan oleh pencarian graf pada masalah Rumania. (a) (b) (c) Pencarian graf pada masalah kotak persegi panjang (grid). zahnur@unsyiah.ac.id MAI611-KECERDASAN BUATAN
  • 37. Implementation: States vs Nodes Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ A state is a (representation of) a physical configuration ❑ A node is a data structure constituting part of a search tree - includes parent, children, depth, path cost g(x) ❑ States do not have parents, children, depth, or path cost! ❑ The Expand function creates new nodes, filling in the various fields and using the SuccessorFn of the problem to create the corresponding states
  • 38. Search Strategies Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ A strategy is defined by picking the order of node expansion ❑ Strategies are evaluated along the following dimensions: completeness → does it always find a solution if one exists? time complexity → number of nodes generated/expanded 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 ∞)
  • 39. Uninformed Search Strategies Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm Uninformed strategies use only the information available in the problem definition ❑ Breadth-first search ❑ Uniform-cost search ❑ Depth-first search ❑ Depth-limited search ❑ Iterative deepening search
  • 40. Breadth-first Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Expand shallowest unexpanded node ❑ Implementation: fringe is a FIFO queue, i.e., new successors go at end
  • 41. Properties of Breadth-first Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Complete?? Yes (if b is finite) ❑ Time?? 1 + b + b2 + b3 + : : : + bd + b(bd - 1) = O(bd+1) , i.e., exp. in d ❑ Space?? O(bd+1) (keeps every node in memory) ❑ Optimal?? Yes (if cost = 1 per step); not optimal in general Space is the big problem; can easily generate nodes at 100MB/sec; so 24hrs = 8640GB
  • 42. Uniform-cost Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Expand least-cost unexpanded node ❑ Implementation: fringe = queue ordered by path cost, lowest first ❑ Equivalent to breadth-first if step costs all equal ❑ Complete? Yes, if step cost ≥ ∈ ❑ Time? # of nodes with g ≤ cost of optimal solution, O(b[C*/∈]) where C∗ is the cost of the optimal solution ❑ Space?? # of nodes with g ≤ cost of optimal solution, O(b[C*/∈]) ❑ Optimal?? Yes → nodes expanded in increasing order of g(n)
  • 43. Depth-first Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Expand deepest unexpanded node ❑ Implementation: fringe = LIFO queue, i.e., put successors at front
  • 44. Depth-first Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Expand deepest unexpanded node ❑ Implementation: fringe = LIFO queue, i.e., put successors at front
  • 45. Depth-first Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Expand deepest unexpanded node ❑ Implementation: fringe = LIFO queue, i.e., put successors at front
  • 46. Depth-first Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Expand deepest unexpanded node ❑ Implementation: fringe = LIFO queue, i.e., put successors at front
  • 47. Properties of Depth-first Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Complete? No: fails in infinite-depth spaces, spaces with loops → Modify to avoid repeated states along path → complete in finite spaces ❑ Time? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first ❑ Space? O(bm), i.e., linear space! ❑ Optimal? No
  • 48. Depth-limited Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Dept-limited search = depth-first search with depth limit l → i.e. nodes at depth l have no successors ❑ Recursive implementation:
  • 49. Iterative Deepening Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
  • 50. Iterative Deepening Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
  • 51. Iterative Deepening Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
  • 52. Properties of Iterative Deepening Search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Complete? Yes ❑ Time? (d + 1)b0 + db1 + (d − 1)b2 + …+ bd = O(bd) ❑ Space? O(bd) ❑ Optimal? Yes, if step cost = 1 → Can be modified to explore uniform-cost tree ❑ Numerical comparison for b = 10 and d = 5, solution at far-right leaf: → N(IDS) = 50 + 400 + 3,000 + 20,000 + 100,000 = 123,450 → N(BFS) = 10 + 100 + 1,000 + 10,000 + 100,000 + 999,990 = 1,111,100 ❑ IDS does better because other nodes at depth d are not expanded ❑ BFS can be modified to apply goal test when a node is generated
  • 53. Summary of Algorithms Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
  • 54. Repeated States Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Failure to detect repeated states can turn a linear problem into an exponential one!
  • 55. Graph search Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm
  • 56. Summary Problem-solving Agents Problem Types Problem Formulation Example Problems Basic Search Algorithm ❑ Problem formulation usually requires abstracting away real-world details to define a state space that can feasibly be explored ❑ Variety of uninformed search strategies ❑ Iterative deepening search uses only linear space and not much more time than other uninformed algorithms ❑ Graph search can be exponentially more efficient than tree search
  • 57. References [1] Russell, S. J. and Norvig, P., Artificial Intelligence: A Modern Approach, Third Edition, Prentice Hall, USA, 2010. Agents and Environments Rationality PEAS Environment Types Agent Types