Package com.tnsai.models.agent
Interface BeliefRevisionStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy interface for handling conflicting beliefs.
When a new belief is added that conflicts with existing beliefs, this strategy determines how to resolve the conflict.
Built-in Strategies
PRIORITIZE_NEWER- Always accept the newer beliefPRIORITIZE_HIGHER_CONFIDENCE- Keep the belief with higher confidenceKEEP_BOTH- Keep both beliefs (no conflict resolution)REJECT_CONFLICTS- Reject the incoming belief if conflict detected
Usage Example
agent.setBeliefRevisionStrategy(BeliefRevisionStrategy.PRIORITIZE_HIGHER_CONFIDENCE);
agent.addBelief(new Belief("Weather is sunny", 0.9, "weather-api"));
agent.addBelief(new Belief("Weather is rainy", 0.7, "user"));
// Only "Weather is sunny" remains (higher confidence)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BeliefRevisionStrategyDefault strategy: prioritize newer beliefs.static final BeliefRevisionStrategyStrategy that keeps both beliefs (no conflict resolution).static final BeliefRevisionStrategyStrategy that keeps the belief with higher confidence.static final BeliefRevisionStrategyStrategy that always accepts the newer belief, removing conflicting ones.static final BeliefRevisionStrategyStrategy that rejects incoming beliefs if they conflict. -
Method Summary
-
Field Details
-
PRIORITIZE_NEWER
Strategy that always accepts the newer belief, removing conflicting ones. -
PRIORITIZE_HIGHER_CONFIDENCE
Strategy that keeps the belief with higher confidence. -
KEEP_BOTH
Strategy that keeps both beliefs (no conflict resolution). -
REJECT_CONFLICTS
Strategy that rejects incoming beliefs if they conflict. -
DEFAULT
Default strategy: prioritize newer beliefs.
-
-
Method Details
-
revise
Revises the belief set when a new belief is added.- Parameters:
existing- the current list of beliefs (mutable)incoming- the new belief being added- Returns:
- the revised list of beliefs
-