Can anyone help me solve the problem of how to implement this pseudocode in C or C ++?I thought about it for a long time but didn’t succeed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
ForwardSearching(KB, InitState, GoalState)
Input:KB, state space and action modes;
InitState, start state;
GoalState, objective;
Output:an action sequence or failure;
currState <-- {InitState};
plan <-- { };
Respeat
if currState satisfies GoalState
return plan;
applicable <-- {a | a is a ground operator in KB that Precond(a) is true in currState};
if applicable = Ø
return failure;
a = ChooseAction(applicable);
currState <-- Effect(a);
plan <-- plan ∪ a;
Utill Maximum Iteration.
This is a very general expression of the algorithm. Can you give some details about the specific problem you're trying to solve? What is the state space "KB"? What are the action modes? What are the "ground operators" given on line 12? What are the InitState and GoalState?