public abstract class ModelBasedReflexAgentProgram extends java.lang.Object implements AgentProgram
function MODEL-BASED-REFLEX-AGENT(percept) returns an action
persistent: state, the agent's current conception of the world state
model, a description of how the next state depends on current state and action
rules, a set of condition-action rules
action, the most recent action, initially none
state <- UPDATE-STATE(state, action, percept, model)
rule <- RULE-MATCH(state, rules)
action <- rule.ACTION
return action
Figure 2.12 A model-based reflex agent. It keeps track of the current state
of the world using an internal model. It then chooses an action in the same
way as the reflex agent.| Constructor and Description |
|---|
ModelBasedReflexAgentProgram() |
| Modifier and Type | Method and Description |
|---|---|
Action |
execute(Percept percept)
The Agent's program, which maps any given percept sequences to an action.
|
protected abstract void |
init()
Realizations of this class should implement the init() method so that it
calls the setState(), setModel(), and setRules() method.
|
protected Action |
ruleAction(Rule r) |
protected Rule |
ruleMatch(DynamicState state,
java.util.Set<Rule> rules) |
void |
setModel(Model model)
Set the program's description of how the next state depends on the state
and action.
|
void |
setRules(java.util.Set<Rule> ruleSet)
Set the program's condition-action rules
|
void |
setState(DynamicState state)
Set the agent's current conception of the world state.
|
protected abstract DynamicState |
updateState(DynamicState state,
Action action,
Percept percept,
Model model) |
public void setState(DynamicState state)
state - the agent's current conception of the world state.public void setModel(Model model)
model - a description of how the next state depends on the current
state and action.public void setRules(java.util.Set<Rule> ruleSet)
ruleSet - a set of condition-action rulespublic Action execute(Percept percept)
AgentProgramexecute in interface AgentProgrampercept - The current percept of a sequence perceived by the Agent.protected abstract void init()
protected abstract DynamicState updateState(DynamicState state, Action action, Percept percept, Model model)
protected Rule ruleMatch(DynamicState state, java.util.Set<Rule> rules)