Class ActivePursuitGoal

java.lang.Object
FAtiMA.Core.goals.Goal
FAtiMA.Core.goals.ActivePursuitGoal
All Implemented Interfaces:
IPlanningOperator, IGroundable, Serializable, Cloneable

public class ActivePursuitGoal extends Goal implements IPlanningOperator
Implements OCC's ActivePursuit goals that have activation conditions
Author:
Joao Dias
See Also:
  • Field Details

    • alfa

      public static final float alfa
      See Also:
    • _active

      protected boolean _active
    • _failureConditions

      protected ArrayList<Condition> _failureConditions
    • _preConditions

      protected ArrayList<Condition> _preConditions
    • _successConditions

      protected ArrayList<Condition> _successConditions
    • _numberOfTries

      protected int _numberOfTries
    • _probability

      protected Float _probability
    • _probabilityDetermined

      protected boolean _probabilityDetermined
    • _familiarity

      protected Float _familiarity
    • _urgency

      protected Float _urgency
    • _id

      protected Integer _id
    • _agent

      protected Symbol _agent
    • _effects

      protected ArrayList<Effect> _effects
  • Constructor Details

    • ActivePursuitGoal

      public ActivePursuitGoal(Name description)
      Creates a new ActivePursuitGoal
      Parameters:
      description - - the goal's name or description
    • ActivePursuitGoal

      protected ActivePursuitGoal()
  • Method Details

    • AddCondition

      public void AddCondition(String conditionType, Condition cond)
      Adds a condition to the goal
      Specified by:
      AddCondition in class Goal
      Parameters:
      conditionType - - the type of the condition: PreConditions SuccessConditions FailureConditions
      cond - - the condition to add
    • CheckFailure

      public boolean CheckFailure(AgentModel am)
      Checks an ActivePursuitGoal's failure conditions if at least one of them is verified the goal fails
      Returns:
      true if the goal failed, false otherwise
    • CheckIntegrity

      public void CheckIntegrity(IntegrityValidator val) throws UnreachableGoalException
      Checks the integrity of the goal. For instance it checks if the goal's success conditions are reachable by at least one action in the domain operators. If not it means that the goal will never be achieve and probably is a typo in the goal's definition (or in the actions file)
      Specified by:
      CheckIntegrity in class Goal
      Parameters:
      val - - the validator used to check the goal
      Throws:
      UnreachableGoalException - - thrown if a goal's success conditions can never be achieved because there is no operator with such effects
    • CheckSuccess

      public boolean CheckSuccess(AgentModel am)
      Checks an ActivePursuitGoal's success conditions if all of them are verified the goal succeeds
      Returns:
      true if the goal succeeded, false otherwise
    • mayContainSelf

      public boolean mayContainSelf()
    • GetNumberOfTries

      public int GetNumberOfTries()
    • GetGoalUrgency

      public float GetGoalUrgency()
      Returns:
      the goal's urgency ranging from 0 (not urgent) to 1 (very urgent)
    • GetProbability

      public Float GetProbability(AgentModel am)
    • SetProbability

      public void SetProbability(Float p)
    • getUncertainty

      public float getUncertainty(AgentModel am)
    • setUncertainty

      public void setUncertainty(AgentModel am, float uncertainty)
    • IncrementNumberOfTries

      public void IncrementNumberOfTries()
    • GetFailureConditions

      public ArrayList<Condition> GetFailureConditions()
      Gets the goal's failure conditions
      Returns:
      a list with the goal's failure conditions
    • GetSuccessConditions

      public ArrayList<Condition> GetSuccessConditions()
      Gets the goal's success conditions
      Returns:
      a list with the goal's success conditions
    • GetPreconditions

      public ArrayList<Condition> GetPreconditions()
      Gets the goal's preconditions
      Returns:
      a list with the goal's preconditions
    • ReplaceUnboundVariables

      public void ReplaceUnboundVariables(int variableID)
      Replaces all unbound variables in the object by applying a numeric identifier to each one. For example, the variable [x] becomes [x4] if the received ID is 4. Attention, this method modifies the original object.
      Specified by:
      ReplaceUnboundVariables in interface IGroundable
      Specified by:
      ReplaceUnboundVariables in class Goal
      Parameters:
      variableID - - the identifier to be applied
    • MakeGround

      public void MakeGround(ArrayList<Substitution> bindings)
      Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.
      Specified by:
      MakeGround in interface IGroundable
      Specified by:
      MakeGround in class Goal
      Parameters:
      bindings - - A list of substitutions of the type "[Variable]/value"
      See Also:
    • getNameWithCharactersOrdered

      public String getNameWithCharactersOrdered()
    • MakeGround

      public void MakeGround(Substitution subst)
      Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.
      Specified by:
      MakeGround in interface IGroundable
      Specified by:
      MakeGround in class Goal
      Parameters:
      subst - - a substitution of the type "[Variable]/value"
      See Also:
    • clone

      public Object clone()
      Clones this ActivePursuitGoal, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
      Specified by:
      clone in interface IPlanningOperator
      Overrides:
      clone in class Object
      Returns:
      The Goal's copy.
    • getPlans

      public ArrayList<Plan> getPlans(AgentModel am)
    • toString

      public String toString()
      Converts the ActivePursuitGoal to a String
      Overrides:
      toString in class Goal
      Returns:
      the converted String
    • addEffect

      public void addEffect(Effect e)
    • checkPreconditions

      public boolean checkPreconditions(AgentModel am)
      Description copied from interface: IPlanningOperator
      Checks if the operators's preconditions are verified in the current State
      Specified by:
      checkPreconditions in interface IPlanningOperator
      Returns:
      true if all preconditions are true according to the current State, false otherwise
    • getProbability

      public float getProbability(AgentModel am)
      Description copied from interface: IPlanningOperator
      Gets the operator's probability of execution
      Specified by:
      getProbability in interface IPlanningOperator
      Returns:
      the operators's probability
    • equals

      public boolean equals(IPlanningOperator op)
      Description copied from interface: IPlanningOperator
      Compares this planOperator with another planOperator to see if they are equal
      Specified by:
      equals in interface IPlanningOperator
      Returns:
      true if the operators have the same ID in a plan
    • getAgent

      public Symbol getAgent()
      Description copied from interface: IPlanningOperator
      Gets the name of the agent that executes the operator
      Specified by:
      getAgent in interface IPlanningOperator
      Returns:
      the name of the agent that executes the operator
    • getEffect

      public Effect getEffect(Integer effectID)
      Description copied from interface: IPlanningOperator
      Gets the operators's effect with the given ID
      Specified by:
      getEffect in interface IPlanningOperator
      Parameters:
      effectID - - the id of the operators's effect
      Returns:
      the effect
    • getEffects

      public ArrayList<Effect> getEffects()
      Description copied from interface: IPlanningOperator
      Gets the operator's effects
      Specified by:
      getEffects in interface IPlanningOperator
      Returns:
      an ArrayList with all the operators's effects
    • getID

      public Integer getID()
      Description copied from interface: IPlanningOperator
      Gets the ID of the Operator in the plan
      Specified by:
      getID in interface IPlanningOperator
      Returns:
      - the Operator's ID
    • getPrecondition

      public Condition getPrecondition(Integer preconditionID)
      Description copied from interface: IPlanningOperator
      Gets the operator's precondition with the given ID
      Specified by:
      getPrecondition in interface IPlanningOperator
      Parameters:
      preconditionID - - the id of the operators's precondition
      Returns:
      the precondition
    • getPreconditions

      public ArrayList<Condition> getPreconditions()
      Description copied from interface: IPlanningOperator
      Gets the preconditions of the Operator
      Specified by:
      getPreconditions in interface IPlanningOperator
      Returns:
      an ArrayList with all the Operator's preconditions
    • setID

      public void setID(Integer id)
      Description copied from interface: IPlanningOperator
      Sets the operators's ID in the plan
      Specified by:
      setID in interface IPlanningOperator
      Parameters:
      id - - the new operators's ID
    • setUrgency

      public void setUrgency(float urgency)
    • updateEffectsProbability

      public void updateEffectsProbability(AgentModel am)
      Description copied from interface: IPlanningOperator
      Updates the probabilities of the operators's effects
      Specified by:
      updateEffectsProbability in interface IPlanningOperator