Class ActivePursuitGoal

    • Field Detail

      • _active

        protected boolean _active
      • _failureConditions

        protected java.util.ArrayList<Condition> _failureConditions
      • _preConditions

        protected java.util.ArrayList<Condition> _preConditions
      • _successConditions

        protected java.util.ArrayList<Condition> _successConditions
      • _numberOfTries

        protected int _numberOfTries
      • _probability

        protected java.lang.Float _probability
      • _probabilityDetermined

        protected boolean _probabilityDetermined
      • _familiarity

        protected java.lang.Float _familiarity
      • _urgency

        protected java.lang.Float _urgency
      • _id

        protected java.lang.Integer _id
      • _agent

        protected Symbol _agent
      • _effects

        protected java.util.ArrayList<Effect> _effects
    • Constructor Detail

      • ActivePursuitGoal

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

        protected ActivePursuitGoal()
    • Method Detail

      • AddCondition

        public void AddCondition​(java.lang.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 java.lang.Float GetProbability​(AgentModel am)
      • SetProbability

        public void SetProbability​(java.lang.Float p)
      • getUncertainty

        public float getUncertainty​(AgentModel am)
      • setUncertainty

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

        public void IncrementNumberOfTries()
      • GetFailureConditions

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

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

        public java.util.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​(java.util.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:
        Substitution
      • getNameWithCharactersOrdered

        public java.lang.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:
        Substitution
      • clone

        public java.lang.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 java.lang.Object
        Returns:
        The Goal's copy.
      • getPlans

        public java.util.ArrayList<Plan> getPlans​(AgentModel am)
      • toString

        public java.lang.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
      • 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​(java.lang.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 java.util.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 java.lang.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​(java.lang.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
      • setID

        public void setID​(java.lang.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)