You are on page 1of 13

BLG435E - PS 1

WaterJugs Problem BLG435E ArtificialIntelligence


Youaregiventwojugs,a3literjug,anda4literjug. Initiallybothjugsareempty. Neitherjugshasanymeasuringmarkersonit. Thereisawatersourceandadrain. Eitherjugcanbefilledfromwatersource,emptiedtodrain,or pouredintotheother.(Fillingandemptyingoperationsmustbein complete.) Youareallowedtodrain(i.e.waste)waterifnecessary.

PracticeSession1:ProblemSolving

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

WaterJugs Problem

WaterJugs Problem
Problem: Howcanyougetexactly2 liters of waterintothe4literjug? Findthesequenceof actions(i.e.solutionpath)frominitialstatetothe goalstate.

water source

Initial State

drain

3-liter jug

4-liter jug

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

WaterJugs Problem

WaterJugs Problem
States:Amountsofwaterineachjug.Wecanrepresentstates with(J3,J4) variablepairs. J3 isforthe3literjug. J4 isforthe4literjug. InitialState:J3 =0andJ4 =0 GoalTest: J3 =0andJ4 =2 G lT 0 dJ 2 Actions:6possibleactions Pathcost:uniformstepcostsforeachaction Sizeofthestatespace:14possiblestates

water source

Initial State

Goal State

drain

3-liter jug

4-liter jug

3-liter jug

4-liter jug

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

BLG435E - PS 1

ActionsinWaterJugs Problem Action1:Fillthe4literjugtocapacityfromawater source. Action2:Fillthe3literjugtocapacityfromawater source. Action3:Emptythe4literjugintothedrain. Action4:Emptythe3literjugintothedrain. Action5:Pourfromthe3literjuginto4literjug untilcapacityreached. Action6:Pourfromthe4literjuginto3literjug untilcapacityreached.

SearchSpaceWaterJugsProblem

(J3, J4) 14 nodes 46 arcs

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

SearchTreeWaterJugsProblem

WaterJugs Problem Solution


3-liter Jug 0 3 0 3 2 2 0 4-liter Jug 0 0 3 3 4 0 2
10

STEP ACTION 0 1 2 3 4 5 6
ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay 9

Initial state: Both jugs are empty Action2) Fill the 3-liter jug Action5) Pour from the 3-liter jug 3 liter into 4-liter jug Action2) Fill the 3-liter jug Action5) Pour from the 3-liter jug into 4-liter jug Action3) Empty the 4-liter jug into a drain Action5) Pour from the 3-liter jug into 4-liter jug

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

WaterJugs Problem DFSSolution


initial state 0 ,0

WaterJugs Problem DFSSolution

0 ,0 action1 0,4 action2 3 ,0 ,

OPEN = (0,0) CLOSED = empty


ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay 11

OPEN = (0,4) (3,0) CLOSED = (0,0)


ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay 12

BLG435E - PS 1

WaterJugs Problem DFSSolution

WaterJugs Problem DFSSolution

0 ,0 action1 action2 3 ,0 , action2 3,4 action6 3 ,1 action2 3,4 action1 0,4 action2 3 ,0 , action6 3 ,1

OPEN = (3,4) (3,1) (3,0) CLOSED = (0,0) (0,4)


ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay 13

OPEN = (3,1) (3,0) CLOSED = (0,0) (0,4) (3,4)


ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay 14

WaterJugs Problem DFSSolution

WaterJugs Problem DFSSolution

0 ,0 action1 0,4 action2 3,4 action2 3 ,0 , action6 3 ,1 action4


OPEN = (0,1) (3,0) CLOSED = (0,0) (0,4) (3,4) (3,1)

0 ,0 action1 0,4 action2 3,4 action2 3 ,0 , action6 action6 3 ,1 action4 0 ,1


OPEN = (1,0) (3,0) CLOSED = (0,0) (0,4) (3,4) (3,1) (0,1)
15

1 ,0

0 ,1

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

16

WaterJugs Problem DFSSolution

WaterJugs Problem DFSSolution

0 ,0 action1 0,4 action2 3,4 action2 3 ,0 , action6 action6 3 ,1 action4


