Package FAtiMA.Core.goals
Class ActivePursuitGoal
- java.lang.Object
-
- FAtiMA.Core.goals.Goal
-
- FAtiMA.Core.goals.ActivePursuitGoal
-
- All Implemented Interfaces:
IPlanningOperator,IGroundable,java.io.Serializable,java.lang.Cloneable
public class ActivePursuitGoal extends Goal implements IPlanningOperator
Implements OCC's ActivePursuit goals that have activation conditions- Author:
- Joao Dias
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean_activeprotected Symbol_agentprotected java.util.ArrayList<Effect>_effectsprotected java.util.ArrayList<Condition>_failureConditionsprotected java.lang.Float_familiarityprotected java.lang.Integer_idprotected int_numberOfTriesprotected java.util.ArrayList<Condition>_preConditionsprotected java.lang.Float_probabilityprotected boolean_probabilityDeterminedprotected java.util.ArrayList<Condition>_successConditionsprotected java.lang.Float_urgencystatic floatalfa-
Fields inherited from class FAtiMA.Core.goals.Goal
_appliedSubstitutions, _baseIOF, _baseIOS, _dynamicIOF, _dynamicIOS, _goalID, _key, _name, ACTIVATIONEVENT, FAILUREEVENT, goalCounter, GOALDROPED, GOALFAILURE, GOALSUCCESS, IMPORTANCEOFFAILURE, IMPORTANCEOFSUCCESS, SUCCESSEVENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedActivePursuitGoal()ActivePursuitGoal(Name description)Creates a new ActivePursuitGoal
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidAddCondition(java.lang.String conditionType, Condition cond)Adds a condition to the goalvoidaddEffect(Effect e)booleanCheckFailure(AgentModel am)Checks an ActivePursuitGoal's failure conditions if at least one of them is verified the goal failsvoidCheckIntegrity(IntegrityValidator val)Checks the integrity of the goal.booleancheckPreconditions(AgentModel am)Checks if the operators's preconditions are verified in the current StatebooleanCheckSuccess(AgentModel am)Checks an ActivePursuitGoal's success conditions if all of them are verified the goal succeedsjava.lang.Objectclone()Clones this ActivePursuitGoal, returning an equal copy.booleanequals(IPlanningOperator op)Compares this planOperator with another planOperator to see if they are equalSymbolgetAgent()Gets the name of the agent that executes the operatorEffectgetEffect(java.lang.Integer effectID)Gets the operators's effect with the given IDjava.util.ArrayList<Effect>getEffects()Gets the operator's effectsjava.util.ArrayList<Condition>GetFailureConditions()Gets the goal's failure conditionsfloatGetGoalUrgency()java.lang.IntegergetID()Gets the ID of the Operator in the planjava.lang.StringgetNameWithCharactersOrdered()intGetNumberOfTries()java.util.ArrayList<Plan>getPlans(AgentModel am)ConditiongetPrecondition(java.lang.Integer preconditionID)Gets the operator's precondition with the given IDjava.util.ArrayList<Condition>getPreconditions()Gets the preconditions of the Operatorjava.util.ArrayList<Condition>GetPreconditions()Gets the goal's preconditionsfloatgetProbability(AgentModel am)Gets the operator's probability of executionjava.lang.FloatGetProbability(AgentModel am)java.util.ArrayList<Condition>GetSuccessConditions()Gets the goal's success conditionsfloatgetUncertainty(AgentModel am)voidIncrementNumberOfTries()voidMakeGround(Substitution subst)Applies a set of substitutions to the object, grounding it.voidMakeGround(java.util.ArrayList<Substitution> bindings)Applies a set of substitutions to the object, grounding it.booleanmayContainSelf()voidReplaceUnboundVariables(int variableID)Replaces all unbound variables in the object by applying a numeric identifier to each one.voidsetID(java.lang.Integer id)Sets the operators's ID in the planvoidSetProbability(java.lang.Float p)voidsetUncertainty(AgentModel am, float uncertainty)voidsetUrgency(float urgency)java.lang.StringtoString()Converts the ActivePursuitGoal to a StringvoidupdateEffectsProbability(AgentModel am)Updates the probabilities of the operators's effects-
Methods inherited from class FAtiMA.Core.goals.Goal
DecreaseImportanceOfFailure, DecreaseImportanceOfSuccess, generateEventDescription, GenerateGoalStatus, GetActivationEvent, getAppliedSubstitutions, GetCancelEvent, GetFailureEvent, GetImportanceOfFailure, GetImportanceOfSuccess, getKey, getName, GetSuccessEvent, GroundConditionList, IncreaseImportanceOfFailure, IncreaseImportanceOfSuccess, isGrounded, SetImportanceOfFailure, SetImportanceOfSuccess
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface FAtiMA.Core.wellFormedNames.IGroundable
isGrounded
-
Methods inherited from interface FAtiMA.Core.plans.IPlanningOperator
getName
-
-
-
-
Field Detail
-
alfa
public static final float alfa
- See Also:
- Constant Field Values
-
_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:
AddConditionin classGoal- Parameters:
conditionType- - the type of the condition: PreConditions SuccessConditions FailureConditionscond- - 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:
CheckIntegrityin classGoal- 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:
ReplaceUnboundVariablesin interfaceIGroundable- Specified by:
ReplaceUnboundVariablesin classGoal- 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:
MakeGroundin interfaceIGroundable- Specified by:
MakeGroundin classGoal- 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:
MakeGroundin interfaceIGroundable- Specified by:
MakeGroundin classGoal- 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:
clonein interfaceIPlanningOperator- Overrides:
clonein classjava.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
-
addEffect
public void addEffect(Effect e)
-
checkPreconditions
public boolean checkPreconditions(AgentModel am)
Description copied from interface:IPlanningOperatorChecks if the operators's preconditions are verified in the current State- Specified by:
checkPreconditionsin interfaceIPlanningOperator- Returns:
- true if all preconditions are true according to the current State, false otherwise
-
getProbability
public float getProbability(AgentModel am)
Description copied from interface:IPlanningOperatorGets the operator's probability of execution- Specified by:
getProbabilityin interfaceIPlanningOperator- Returns:
- the operators's probability
-
equals
public boolean equals(IPlanningOperator op)
Description copied from interface:IPlanningOperatorCompares this planOperator with another planOperator to see if they are equal- Specified by:
equalsin interfaceIPlanningOperator- Returns:
- true if the operators have the same ID in a plan
-
getAgent
public Symbol getAgent()
Description copied from interface:IPlanningOperatorGets the name of the agent that executes the operator- Specified by:
getAgentin interfaceIPlanningOperator- Returns:
- the name of the agent that executes the operator
-
getEffect
public Effect getEffect(java.lang.Integer effectID)
Description copied from interface:IPlanningOperatorGets the operators's effect with the given ID- Specified by:
getEffectin interfaceIPlanningOperator- Parameters:
effectID- - the id of the operators's effect- Returns:
- the effect
-
getEffects
public java.util.ArrayList<Effect> getEffects()
Description copied from interface:IPlanningOperatorGets the operator's effects- Specified by:
getEffectsin interfaceIPlanningOperator- Returns:
- an ArrayList with all the operators's effects
-
getID
public java.lang.Integer getID()
Description copied from interface:IPlanningOperatorGets the ID of the Operator in the plan- Specified by:
getIDin interfaceIPlanningOperator- Returns:
- - the Operator's ID
-
getPrecondition
public Condition getPrecondition(java.lang.Integer preconditionID)
Description copied from interface:IPlanningOperatorGets the operator's precondition with the given ID- Specified by:
getPreconditionin interfaceIPlanningOperator- Parameters:
preconditionID- - the id of the operators's precondition- Returns:
- the precondition
-
getPreconditions
public java.util.ArrayList<Condition> getPreconditions()
Description copied from interface:IPlanningOperatorGets the preconditions of the Operator- Specified by:
getPreconditionsin interfaceIPlanningOperator- Returns:
- an ArrayList with all the Operator's preconditions
-
setID
public void setID(java.lang.Integer id)
Description copied from interface:IPlanningOperatorSets the operators's ID in the plan- Specified by:
setIDin interfaceIPlanningOperator- Parameters:
id- - the new operators's ID
-
setUrgency
public void setUrgency(float urgency)
-
updateEffectsProbability
public void updateEffectsProbability(AgentModel am)
Description copied from interface:IPlanningOperatorUpdates the probabilities of the operators's effects- Specified by:
updateEffectsProbabilityin interfaceIPlanningOperator
-
-