Vous êtes sur la page 1sur 3

# Kecerdasan Buatan.

## 1. Apa yang dimaksud dengan AI! Jelaskan!

Jawab: Artificial Intelligence atau kecerdasan buatan adalah salah satu cabang ilmu
pengetahuan yang dapat menjadikan suatu sistem komputer atau mesin
komputer dapat berpikir dan bertindak seperti manusia.

2. Apa yang dimaksud dengan agen cerdas? Jelaskan! Tuliskan jenis-jenis agen cerdas.
Jawab: Agen cerdas adalah segala sesuatu yang menangkap /melihat informasi
disekitarnya melalui sensor, dan beraksi melalui aktuator.
Jenis-jenis agen cerdas.
- Simple Reflex Agent
- Simple Reflex Agent with State
- Goal Based Agent
- Utility Based Agent
- Learning Agent

## 3. Please write a pseudocode of A* star algorithm!

// A*
initialize the open list
initialize the closed list
put the starting node on the open list (you can leave its f at zero)

## while the open list is not empty

find the node with the least f on the open list, call it "q"
pop q off the open list
generate q's 8 successors and set their parents to q
for each successor
if successor is the goal, stop the search
successor.g = q.g + distance between successor and q
successor.h = distance from goal to successor
successor.f = successor.g + successor.h

## if a node with the same position as successor is in the OPEN list \

which has a lower f than successor, skip this successor
if a node with the same position as successor is in the CLOSED list \
which has a lower f than successor, skip this successor
otherwise, add the node to the open list
end
push q on the closed list
end

Case:
There are two kettles with capacity 4 litres for kettle A and 3 litres for kettle B. There
is no sign about the water containing in the kettle. There is a source of water. How to
fill 2 litres of water into kettle A?
4. Please solve the above case using a local searching method!

## 5. Please solve the above case using A* algorithm!

Pseudocode Uniform Cost Search
function UNIFORM-COST-SEARCH(problem) returns a solution, or failure
node a node with STATE = problem.INITIAL-STATE, PATH-COST = 0
frontier a priority queue ordered by PATH-COST, with node as the only element
explored an empty set
loop do
if EMPTY?(frontier) then return failure
node POP(frontier) /* chooses the lowest-cost node in frontier */
if problem.GOAL-TEST(node.STATE) then return SOLUTION(node)
for each action in problem.ACTIONS(node.STATE) do
child CHILD-NODE(problem,node,action)
if child.STATE is not in explored or frontier then
frontier INSERT(child,frontier)
else if child.STATE is in frontier with higher PATH-COST then
replace that frontier node with child

## Pseudocode Depth Limited Search

function DEPTH-LIMITED-SEARCH(problem,limit) returns a solution, or failure/cutoff
return RECURSIVE-DLS(MAKE-NODE(problem.INTIAL-STATE),problem,limit)

## function RECURSIVE-DLS(node,problem,limit) returns a solution, or failure/cutoff

if problem.GOAL-TEST(node.STATE) then return SOLUTION(node)
else if limit = 0 then return cutoff
else
cutoff_occurred? false
for each action in problem.ACTIONS(node.STATE) do
child CHILD-NODE(problem,node,action)
result RECURSIVE-DLS(child,problem,limit-1)
if result = cutoff then cutoff_occurred? true
else if result failure then return result
if cutoff_occurred? then return cutoff else return failure

## Pseudocode Iterative Deepening Search

function ITERATIVE-DEEPENING-SEARCH(problem) returns a solution, or failure
for depth = 0 to do
result DEPTH-LIMITED-SEARCH(problem,depth)
if result cutoff then return result