OPEN = (1,4) (3,0) CLOSED = (0,0) (0,4) (3,4) (3,1) (0,1) (1,0)

1 0 action2 1 ,4 action2 3,4 action1 0,4

0 ,0 action2 3 ,0 , action6 action6 3 ,1 action4

1 ,0 action2 1 ,4 action6 3 ,2

0 ,1

OPEN = (3,2) (3,0) CLOSED = (0,0) (0,4) (3,4) (3,1) (0,1) (1,0) (1,4)
17
17 ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay 18

0 ,1

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

BLG435E - PS 1

WaterJugs Problem DFSSolution

WaterJugs Problem DFSSolution

0 ,0 action1 0,4 action2 3,4 action2 3 ,0 , action6 action6 3 ,1 action4


OPEN = (0,2) (3,0) CLOSED = (0,0) (0,4) (3,4) (3,1) (0,1) (1,0) (1,4) (3,2)

1 ,0 action1 1 ,4 action2 action6 3 2 action4 0 ,1 0 ,2 3,4 action1 0,4

0 ,0 action2 3 ,0 , action6 action6 3 ,1 action4 0 ,1

1 ,0 action1 1 ,4 action6 3, 2 action4

OPEN = (3,0) 0, 2 CLOSED = (0,0) (0,4) (3,4) (3,1) (0,1) (1,0) (1,4) (3,2) (0,2)
19 ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay 20

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

WaterJugs Problem DFSSolution

WaterJugs Problem DFSSolution


SolutionPath: initialstate:(0,0) action1:(0,4) action6:(3,1) action4:(0,1) action6:(1,0) i 6 ( 0) action1:(1,4) action6:(3,2) action4:(0,2)goalstate

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

21

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

22

WaterJugs Problem BFSSolution


initial state 0 ,0

WaterJugs Problem BFSSolution

0 ,0 action1 0,4 action2 3 ,0 ,

OPEN=(0,0) CLOSED =empty

OPEN=(0,4) (3,0) CLOSED =(0,0)

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

23

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

24

BLG435E - PS 1

WaterJugs Problem BFSSolution

WaterJugs Problem BFSSolution

0 ,0 action1 0,4 action2 3,4 action2 3 0 action6 3 ,1 action2 3,4 action1 0,4

0 ,0 action2 3 ,0 , action6 3 ,1 action5 0 ,3

OPEN=(3,0)(3,4) (3,1) CLOSED =(0,0) (0,4)

OPEN=(3,4) (3,1)(0,3) CLOSED =(0,0) (0,4)(3,0)

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

25

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

26

WaterJugs Problem BFSSolution

WaterJugs Problem BFSSolution

0 ,0 action1 0,4 action2 3,4 action2 3 ,0 , action6 3 1 action5 0 ,3 action2 3,4 action1 0,4

0 ,0 action2 3 ,0 , action6 3 ,1 action4 0 ,1 action5 0 ,3

OPEN=(3,1)(0,3) CLOSED =(0,0) (0,4)(3,0)(3,4)

OPEN=(0,3)(0,1) CLOSED =(0,0) (0,4)(3,0)(3,4) (3,1)

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

27

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

28

WaterJugs Problem BFSSolution

WaterJugs Problem BFSSolution

0 ,0 action1 0,4 action2 3,4 action4 0 ,1


OPEN=(0,1)(3,3) CLOSED =(0,0) (0,4)(3,0)(3,4) (3,1)(0,3)

0 ,0 action2 action6 3 ,0 , 1 ,0 action5 0 ,3 action2 3 ,3 action2 3,4 action4 0 ,1


OPEN=(3,3)(1,0) CLOSED =(0,0) (0,4)(3,0)(3,4) (3,1)(0,3)(0,1)

action1 0,4

action2 3 ,0 , action6 3 ,1 action5 0 ,3 action2 3 ,3

action6 3 ,1

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

29

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

30

BLG435E - PS 1

WaterJugs Problem BFSSolution

WaterJugs Problem BFSSolution

0 ,0 action1 action6 1 ,0 action2 3,4 action4 0 ,1


