Theory of Mind + Abduction
A Jason agent combining Theory of Mind with abductive reasoning
tomabd.agent.TomAbdAgent Class Reference

Public Member Functions

final Literal[] tomAbductionTask (List< Term > obsAgentLevel, Atom actor, Atom action) throws JasonException
 
int buf (Collection< Literal > percepts)
 
void euf ()
 
Object[] selectAction () throws JasonException
 

Private Member Functions

final void backUpBeliefs () throws JasonException
 
final void recoverBeliefs () throws JasonException
 
final void adoptViewpoint (List< Term > viewpoint) throws JasonException
 
ListTermImpl removeUninformativeFacts (ListTermImpl e)
 
boolean checkImpossibleExplanation (ListTermImpl e)
 
ListTermImpl erf (ListTermImpl expls)
 
Rule buildAbductiveIC (ListTermImpl explanations)
 
Literal buildTomRule (List< Term > viewpoint, Rule abductiveIC)
 
ListTermImpl removeRedundantExplanations (ListTermImpl rawExpls)
 
List< Literal > getBeliefsWithSource (Term source)
 
Object[] getAbdToMRuleComponents (Literal l)
 
Collection< Rule > getSortedActionRules ()
 
List< Term > getAbducibles (LogExpr logicalFormula)
 
Object[] queryAction ()
 
boolean checkActionsInPossibleWorlds (double priority, Atom action, List< Object[]> actionsInPossWorlds)
 
LogicalFormula list2formula (List< Term > args, LogExpr.LogicalOp operator, boolean negateArgs)
 

Private Attributes

DefaultBeliefBase backUp = new DefaultBeliefBase()
 

Detailed Description

Represent a Jason agent capable of Theory of Mind, i.e. switching its perspective to the estimated perspective of other agents (possibly in a recursive fashion).

Member Function Documentation

◆ adoptViewpoint()

final void tomabd.agent.TomAbdAgent.adoptViewpoint ( List< Term >  viewpoint) throws JasonException
inlineprivate

Adopt a different viewpoint for the agent.

Parameters
viewpoint
Exceptions
JasonException

◆ backUpBeliefs()

final void tomabd.agent.TomAbdAgent.backUpBeliefs ( ) throws JasonException
inlineprivate

Make a copy of the current belief base in the back-up.

Exceptions
JasonExceptionif the back-up belief base is not empty.

◆ buf()

int tomabd.agent.TomAbdAgent.buf ( Collection< Literal >  percepts)
inline

The Jason default belief update function is overridden to include a call to the explanation update function.

Parameters
percepts
Returns
int
See also
tomabd.agent.TomAbdAgent.euf

◆ buildAbductiveIC()

Rule tomabd.agent.TomAbdAgent.buildAbductiveIC ( ListTermImpl  explanations)
inlineprivate

Build an abductive impossibility constraint clause from a set of explanations.

Parameters
explanations
Returns
Rule

◆ buildTomRule()

Literal tomabd.agent.TomAbdAgent.buildTomRule ( List< Term >  viewpoint,
Rule  abductiveIC 
)
inlineprivate

Given a viewpoint and an abductive \(\texttt{imp}\) clause, build the corresponding recursive believes/2 literal.

Parameters
viewpoint
abductiveIC
Returns
Literal

◆ checkActionsInPossibleWorlds()

boolean tomabd.agent.TomAbdAgent.checkActionsInPossibleWorlds ( double  priority,
Atom  action,
List< Object[]>  actionsInPossWorlds 
)
inlineprivate

For a set of possible worlds, check that the selected action in each of them matches the input.

Parameters
priority
action
actionsInPossWorlds
Returns
boolean

◆ checkImpossibleExplanation()

boolean tomabd.agent.TomAbdAgent.checkImpossibleExplanation ( ListTermImpl  e)
inlineprivate

Check whether an explanation \(\Phi\) is incompatible with the current belief base.

Parameters
e
Returns
boolean

◆ erf()

