debugger
شنبه 14 آبان 1390, 11:12 صبح
شبه کد های زیر الگوریتم جستجوی عمومی یک درخت را نشان میدهد
function TREE-SEARCH (problem, fringe) returns a solution, or failure
fringe <- INSERT(MAKE-NODE(INITIAL-STATE [problem]), fringe)
loop do
if fringe is empty then return failure
node <- REMOVE-FRONT (fringe)
if GOAL-TEST [problem] applied to STATE (node) succeeds then
return node
fringe <- INSERTALL (EXPAND (node, problem), fringe)
function EXPAND (node, problem) returns a set of nodes
successors <- the empty set
for each action, result in SUCCESSOR-FN[problem](STATE[node]) do
s <- a new NODE
PARENT-NODE [s] <- node
ACTION [s] <- action STATE [s] <- result
PATH-COST [s] <- PATH-COST[node] + STEP-COST (node, action, s)
DEPTH [s] <- DEPTH [node] + 1
add s to successors
return successors
سوال اینه که این الگوریتم بالا هیچ یک از DFS ،DLS ,UCS , BFS نیست . یا اگر هست کدوم یکی هست ؟
این الگوریتم را چطور می توان با ++C یا #C پیاده کرد (چون با استفاده از نود و اشاره گر و ماتریس و ... هست بنده کار نکردم در این زمینه)؟؟
با تشکر از همه دوستان و اساتید
function TREE-SEARCH (problem, fringe) returns a solution, or failure
fringe <- INSERT(MAKE-NODE(INITIAL-STATE [problem]), fringe)
loop do
if fringe is empty then return failure
node <- REMOVE-FRONT (fringe)
if GOAL-TEST [problem] applied to STATE (node) succeeds then
return node
fringe <- INSERTALL (EXPAND (node, problem), fringe)
function EXPAND (node, problem) returns a set of nodes
successors <- the empty set
for each action, result in SUCCESSOR-FN[problem](STATE[node]) do
s <- a new NODE
PARENT-NODE [s] <- node
ACTION [s] <- action STATE [s] <- result
PATH-COST [s] <- PATH-COST[node] + STEP-COST (node, action, s)
DEPTH [s] <- DEPTH [node] + 1
add s to successors
return successors
سوال اینه که این الگوریتم بالا هیچ یک از DFS ،DLS ,UCS , BFS نیست . یا اگر هست کدوم یکی هست ؟
این الگوریتم را چطور می توان با ++C یا #C پیاده کرد (چون با استفاده از نود و اشاره گر و ماتریس و ... هست بنده کار نکردم در این زمینه)؟؟
با تشکر از همه دوستان و اساتید