OPEN=(1,0)(2,4) CLOSED =(0,0) (0,4)(3,0)(3,4) (3,1)(0,3)(0,1)(3,3)

0 ,0 action2 action5 action6 2 ,4 action5 0 ,3 action2 3 ,3 1 ,0


action1

action1 0,4 action2 3,4 action4 0 ,1

action2 action5 3 ,0 , action6 3 ,1 action5 0 ,3 action2 3 ,3 2 ,4

0,4

3 ,0 , action6 3 ,1

1 ,4

OPEN = (2,4) (1,4) CLOSED = (0,0) (0,4) (3,0) (3,4) (3,1) (0,3) (0,1) (3,3) (1,0)

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

31

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

32

WaterJugs Problem BFSSolution

WaterJugs Problem BFSSolution

0 ,0 action1 action6 1 ,0
action1

0 ,0 action2 action5 action6 2 ,4 action5 0 ,3 action2 3 ,3 2 ,0


action3

action1 1 ,0
action1

action2 action5 3 ,0 , action6 3 ,1 action5 0 ,3 action2 3 ,3 2 ,0 2 ,4


action3

0,4 action2 3,4 action4 0 ,1

3 ,0 , action6 3 ,1

0,4 action2 3,4 action4 0 ,1

1 ,4

1 ,4
action6

OPEN = (1,4) (2,0) CLOSED = (0,0) (0,4) (3,0) (3,4) (3,1) (0,3) (0,1) (3,3) (1,0) (2,4)

3 ,2

OPEN = (2,0) (3,2) CLOSED = (0,0) (0,4) (3,0) (3,4) (3,1) (0,3) (0,1) (3,3) (1,0) (2,4) (1,4)

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

33

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

34

WaterJugs Problem BFSSolution

WaterJugs Problem BFSSolution

0 ,0 action1 action6 1 ,0
action1

0 ,0 action2 action5 action6 2 ,4 action5 0 ,3 action2 3 ,3 0 ,2


35

action1 1 ,0
action3 action1

action2 action5 3 ,0 , action6 3 ,1 action5 0 ,3 action2 3 ,3 0 ,2


36

0,4 action2 3,4 action4 0 ,1

3 ,0 , action6 3 ,1

0,4 action2 3,4 action4 0 ,1

2 ,4
action3

1 ,4
action6

2 ,0
action5

1 ,4
action6

2 ,0
action5

3 ,2

OPEN = (3,2) (0,2) CLOSED = (0,0) (0,4) (3,0) (3,4) (3,1) (0,3) (0,1) (3,3) (1,0) (2,4) (1,4) (2,0)

3 ,2

OPEN = (0,2) CLOSED = (0,0) (0,4) (3,0) (3,4) (3,1) (0,3) (0,1) (3,3) (1,0) (2,4) (1,4) (2,0) (3,2)

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

BLG435E - PS 1

WaterJugs Problem BFSSolution

WaterJugs Problem BFSSolution


SolutionPath: initialstate:(0,0) action2:(3,0) action5:(0,3) action2:(3,3) action2: (3 3) action5:(2,4) action3:(2,0) action5:(0,2)goalstate

0 ,0 action1 action6 1 ,0
action1

action2 action5 3 ,0 , action6 3 ,1 action5 0 ,3 action2 3 ,3 0 ,2


37

0,4 action2 3,4 action4 0 ,1

2 ,4
action3

1 ,4
action6

2 ,0
action5

3 ,2

OPEN = Empty CLOSED = (0,0) (0,4) (3,0) (3,4) (3,1) (0,3) (0,1) (3,3) (1,0) (2,4) (1,4) (2,0) (3,2) (0,2)

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

38

WaterJugs Problem BFSSolution

PathPlanninginaMaze
Arobotwillgofroma start location toa goallocationin amaze(labyrinth). Ateachstep,therearefourdirections tomove:North, East,South,West;ifthereisnoobstacle. Problem: Findtheshortestpathfortherobot,sothatthe robotcanfollowthispathplan. Themapisknown,theplanisconstructedoffline.

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

39

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

40

