bdi4jade.core

## Class Capability

- java.lang.Object
- - bdi4jade.core.Capability

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    UtilityBasedBDIAgent

      public class Capability
      extends java.lang.Object
      implements java.io.Serializable

  This capability represents a component that aggregates the mental attitudes defined by the BDI architecture. It has a belief base with the associated beliefs (knowledge) and a plan library.
  Author:
    ingrid
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected BeliefBase` | `beliefBase`
    `protected java.lang.String` | `id`
    `protected org.apache.commons.logging.Log` | `log`
    `protected BDIAgent` | `myAgent`
    `protected java.util.Set<Capability>` | `partCapabilities`
    `protected PlanLibrary` | `planLibrary`
    `protected Capability` | `wholeCapability`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Capability()` Creates a new capability.
    `Capability(java.util.Set<Belief<?>> initialBeliefs, java.util.Set<Plan> initialPlans)` Creates a new capability.
    `Capability(java.lang.String id)` Creates a new capability.
    `Capability(java.lang.String id, Capability wholeCapability)` Creates a new capability.
    `Capability(java.lang.String id, Capability wholeCapability, java.util.Set<Belief<?>> initialBeliefs, java.util.Set<Plan> initialPlans)` Creates a new capability.
    `Capability(java.lang.String id, java.util.Set<Belief<?>> initialBeliefs, java.util.Set<Plan> initialPlans)` Creates a new capability.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPartCapability(Capability partCapability)`
    `boolean` | `canProcess(jade.lang.acl.ACLMessage msg)` Checks if this capability has a plan that can process the given message.
    `protected java.util.Set<GoalUpdateSet.GoalDescription>` | `filter(java.util.Set<GoalUpdateSet.GoalDescription> goals)` This method is responsible for selecting a set of goals that must be tried to be achieved (intentions) from the set of goals.
    `protected void` | `generateGoals(GoalUpdateSet goalUpdateSet)` This method is responsible for generating new goals or dropping existing ones.
    `BeliefBase` | `getBeliefBase()`
    `BeliefRevisionStrategy` | `getBeliefRevisionStrategy()`
    `DeliberationFunction` | `getDeliberationFunction()`
    `java.lang.String` | `getId()`
    `BDIAgent` | `getMyAgent()`
    `OptionGenerationFunction` | `getOptionGenerationFunction()`
    `java.util.Set<Capability>` | `getPartCapabilities()`
    `PlanLibrary` | `getPlanLibrary()`
    `PlanSelectionStrategy` | `getPlanSelectionStrategy()`
    `Capability` | `getWholeCapability()`
    `boolean` | `hasParts()`
    `boolean` | `removePartCapability(Capability partCapability)`
    `protected void` | `reviewBeliefs()` This method is responsible for reviewing beliefs from this agent.
    `protected Plan` | `selectPlan(Goal goal, java.util.Set<Plan> candidatePlans)` This method is responsible for selecting plans to achieve a goals of this agent.
    `void` | `setBeliefRevisionStrategy(BeliefRevisionStrategy beliefRevisionStrategy)`
    `void` | `setDeliberationFunction(DeliberationFunction deliberationFunction)`
    `void` | `setMyAgent(BDIAgent myAgent)`
    `void` | `setOptionGenerationFunction(OptionGenerationFunction optionGenerationFunction)`
    `void` | `setPlanSelectionStrategy(PlanSelectionStrategy planSelectionStrategy)`
    `protected void` | `setup()` This is an empty holder for being overridden by subclasses.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### beliefBase

          protected final BeliefBase beliefBase

    - #### id

          protected final java.lang.String id

    - #### log

          protected final org.apache.commons.logging.Log log

    - #### myAgent

          protected BDIAgent myAgent

    - #### partCapabilities

          protected final java.util.Set<Capability> partCapabilities

    - #### planLibrary

          protected final PlanLibrary planLibrary

    - #### wholeCapability

          protected Capability wholeCapability

  - ### Constructor Detail

    - #### Capability

          public Capability()

      Creates a new capability. It uses `BeliefBase` and `PlanLibrary` as belief base and plan library respectively.

    - #### Capability

          public Capability(java.util.Set<Belief<?>> initialBeliefs,
                    java.util.Set<Plan> initialPlans)

      Creates a new capability.
      Parameters:
        `initialBeliefs` - the initial set of beliefs to be added to the belief base of this capability.
        `initialPlans` - the initial set of plans to be added to the plan library of this capability.

    - #### Capability

          public Capability(java.lang.String id)

      Creates a new capability. It uses `BeliefBase` and `PlanLibrary` as belief base and plan library respectively.
      Parameters:
        `id` - the capability id. If it is null, the class name is going to be used.

    - #### Capability

          public Capability(java.lang.String id,
                    Capability wholeCapability)

      Creates a new capability. It uses `BeliefBase` and `PlanLibrary` as belief base and plan library respectively.
      Parameters:
        `id` - the capability id. If it is null, the class name is going to be used.
        `wholeCapability` - the whole-capability that this capability is part of.

    - #### Capability

          public Capability(java.lang.String id,
                    Capability wholeCapability,
                    java.util.Set<Belief<?>> initialBeliefs,
                    java.util.Set<Plan> initialPlans)

      Creates a new capability.
      Parameters:
        `id` - the capability id. If it is null, the class name is going to be used.
        `wholeCapability` - the whole-capability that this capability is part of.
        `initialBeliefs` - the initial set of beliefs to be added to the belief base of this capability.
        `initialPlans` - the initial set of plans to be added to the plan library of this capability.

    - #### Capability

          public Capability(java.lang.String id,
                    java.util.Set<Belief<?>> initialBeliefs,
                    java.util.Set<Plan> initialPlans)

      Creates a new capability.
      Parameters:
        `id` - the capability id. If it is null, the class name is going to be used.
        `initialBeliefs` - the initial set of beliefs to be added to the belief base of this capability.
        `initialPlans` - the initial set of plans to be added to the plan library of this capability.

  - ### Method Detail

    - #### addPartCapability

          public void addPartCapability(Capability partCapability)

    - #### canProcess

          public boolean canProcess(jade.lang.acl.ACLMessage msg)

      Checks if this capability has a plan that can process the given message.
      Parameters:
        `msg` - the message to be checked.
      Returns:
        true if this capability has at least a plan that can process the message.

    - #### filter

          protected java.util.Set<GoalUpdateSet.GoalDescription> filter(java.util.Set<GoalUpdateSet.GoalDescription> goals)

      This method is responsible for selecting a set of goals that must be tried to be achieved (intentions) from the set of goals. Its default implementation requests each of its capabilities to filter their goals. Subclasses may override this method to customize this deliberation function.

    - #### generateGoals

          protected void generateGoals(GoalUpdateSet goalUpdateSet)

      This method is responsible for generating new goals or dropping existing ones. Its default implementation requests each of its capabilities to generate or drop goals. Subclasses may override this method to customize this options generation function.

    - #### getBeliefBase

          public BeliefBase getBeliefBase()

      Returns:
        the beliefBase

    - #### getBeliefRevisionStrategy

          public BeliefRevisionStrategy getBeliefRevisionStrategy()

      Returns:
        the beliefRevisionStrategy

    - #### getDeliberationFunction

          public DeliberationFunction getDeliberationFunction()

      Returns:
        the deliberationFunction

    - #### getId

          public java.lang.String getId()

      Returns:
        the id

    - #### getMyAgent

          public BDIAgent getMyAgent()

      Returns:
        the agent that this capability is associated with.

    - #### getOptionGenerationFunction

          public OptionGenerationFunction getOptionGenerationFunction()

      Returns:
        the optionGenerationFunction

    - #### getPartCapabilities

          public java.util.Set<Capability> getPartCapabilities()

      Returns:
        the partCapabilities

    - #### getPlanLibrary

          public PlanLibrary getPlanLibrary()

      Returns:
        the planLibrary

    - #### getPlanSelectionStrategy

          public PlanSelectionStrategy getPlanSelectionStrategy()

      Returns:
        the planSelectionStrategy

    - #### getWholeCapability

          public Capability getWholeCapability()

      Returns:
        the wholeCapability

    - #### hasParts

          public boolean hasParts()

    - #### removePartCapability

          public boolean removePartCapability(Capability partCapability)

    - #### reviewBeliefs

          protected void reviewBeliefs()

      This method is responsible for reviewing beliefs from this agent. Its default implementation requests each of its capabilities to review their individual set of beliefs. Subclasses may override this method to customize belief revision.

    - #### selectPlan

          protected Plan selectPlan(Goal goal,
                        java.util.Set<Plan> candidatePlans)

      This method is responsible for selecting plans to achieve a goals of this agent. Its default implementation requests each of its capabilities to select one of its plans. Subclasses may override this method to customize plan selection.
      Parameters:
        `goal` - the goal to be achieved.
        `capabilityPlans` - the set of candidate plans of each capability.

    - #### setBeliefRevisionStrategy

          public void setBeliefRevisionStrategy(BeliefRevisionStrategy beliefRevisionStrategy)

      Parameters:
        `beliefRevisionStrategy` - the beliefRevisionStrategy to set

    - #### setDeliberationFunction

          public void setDeliberationFunction(DeliberationFunction deliberationFunction)

      Parameters:
        `deliberationFunction` - the deliberationFunction to set

    - #### setMyAgent

          public void setMyAgent(BDIAgent myAgent)

      Parameters:
        `myAgent` - the myAgent to set

    - #### setOptionGenerationFunction

          public void setOptionGenerationFunction(OptionGenerationFunction optionGenerationFunction)

      Parameters:
        `optionGenerationFunction` - the optionGenerationFunction to set

    - #### setPlanSelectionStrategy

          public void setPlanSelectionStrategy(PlanSelectionStrategy planSelectionStrategy)

      Parameters:
        `planSelectionStrategy` - the planSelectionStrategy to set

    - #### setup

          protected void setup()

      This is an empty holder for being overridden by subclasses. Initializes the capability. This method is invoked by the constructor. It may be used to add initial plans and beliefs. The reasoning strategies of this capability are initialized in the constructor with default strategies. This method may also customize them.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`
      See Also:
        `Object.toString()`