Search in sources :

Example 1 with PerceptStateReward

use of aima.core.learning.reinforcement.PerceptStateReward in project aima-java by aimacode.

the class ReinforcementAgent method execute.

@SuppressWarnings("unchecked")
@Override
public Action execute(Percept p) {
    if (p instanceof PerceptStateReward<?>) {
        Action a = execute((PerceptStateReward<S>) p);
        if (null == a) {
            a = NoOpAction.NO_OP;
            setAlive(false);
        }
        return a;
    }
    throw new IllegalArgumentException("Percept passed in must be a PerceptStateReward");
}
Also used : NoOpAction(aima.core.agent.impl.NoOpAction) Action(aima.core.agent.Action) PerceptStateReward(aima.core.learning.reinforcement.PerceptStateReward)

Aggregations

Action (aima.core.agent.Action)1 NoOpAction (aima.core.agent.impl.NoOpAction)1 PerceptStateReward (aima.core.learning.reinforcement.PerceptStateReward)1