PathPlanninginaMaze

PathPlanningProblemFormulation
States:Mazelocations InitialState:Startlocationoftherobot Actions:Moveinfourdirections {North,South,West,East}ifpossible

MAZE
Start

Goal

GoalTest:Stoplocationofrobot Step Cost: 1 PathCost: Lengthofthepathfromstarttogoal.

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

41

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

42

BLG435E - PS 1

PathPlanning GreedySolution
h(n)=Manhattandistancefromnodentogoal f(n)=h(n) Iftherearenodeswithequalh(n)values,Greedysearch willselectthenewest nodeinOPEN. will select the newest node in OPEN

PathPlanning GreedySolution
Initialstep:ThestartlocationisintheOPENlist. Manhattandistancefromstartlocationtothegoallocation: f(start)=h(start)=7

Goal Start 7

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

43

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

44

PathPlanning GreedySolution
Startlocation(7)isselectedandclosed. ItssuccessorsaregeneratedandputonOPEN. Manhattandistancesofsuccessorsare(6),(6),and(8).

PathPlanning GreedySolution
Searchmovestoeast. Thelowerlocation(6)isselectedandclosed. Itssuccessor(7)isgeneratedandputonOPEN.

6 Start 7 8 6

Goal

6 Start 7 8 6 7

Goal

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

45

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

46

PathPlanning GreedySolution
Searchmovestoeast. Thelowerlocation(6)isselectedandclosed. Itssuccessor(7)isgeneratedandputonOPEN.

PathPlanning GreedySolution
Searchcomesbackandmovestonorth. Theupperlocation(6)isselectedandclosed. Itssuccessor(7)isgeneratedandputonOPEN.

7 6 Start 7 8 6 7 Goal 6 Start 7 8 6 7 Goal

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

47

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

48

BLG435E - PS 1

PathPlanning GreedySolution
Searchmovestonorth. Theupperlocation(7)isselectedandclosed. Itssuccessor(8)isgeneratedandputonOPEN.

PathPlanning GreedySolution
Searchcomesbackandmovestosouth. Thelowerlocation(7)isselectedandclosed. Itssuccessor(6)isgeneratedandputonOPEN.

8 7 6 Start 7 8 6 7 Goal

8 7 6 Start 7 8 6 7 6 Goal

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

49

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

50

PathPlanning GreedySolution
Searchgoesallthewayupthroughthecorridor. Thelocation(3)isselectedandclosed. Itssuccessor(4)isgeneratedandputonOPEN.

PathPlanning GreedySolution
Searchmovestowest. Thelocation(4)isselectedandclosed. Itssuccesors(5)and(3)aregeneratedandputonOPEN.

8 7 6 Start 7 8 6 7 6 5

6 5

8 7 6 Start 7 8 6 7 6

4 3

6 5

Goal

4 5

Goal

4 5

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

51

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

52

PathPlanning GreedySolution
Searchmovestosouth. Thelocation(3)isselectedandclosed. Itssuccesors(4)and(2)aregeneratedandputonOPEN.

PathPlanning GreedySolution
Searchmovestosouth. Thelocation(2)isselectedandclosed. Itssuccesors(3)and(1)aregeneratedandputonOPEN.

8 7 6 Start 7 8 6 7 6

5 4

4 3 2

6 5

8 7 6 Start 7 8 6 7 6

5 4 3

4 3 2

6 5

Goal

4 5

Goal

4 5

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

53

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

54

BLG435E - PS 1

PathPlanning GreedySolution
Searchmovestoeast. Thelocation(1)isselectedandclosed. Itssuccessor(0)isgeneratedandputonOPEN.

PathPlanning GreedySolution
Searchmovestoeast. Searchendshere,becausethegoallocationisfound.

8 7 6 Start 7 8 6 7 6

5 4 3

4 3 2

6 5

8 7 6 Start 7 8 6 7 6

5 4 3

4 3 2

6 5

Goal 0

4 5

Goal 0

4 5

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

55

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

56

PathPlanning GreedySolution
PathfoundbyGreedysearch Pathlength=25

