Interface StateSpaceSearch
- All Superinterfaces:
SearchStrategy,Serializable
- All Known Implementing Classes:
AbstractStateSpaceSearch,AStar,BreadthFirstSearch,DepthFirstSearch,EnforcedHillClimbing,GreedyBestFirstSearch,HillClimbing
This interface defines the main methods for search strategies.
- Since:
- 3.6
-
Nested Class Summary
Nested classes/interfaces inherited from interface fr.uga.pddl4j.planners.SearchStrategy
SearchStrategy.Name -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StateHeuristic.NameThe default heuristic used (FAST_FORWARD).static doubleThe default weight of the heuristic (1.0).static intThe default time out (600s). -
Method Summary
Modifier and TypeMethodDescriptionextractPlan(Node solutionNode, Problem codedProblem)Extract a plan from a solution node for the specified planning problem.intReturns the number of created nodes.intReturns the number of explored nodes.Returns the heuristic to use to solve the planning problem.static StateSpaceSearchgetInstance(SearchStrategy.Name name)Returns an instance of a specified search strategy with the default heuristic, weight and timeout.static StateSpaceSearchgetInstance(SearchStrategy.Name name, StateHeuristic.Name heuristic)Returns an instance of a specified search strategy withe the default weight and timeout.static StateSpaceSearchgetInstance(SearchStrategy.Name name, StateHeuristic.Name heuristic, double weight)Returns an instance of a specified search strategy with ethe default timeout.static StateSpaceSearchgetInstance(SearchStrategy.Name name, StateHeuristic.Name heuristic, double weight, int timeout)Returns an instance of a specified search strategy.longReturns the amount of memory used for the search.intReturns the number of pending nodes.longReturns the time spend to find a solution.intReturns the time out of the planner.doubleReturns the weight set to the heuristic.Solves the planning problem and returns the first solution node found.searchPlan(Problem codedProblem)Search a solution plan to a specified domain and problem.searchSolutionNode(Problem codedProblem)Search a solution node to a specified domain and problem.voidsetCreatedNodes(int createdNodes)Sets the number of created nodes.voidsetExploredNodes(int exploredNodes)Sets the number of explored nodes.voidsetHeuristic(StateHeuristic.Name heuristic)Sets the heuristic to use to solved the problem.voidsetMemoryUsed(long memoryUsed)Sets the amount of memory used for the search.voidsetPendingNodes(int pendingNodes)Sets the number of pending nodes.voidsetSearchingTime(long searchingTime)Sets the time spend to find a solution.voidsetTimeOut(int timeout)Sets the time out of the planner.voidsetWeight(double weight)Sets the wight of the heuristic.
-
Field Details
-
DEFAULT_HEURISTIC
The default heuristic used (FAST_FORWARD). -
DEFAULT_HEURISTIC_WEIGHT
static final double DEFAULT_HEURISTIC_WEIGHTThe default weight of the heuristic (1.0).- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
static final int DEFAULT_TIMEOUTThe default time out (600s).- See Also:
- Constant Field Values
-
-
Method Details
-
getHeuristic
StateHeuristic.Name getHeuristic()Returns the heuristic to use to solve the planning problem.- Returns:
- the heuristic to use to solve the planning problem.
-
setHeuristic
Sets the heuristic to use to solved the problem.- Parameters:
heuristic- the heuristic to use to solved the problem. The heuristic cannot be null.
-
getWeight
double getWeight()Returns the weight set to the heuristic.- Returns:
- the weight set to the heuristic.
-
setWeight
void setWeight(double weight)Sets the wight of the heuristic.- Parameters:
weight- the weight of the heuristic. The weight must be positive.
-
setTimeOut
void setTimeOut(int timeout)Sets the time out of the planner.- Parameters:
timeout- the time allocated to the search in second.
-
getTimeout
int getTimeout()Returns the time out of the planner.- Returns:
- the time out of the planner, i.e., the time allocated to the search in second.
-
getSearchingTime
long getSearchingTime()Returns the time spend to find a solution.- Returns:
- the time spend to find a solution.
-
setSearchingTime
void setSearchingTime(long searchingTime)Sets the time spend to find a solution.- Parameters:
searchingTime- the time spend to find a solution.
-
getMemoryUsed
long getMemoryUsed()Returns the amount of memory used for the search.- Returns:
- the amount of memory used for the search.
-
setMemoryUsed
void setMemoryUsed(long memoryUsed)Sets the amount of memory used for the search.- Parameters:
memoryUsed- the amount of memory used for the search.
-
getExploredNodes
int getExploredNodes()Returns the number of explored nodes.- Returns:
- the number of explored nodes.
-
setExploredNodes
void setExploredNodes(int exploredNodes)Sets the number of explored nodes.- Parameters:
exploredNodes- the number of explored nodes.
-
getPendingNodes
int getPendingNodes()Returns the number of pending nodes.- Returns:
- the number of pending nodes.
-
setPendingNodes
void setPendingNodes(int pendingNodes)Sets the number of pending nodes.- Parameters:
pendingNodes- the number of pending nodes.
-
getCreatedNodes
int getCreatedNodes()Returns the number of created nodes.- Returns:
- the number of created nodes.
-
setCreatedNodes
void setCreatedNodes(int createdNodes)Sets the number of created nodes.- Parameters:
createdNodes- the number of created nodes.
-
search
Solves the planning problem and returns the first solution node found.- Parameters:
codedProblem- the problem to be solved. The problem cannot be null.- Returns:
- a solution search or null if it does not exist.
-
searchSolutionNode
Search a solution node to a specified domain and problem.- Parameters:
codedProblem- the problem to be solved. The problem cannot be null.- Returns:
- the solution node or null.
-
searchPlan
Search a solution plan to a specified domain and problem.- Parameters:
codedProblem- the problem to be solved. The problem cannot be null.- Returns:
- the solution plan or null.
-
extractPlan
Extract a plan from a solution node for the specified planning problem.- Parameters:
solutionNode- the solution node.codedProblem- the problem to be solved.- Returns:
- the solution plan or null is no solution was found.
-
getInstance
Returns an instance of a specified search strategy with the default heuristic, weight and timeout.- Parameters:
name- the name of the search strategy.- Returns:
- the search strategy.
-
getInstance
Returns an instance of a specified search strategy withe the default weight and timeout.- Parameters:
name- the name of the search strategy.heuristic- the heuristic to used bt the search strategy.- Returns:
- the search strategy.
-
getInstance
static StateSpaceSearch getInstance(SearchStrategy.Name name, StateHeuristic.Name heuristic, double weight)Returns an instance of a specified search strategy with ethe default timeout.- Parameters:
name- the name of the search strategy.heuristic- the heuristic to used bt the search strategy.weight- the weight of the heuristic to used of the search strategy.- Returns:
- the search strategy.
-
getInstance
static StateSpaceSearch getInstance(SearchStrategy.Name name, StateHeuristic.Name heuristic, double weight, int timeout)Returns an instance of a specified search strategy.- Parameters:
name- the name of the search strategy.heuristic- the heuristic to used bt the search strategy.weight- the weight of the heuristic to used of the search strategy.timeout- the timeout of the search strategy.- Returns:
- the search strategy.
-