Package FAtiMA.Core.goals
Class Goal
java.lang.Object
FAtiMA.Core.goals.Goal
- All Implemented Interfaces:
IGroundable,Serializable,Cloneable
- Direct Known Subclasses:
ActivePursuitGoal,InterestGoal
abstract goal class used to represent common aspects of Interest
goals and ActivePursuit goals.
- Author:
- Joao Dias
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<Substitution>protected intprotected intprotected Nameprotected Nameprotected intprotected Stringprotected Namestatic final Stringstatic final Stringprotected static intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAddCondition(String conditionType, Condition cond) Adds a condition to the goalabstract voidChecks the integrity of the goal.voidDecreaseImportanceOfFailure(AgentModel am, float decr) Decreases the ImportanceOfFailure of a goal by a given ammount Used for emotion-focused coping strategies like disengagementvoidDecreaseImportanceOfSuccess(AgentModel am, float decr) Decreases the ImportanceOfSuccess of a goal by a given amount Used for emotion-focused coping strategies like disengagementprotected EventgenerateEventDescription(short goalEventType) GenerateGoalStatus(String status) Generates a status description of goal according to the received status.Gets an Event that represents the goal's activationGets an Event that represents the goal's failurefloatGets the goal's importance of failurefloatGets the goal's importance of successgetKey()getName()Gets the goal's nameGets an Event that represents the goal's successGroundConditionList(ArrayList<Condition> originalList, ArrayList<Substitution> bindings) Gets a list of conditions, a list of bindings and returns a new list of conditions where the conditions were grounded with the list of received bindings.voidIncreaseImportanceOfFailure(AgentModel am, float incr) Increases the ImportanceOfFailure of a goal by a given ammount Used for emotion-focused coping strategiesvoidIncreaseImportanceOfSuccess(AgentModel am, float incr) Increases the ImportanceOfSuccess of a goal by a fixed ammount Used for emotion-focused coping strategiesbooleanIndicates if the Goal is grounded (no unbound variables in its name and conditions) Example: Stronger(Luke,John) is grounded while Stronger(John,[X]) is not.abstract voidMakeGround(Substitution subst) Applies a set of substitutions to the object, grounding it.abstract voidMakeGround(ArrayList<Substitution> bindings) Applies a set of substitutions to the object, grounding it.abstract voidReplaceUnboundVariables(int variableID) Replaces all unbound variables in the object by applying a numeric identifier to each one.voidSetImportanceOfFailure(AgentModel am, float imp) Sets the goal's importance of failurevoidSetImportanceOfSuccess(AgentModel am, float imp) Sets the goal's importance of successtoString()Converts the Goal to a String
-
Field Details
-
GOALSUCCESS
- See Also:
-
GOALFAILURE
- See Also:
-
GOALDROPED
- See Also:
-
IMPORTANCEOFSUCCESS
- See Also:
-
IMPORTANCEOFFAILURE
- See Also:
-
ACTIVATIONEVENT
- See Also:
-
SUCCESSEVENT
- See Also:
-
FAILUREEVENT
- See Also:
-
goalCounter
protected static int goalCounter -
_name
-
_key
-
_appliedSubstitutions
-
_goalID
protected int _goalID -
_baseIOF
protected int _baseIOF -
_baseIOS
protected int _baseIOS -
_dynamicIOF
-
_dynamicIOS
-
-
Constructor Details
-
Goal
public Goal()Creates a new Empty Goal. Not used directly since its an abstract class -
Goal
Creates a new Goal. Not used directly since its an abstract class- Parameters:
description- - the goal's name
-
-
Method Details
-
getAppliedSubstitutions
-
GenerateGoalStatus
Generates a status description of goal according to the received status. Ex: if the goal is Fight(Luke) and the status is GOALSUCCESS the method returns GOALSUCCESS(Fight,Luke)- Parameters:
status- - the goal status, use one of the static status values: Goal.GOALSUCCESS Goal.GOALFAILURE Goal.GOALDROPED ... etc- Returns:
- status
-
AddCondition
Adds a condition to the goal- Parameters:
conditionType- - the type of the condition: success condition, precondition, etccond- - the condition to add
-
CheckIntegrity
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)- 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
-
DecreaseImportanceOfFailure
Decreases the ImportanceOfFailure of a goal by a given ammount Used for emotion-focused coping strategies like disengagement -
getKey
-
IncreaseImportanceOfFailure
Increases the ImportanceOfFailure of a goal by a given ammount Used for emotion-focused coping strategies -
DecreaseImportanceOfSuccess
Decreases the ImportanceOfSuccess of a goal by a given amount Used for emotion-focused coping strategies like disengagement -
IncreaseImportanceOfSuccess
Increases the ImportanceOfSuccess of a goal by a fixed ammount Used for emotion-focused coping strategies -
GetImportanceOfFailure
Gets the goal's importance of failure- Returns:
- the importance of failure ranged [0;10]
-
GetImportanceOfSuccess
Gets the goal's importance of success- Returns:
- the importance of success ranged [0;10]
-
getName
Gets the goal's name- Returns:
- the name of the goal
-
GetActivationEvent
Gets an Event that represents the goal's activation- Returns:
- an Event that contains a description of the goal's activation
-
GetSuccessEvent
Gets an Event that represents the goal's success- Returns:
- an Event that contains a description of the goal's success
-
GetFailureEvent
Gets an Event that represents the goal's failure- Returns:
- an Event that contains a description of the goal's failure
-
GetCancelEvent
-
generateEventDescription
-
ReplaceUnboundVariables
public abstract 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- Parameters:
variableID- - the identifier to be applied
-
MakeGround
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- Parameters:
bindings- - A list of substitutions of the type "[Variable]/value"- See Also:
-
MakeGround
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- Parameters:
subst- - a substitution of the type "[Variable]/value"- See Also:
-
isGrounded
public boolean isGrounded()Indicates if the Goal is grounded (no unbound variables in its name and conditions) Example: Stronger(Luke,John) is grounded while Stronger(John,[X]) is not.- Specified by:
isGroundedin interfaceIGroundable- Returns:
- true if all the goal's conditions and name are grounded, false otherwise
-
SetImportanceOfFailure
Sets the goal's importance of failure- Parameters:
imp- - the new importance of failure (ranged [0;10])
-
SetImportanceOfSuccess
Sets the goal's importance of success- Parameters:
imp- - the new importance of success (ranged [0;10])
-
toString
Converts the Goal to a String -
GroundConditionList
protected ArrayList<Condition> GroundConditionList(ArrayList<Condition> originalList, ArrayList<Substitution> bindings) Gets a list of conditions, a list of bindings and returns a new list of conditions where the conditions were grounded with the list of received bindings. Defined for internal use of the InterestGoal and ActivePursuitGoal classes- Parameters:
originalList- - the list of conditions to groundbindings- - a list of substitutions to apply to the condition list- Returns:
- a list with grounded conditions
- See Also:
-