السلام عليكم جميعا
ارجو المساعدة في حل مشكلتي وهي عندي بعض الخوارزميات مكتوبة اريد تحويلها إلى ++C إذا امكن ذلك وللمعلومية هذا يفيدني في الدرجات في الكلية أفيدوني جزاكم الله خيراً
))FIRST PROGRAM((
Algorithm for Problem-Solving Agents:-
function SIMPLE-PROBLEM-SOLVING-AGENT (percept)
return an action
static : seq , an action sequence , initially empty
state , same description of the current world state
goal , agoal , initially null
problem , aproblem formulation
state ← UPDATE-STATE (state , percept(
if seq is empty then do
goal ← FORMULATE-GOAL (state)
problem ← FORMULATE-PROBLEM (state , goal(
seq ← SEARCH (problem(
action ← FIRST (seq)
seq ← REST (seq)
return action
_____________________________________________
))SECOND PROGRAM((
General Tree-Search Algorithm:-
function TREE-SEARCH (problem , strategy) return asolution , 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 aleaf node for expansion according to strategy
if the node contains agoal state then return the corresponding solution
else expand the node and add the resulting nodes to the search tree
________________________________________________
))THIRD PROGRAM))
Recursive Implementation:-
function DEPTH-LIMITED-SEARCH (problem , limit) returns soln / fail / cutoff
RECURSIVE-DLS (MAKE-NODE (INITIAL-STATE [problem]) , problem , limit)
function RECURSIVE-DLS (node , problem , limit) returns soln / fail / cutoff
cutoff _ occurred ? ← false
if GOAL-TEST [problem] (STATE [node]) then return SOLUTION (node)
else if DEPTH [node] = limit then return cutoff
else for each successor in EXPAND (node , problem) do
result ← RECURSIVE-DLS (successor , problem , limit)
if result = cutoff then cutoff-occurred ? ← true
else if result ≠ failure then return result
if cutoff-occurred ? then return cutoff else return failure
_________________________________________________
))FOURTH PROGRAM((
Iterative Deepening Search:-
function ITERATIVE-DEEPENING-SEARCH (problem) returns asolution , or failure
input : problem , aproblem
for depth ← 0 to ∞ do
result ← DEPTH-LIMITED-SEARCH (problem , depth)
if result ≠ cutoff then return result
))FIFTH PROGRAM((
Graph Search:-
function GRAPH-SEARCH (problem , fringe) returns asolution , or failure
closed ← an empty set
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] (STATE [node]) then return SOLUTION (node)
if STATE [node] is not closed then
add STATE [node] to closed
fringe ← INSERT ALL (EXPAND (node , problem) , fringe)
هذه هي الأجزاء إذا امكن التحويل لا يقل عن ثلاث أجزاء من الخمسة وهناك مرفق مكتوبة على الورد قد تكون أوضح
:^) ياشباب تسليمة يوم الأحد القادم لا تأخرون علي بالفزعة شاكراً لكم مقدماً