PathPlanning A*Solution
h(n)=Manhattandistancefromnodentogoal g(n)=Actualcostsofarfromstarttonode n f(n)=h(n)+g(n)

Goal Start

Iftherearenodeswithequalf(n)values,A*willselect thenewest nodeinOPEN.

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

57

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

58

PathPlanning A*Solution
Initialstep:ThestartlocationisintheOPENlist. f(start)=h(start)+g(start) =7+0=7

PathPlanning A*Solution
Startlocation(7+0=7)isselectedandclosed. ItssuccessorsaregeneratedandputonOPEN. fvaluesofthesuccessorlocationsare(6+1=7),(6+1=7),and(8+1=9).

Goal Start 7+0=7

6+1 =7 Start 7+0=7 8+1 =9 6+1 =7

Goal

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

59

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

60

10

BLG435E - PS 1

PathPlanning A*Solution
Searchmovestoeast. Thelowerlocation(6+1=7)isselectedandclosed. Itssuccessor(7+2=9)isgeneratedandputonOPEN.

PathPlanning A*Solution
Searchcomesbackandmovestonorth. Theupperlocation(6+1=7)isselectedandclosed. Itssuccessor(7+2=9)isgeneratedandputonOPEN.

7+2 =9 6+1 =7 Start 7+0=7 8+1 =9 6+1 =7 7+2 =9 Goal 6+1 =7 Start 7+0=7 8+1 =9 6+1 =7 7+2 =9 Goal

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

61

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

62

PathPlanning A*Solution
Searchmovestonorth. Theupperlocation(7+2=9)isselectedandclosed. Itssuccessor(8+3=11)isgeneratedandputonOPEN.

PathPlanning A*Solution
Searchcomesbackandmovestosouth. Thelowerlocation(8+1=9)isselectedandclosed. Ithasnounexploredsuccessors.

8+3 =11 7+2 =9 6+1 =7 Start 7+0=7 8+1 =9 6+1 =7 7+2 =9 Goal

8+3 =11 7+2 =9 6+1 =7 Start 7+0=7 8+1 =9 6+1 =7 7+2 =9 Goal

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

63

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

64

PathPlanning A*Solution
Searchgoestoeastafewtimes. Thelowerlocation(3+8=11)isselectedandclosed. Itssuccessor(4+9=13)isgeneratedandputonOPEN.

PathPlanning A*Solution
Searchcomesbackandgoestonorth. Theupperlocation(8+3=11)isselectedandclosed. Itssuccessor(7+4=11)isgeneratedandputonOPEN.

8+3 =11 7+2 =9 6+1 =7 Start 7+0 8+1 =9 6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13 Goal

8+3 =11 7+2 =9 6+1 =7 Start 7+0 8+1 =9

7+4 =11

Goal 6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

65

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

66

11

BLG435E - PS 1

PathPlanning A*Solution
Searchgoestoeast. Thelocation(7+4=11)isselectedandclosed. Itssuccessor(6+5=11)isgeneratedandputonOPEN.

PathPlanning A*Solution
Searchgoestoeast. Thelocation(6+5=11)isselectedandclosed. Itssuccessors(5+6=11)and(5+6=11)aregeneratedandputonOPEN.

8+3 =11 7+2 =9 6+1 =7 Start 7+0 8+1 =9

7+4 =11

6+5 =11

8+3 =11 7+2 =9 Goal 6+1 =7 Start 7+0

7+4 =11

6+5 =11 5+6 =11

5+6 =11

Goal 6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

8+1 =9

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

67

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

68

PathPlanning A*Solution
Searchgoestoeast. Theupperlocation(5+6=11)isselectedandclosed. Itssuccessors(4+7=11)and(4+7=11)aregeneratedandputonOPEN.

PathPlanning A*Solution
Searchgoestoeast. Theupperlocation(4+7=11)isselectedandclosed. Itssuccessors(3+8=11)and(3+8=11)aregeneratedandputonOPEN.

8+3 =11 7+2 =9 6+1 =7 Start 7+0 8+1 =9

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11

4+7 =11

8+3 =11 7+2 =9 Goal 6+1 =7 Start 7+0

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11

