public class PlanningAgent extends AbstractPlayer
Agenda
to find out how goals are structured.Modifier and Type | Field and Description |
---|---|
protected Agenda |
agenda |
protected static int |
callsPlanner |
protected java.util.Set<java.lang.String> |
connectionSet |
protected static boolean |
debugMode |
protected static long |
executionTime |
protected static java.lang.String |
gameConfigFile |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
gameElementVars |
protected GameInformation |
gameInformation |
protected java.util.Iterator<PDDLAction> |
iterPlan |
protected static boolean |
localHost |
protected boolean |
mustPlan |
protected static int |
numDiscrepancies |
protected static int |
numGoals |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
PDDLGameStateObjects |
protected java.util.List<java.lang.String> |
PDDLGameStatePredicates |
protected PDDLPlan |
PDDLPlan |
protected java.util.List<java.lang.String> |
reachedSavedGoalPredicates |
protected static boolean |
saveInformation |
protected int |
turn |
Constructor and Description |
---|
PlanningAgent(StateObservation stateObservation,
ElapsedCpuTimer elapsedCpuTimer)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
Types.ACTIONS |
act(StateObservation stateObservation,
ElapsedCpuTimer elapsedCpuTimer)
Method called in each turn that returns the next action that the agent
will execute.
|
boolean |
checkEarlyReachedGoals(java.util.List<PDDLAction.Effect> effects)
Method that checks whether a goal is reached beforehand by checking
the effects of an action.
|
boolean |
checkPreconditions(java.util.List<java.lang.String> preconditions,
boolean showInformation)
Method that checks whether the preconditions of an action are satisfied or
not.
|
void |
createProblemFile()
Method that creates a PDDL problem file.
|
static void |
displayStats()
Method used to display game stats after the execution has finished.
|
PDDLPlan |
findPlan()
Method that allows the agent to find a plan to the current given goal.
|
java.util.HashSet<java.lang.String>[][] |
getGameElementsMatrix(StateObservation stateObservation)
Method that translates a game state observation to a matrix of strings which
represent the elements of the game in each position according to the VGDDL
registry.
|
static void |
setDebugMode(boolean debugMode) |
static void |
setGameConfigFile(java.lang.String path) |
static void |
setLocalHost(boolean localHost) |
static void |
setSaveInformation(boolean saveInformation) |
void |
translateGameStateToPDDL(StateObservation stateObservation)
Method that translates a game state observation to PDDL predicates.
|
act
draw, getAllActions, getLastAction, getPlayerID, isHuman, logAction, result, resultMulti, setPlayerID, setup, teardown
protected static java.lang.String gameConfigFile
protected static boolean debugMode
protected static boolean saveInformation
protected static boolean localHost
protected Agenda agenda
protected java.util.List<java.lang.String> PDDLGameStatePredicates
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> PDDLGameStateObjects
protected PDDLPlan PDDLPlan
protected java.util.Iterator<PDDLAction> iterPlan
protected GameInformation gameInformation
protected java.util.List<java.lang.String> reachedSavedGoalPredicates
protected boolean mustPlan
protected java.util.Set<java.lang.String> connectionSet
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> gameElementVars
protected int turn
protected static long executionTime
protected static int callsPlanner
protected static int numDiscrepancies
protected static int numGoals
public PlanningAgent(StateObservation stateObservation, ElapsedCpuTimer elapsedCpuTimer)
stateObservation
- State observation of the game.elapsedCpuTimer
- Elapsed CPU time.public Types.ACTIONS act(StateObservation stateObservation, ElapsedCpuTimer elapsedCpuTimer)
public boolean checkPreconditions(java.util.List<java.lang.String> preconditions, boolean showInformation)
preconditions
- List of preconditions to check.showInformation
- Boolean telling whether to show or not debug information.public boolean checkEarlyReachedGoals(java.util.List<PDDLAction.Effect> effects)
effects
- List that contains the effect predicates of an action that
will be checked.public PDDLPlan findPlan() throws PlannerException
PlannerException
- Thrown when the planner's response status is not OK.public void translateGameStateToPDDL(StateObservation stateObservation)
stateObservation
- State observation of the game.public java.util.HashSet<java.lang.String>[][] getGameElementsMatrix(StateObservation stateObservation)
stateObservation
- State observation of the game.public void createProblemFile()
public static void setGameConfigFile(java.lang.String path)
public static void setDebugMode(boolean debugMode)
public static void setSaveInformation(boolean saveInformation)
public static void setLocalHost(boolean localHost)
public static void displayStats()