com.agentfactory.cldc.logic
Class BelSeq

java.lang.Object
  extended by com.agentfactory.cldc.logic.BelSeq

public class BelSeq
extends java.lang.Object

Belief sequences (or more aptly belief lists) are used in AFME to identify the conditions under which agents should adopt commitments. In AFME, support is provided for belief labeling. With belief labeling, the developer can encode dependencies a belief list has on other belief lists. The BelSeq class represents a list of beliefs and associated dependencies on other belief lists. It contains functionality for determining if a particular belief sentence evaluates to true. If a belief sentence evaluates to true for one or more binding, a commitment will added to the agent. At a logical level, the use of belief sentences to encode agent behaviour is somewhat similar to the use of resolution-based theorem proving in Prolog.

Author:
Conor Muldoon

Constructor Summary
BelSeq(java.lang.String string, BelSeq[] bArr, boolean[] bool)
          Creates a new instance of BelSeq.
 
Method Summary
 void append(java.lang.StringBuffer buffer)
          Appends the belief sequence to a string buffer.
 void clear()
          Clears the solved state of the belief sentence and wipes all solutions.
 BelSeq createAppliedSeq(SubstitutionSet ss)
          Recursively applies the substitution set to the attributes of this BelSeq to create an applied belief sequence.
static void createCommit(Agent agent, FOS fos)
           
 void createCommit(FOS right, Agent agent)
          Creates commitment objects and adds them to the specified agents by applying solutions of the belief sentence to the commitment first order structure.
 void recurSolve(Agent agent)
          Recursively solves the belief sequence.
 void seqClear()
          Clears each of the BelSeqs that this BelSeq has a dependency on provided the BelSeq has been tested or solved.
 boolean solveSeq(Agent agent)
          Recursively solves the BelSeqs that this BelSeq has a dependency on.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BelSeq

public BelSeq(java.lang.String string,
              BelSeq[] bArr,
              boolean[] bool)
       throws MalformedLogicException
Creates a new instance of BelSeq.

Parameters:
string - a string representation of the belief list.
bArr - the BelSeqs that this BelSeq has dependencies on.
bool - this array is used to determine whether the elements of bArr are negated dependencies. The arrays are associated through their index number.
Throws:
MalformedLogicException - if there is a logic error.
Method Detail

createCommit

public void createCommit(FOS right,
                         Agent agent)
Creates commitment objects and adds them to the specified agents by applying solutions of the belief sentence to the commitment first order structure.

Parameters:
right - the commitment first order structure.
agent - the agent adopts the commitments.

createCommit

public static void createCommit(Agent agent,
                                FOS fos)

clear

public void clear()
Clears the solved state of the belief sentence and wipes all solutions.


seqClear

public void seqClear()
Clears each of the BelSeqs that this BelSeq has a dependency on provided the BelSeq has been tested or solved.


solveSeq

public boolean solveSeq(Agent agent)
Recursively solves the BelSeqs that this BelSeq has a dependency on. If the dependencies do no hold, returns false. If the dependencies do hold, solves this BelSeq. If one or more solution is found, returns true.

Parameters:
agent - the agent the BelSeq belongs to.
Returns:
true if there is at least one solution, false otherwise.

recurSolve

public void recurSolve(Agent agent)
                throws MalformedLogicException
Recursively solves the belief sequence. If the belief sequence is evaluated to true for one or more bindings, a solution is added to the list of solutions.

Parameters:
agent - the agent this belief sequence belongs to.
Throws:
MalformedLogicException - if there is a logic error.

createAppliedSeq

public BelSeq createAppliedSeq(SubstitutionSet ss)
Recursively applies the substitution set to the attributes of this BelSeq to create an applied belief sequence. When a substituion set is applied to something, it replaces variables with associated instances.

Parameters:
ss - the substitution set applied to the beliefs and belief list dependendencies of this BelSeq.
Returns:
the applied BelSeq.

append

public void append(java.lang.StringBuffer buffer)
Appends the belief sequence to a string buffer.

Parameters:
buffer - the string buffer that the belief sequence is to be appended to.