4+7 =11 3+8 =11

3+8 =11

Goal 6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

8+1 =9

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

69

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

70

PathPlanning A*Solution
Searchgoestoeast. Theupperlocation(3+8=11)isselectedandclosed. Itssuccessor(2+9=11)isgeneratedandputonOPEN.

PathPlanning A*Solution
Searchgoestoeast. Thelocation(2+9=11)isselectedandclosed. Itssuccessor(3+10=13)isgeneratedandputonOPEN.

8+3 =11 7+2 =9 6+1 =7 Start 7+0 8+1 =9

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11

4+7 =11 3+8 =11

3+8 =11

2+9 =11

8+3 =11 7+2 =9

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11

4+7 =11 3+8 =11

3+8 =11

2+9 =11

3+10 =13

Goal 6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

6+1 =7 Start 7+0 8+1 =9 6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9

Goal

2+7 =9

3+8 =11

4+9 =13

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

71

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

72

12

BLG435E - PS 1

PathPlanning A*Solution
Searchcomesbackandgoestosouth. Thelowerlocation(3+8=11)isselectedandclosed. Itssuccessor(2+9=11)isgeneratedandputonOPEN.

PathPlanning A*Solution
Searchgoestosouth. Thelowerlocation(2+9=11)isselectedandclosed. Itssuccessors(3+10=13)and(1+10=11)aregeneratedandputonOPEN.

8+3 =11 7+2 =9 6+1 =7 Start 7+0 8+1 =9

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11

4+7 =11 3+8 =11 2+9 =11

3+8 =11

2+9 =11

3+10 =13

8+3 =11 7+2 =9

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11 3+10 =13

4+7 =11 3+8 =11 2+9 =11

3+8 =11

2+9 =11

3+10 =13

Goal

6+1 =7 Start 7+0 6+1 =7 7+2 =9 6+3 =9

1+10 =11

Goal

6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

8+1 =9

5+4 =9

4+5 =9

3+6 =9

2+7 =9

3+8 =11

4+9 =13

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

73

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

74

PathPlanning A*Solution
Searchgoestoeast. Thelowerlocation(1+10=11)isselectedandclosed. Itssuccessor(0+11=11)isgeneratedandputonOPEN.

PathPlanning A*Solution
Searchgoestoeast. Searchendshere,becausethegoallocationisfoundandthereisnotanyother nodewithalowerf(n)value.

8+3 =11 7+2 =9 6+1 =7 Start 7+0 8+1 =9

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11 3+10 =13

4+7 =11 3+8 =11 2+9 =11

3+8 =11

2+9 =11

3+10 =13

8+3 =11 7+2 =9

7+4 =11

6+5 =11 5+6 =11

5+6 =11 4+7 =11 3+10 =13

4+7 =11 3+8 =11 2+9 =11

3+8 =11

2+9 =11

3+10 =13

1+10 =11

Goal 0+11

6+1 =7 Start 7+0 6+1 =7 7+2 =9 6+3 =9

1+10 =11

Goal 0+11

6+1 =7 7+2 =9 6+3 =9 5+4 =9 4+5 =9 3+6 =9 2+7 =9 3+8 =11 4+9 =13

8+1 =9

5+4 =9

4+5 =9

3+6 =9

2+7 =9

3+8 =11

4+9 =13

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

75

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

76

PathPlanning A*Solution
PathfoundbyA*search Pathlength=11(shortestpath)

Excercise:MissionariesandCannibals
Themissionariesandcannibalsproblemisstatedas follows:Threemissionariesandthreecannibalsareon onesideofariver,alongwithaboatthatcanholdoneor twopeople.Findawaytogeteveryonetotheotherside, withouteverleavingagroupofmissionariesinoneplace outnumberedbythecannibalsinthatplace.
Goal

Start

ThisproblemisfamousinAIbecauseitwasthesubject ofthefirstpaperthatapproachedproblemformulation fromananalyticalviewpoint(Amarel,1968).

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

77

ArtificialIntelligence(BLG435E)@ITU::ComputerEngineeringDepartment,Dr.SanemSarelTalay

78

13

You might also like