public abstract class SimpleProblemSolvingAgent extends AbstractAgent
function SIMPLE-PROBLEM-SOLVING-AGENT(percept) returns an action persistent: seq, an action sequence, initially empty state, some description of the current world state goal, a goal, initially null problem, a problem formulation state <- UPDATE-STATE(state, percept) if seq is empty then goal <- FORMULATE-GOAL(state) problem <- FORMULATE-PROBLEM(state, goal) seq <- SEARCH(problem) if seq = failure then return a null action action <- FIRST(seq) seq <- REST(seq) return actionFigure 3.1 A simple problem-solving agent. It first formulates a goal and a problem, searches for a sequence of actions that would solve the problem, and then executes the actions one at a time. When this is complete, it formulates another goal and starts over.
program
Constructor and Description |
---|
SimpleProblemSolvingAgent()
Constructs a simple problem solving agent which will formulate goals
indefinitely.
|
SimpleProblemSolvingAgent(int maxGoalsToFormulate)
Constructs a simple problem solving agent which will formulate, at
maximum, the specified number of goals.
|
Modifier and Type | Method and Description |
---|---|
Action |
execute(Percept p)
Call the Agent's program, which maps any given percept sequences to an
action.
|
protected abstract java.lang.Object |
formulateGoal() |
protected abstract Problem |
formulateProblem(java.lang.Object goal) |
protected abstract void |
notifyViewOfMetrics() |
protected abstract java.util.List<Action> |
search(Problem problem) |
protected abstract State |
updateState(Percept p) |
isAlive, setAlive
public SimpleProblemSolvingAgent()
public SimpleProblemSolvingAgent(int maxGoalsToFormulate)
maxGoalsToFormulate
- the maximum number of goals this agent is to formulate.public Action execute(Percept p)
Agent
execute
in interface Agent
execute
in class AbstractAgent
p
- The current percept of a sequence perceived by the Agent.protected abstract java.lang.Object formulateGoal()
protected abstract Problem formulateProblem(java.lang.Object goal)
protected abstract void notifyViewOfMetrics()