ListTermImpl tomabd.agent.TomAbdAgent.erf ( ListTermImpl  expls)
inlineprivate

Explanation revision function. In this default implementation, it returns an explanation where:

  1. Uninformative facts are removed
  2. Impossible explanations are removed
Parameters
expls
Returns
ListTermImpl
See also
tomabd.agent.TomAbdAgent.removeUninformativeFacts, tomabd.agent.TomAbdAgent.checkImpossibleExplanation

◆ euf()

void tomabd.agent.TomAbdAgent.euf ( )
inline

Explanation update function. Remove abductive explanations that are no longer informative in the viewpoint where they held.

◆ getAbdToMRuleComponents()

Object [] tomabd.agent.TomAbdAgent.getAbdToMRuleComponents ( Literal  l)
inlineprivate

Get the viewpoint and the set of explanations of an abductive IC or believes/2 literal.

Parameters
l
Returns
Object[]
See also
tomabd.agent.TomAbdAgent.tomAbductionTask

◆ getAbducibles()

List<Term> tomabd.agent.TomAbdAgent.getAbducibles ( LogExpr  logicalFormula)
inlineprivate

Get the set of abducibles in a logical conjunction.

Parameters
logicalFormula
Returns
List<Term>

◆ getBeliefsWithSource()

List<Literal> tomabd.agent.TomAbdAgent.getBeliefsWithSource ( Term  source)
inlineprivate

Get the beliefs with the given source annotation.

Parameters
source
Returns
List<Literal>

◆ getSortedActionRules()

Collection<Rule> tomabd.agent.TomAbdAgent.getSortedActionRules ( )
inlineprivate

Get the set of action selection rules sorted by their priority annotation in descending order.

Returns
Collection<Rule>

◆ list2formula()

LogicalFormula tomabd.agent.TomAbdAgent.list2formula ( List< Term >  args,
LogExpr.LogicalOp  operator,
boolean  negateArgs 
)
inlineprivate

Convert a set of explanation from list of lists form to disjunctive normal form (a logical formula).

Parameters
args
operator
negateArgs
Returns
LogicalFormula

◆ queryAction()

Object [] tomabd.agent.TomAbdAgent.queryAction ( )
inlineprivate

Query the action selection rules in ascending order of priority.

Returns
Object[]

◆ recoverBeliefs()

final void tomabd.agent.TomAbdAgent.recoverBeliefs ( ) throws JasonException
inlineprivate

Copy the beliefs in the back-up back into the main belief base.

Exceptions
JasonExceptionif the back-up belief base is empty or the main belief base is not clear.

◆ removeRedundantExplanations()

ListTermImpl tomabd.agent.TomAbdAgent.removeRedundantExplanations ( ListTermImpl  rawExpls)
inlineprivate

Remove duplicates from a set of explanations.

Parameters
rawExpls
Returns
ListTermImpl

◆ removeUninformativeFacts()

ListTermImpl tomabd.agent.TomAbdAgent.removeUninformativeFacts ( ListTermImpl  e)
inlineprivate

Get the subset of facts that are not entailed by the current belief base.

Parameters
e
Returns
ListTermImpl

◆ selectAction()

Object [] tomabd.agent.TomAbdAgent.selectAction ( ) throws JasonException
inline

Interpret the default action selection function, considering abductive impossibility constraints and literals.

Returns
Object[]
Exceptions
JasonException

◆ tomAbductionTask()

final Literal [] tomabd.agent.TomAbdAgent.tomAbductionTask ( List< Term >  obsAgentLevel,
Atom  actor,
Atom  action 
) throws JasonException
inline

Perform a complete Theory of Mind + abductive reasoning task.

Parameters
obsAgentLevel
actor
action
Returns
Literal[]
Exceptions
JasonException
See also
tomabd.agent.tom_abduction_task

Member Data Documentation

◆ backUp

DefaultBeliefBase tomabd.agent.TomAbdAgent.backUp = new DefaultBeliefBase()
private

Store a copy of the current belief base while adopting a different viewpoint.