Class AbstractStateSpaceSearch
java.lang.Object
fr.uga.pddl4j.planners.statespace.search.AbstractStateSpaceSearch
- All Implemented Interfaces:
SearchStrategy
,StateSpaceSearch
,Serializable
- Direct Known Subclasses:
AStar
,BreadthFirstSearch
,DepthFirstSearch
,EnforcedHillClimbing
,GreedyBestFirstSearch
,HillClimbing
This abstract class defines the main methods for search strategies.
- Since:
- 3.6
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface fr.uga.pddl4j.planners.SearchStrategy
SearchStrategy.Name
-
Field Summary
Fields inherited from interface fr.uga.pddl4j.planners.statespace.search.StateSpaceSearch
DEFAULT_HEURISTIC, DEFAULT_HEURISTIC_WEIGHT, DEFAULT_TIMEOUT
-
Constructor Summary
ConstructorDescriptionCreate a new search strategy.AbstractStateSpaceSearch(int timeout)
Create a new search strategy.AbstractStateSpaceSearch(int timeout, StateHeuristic.Name heuristic, double weight)
Create a new search strategy. -
Method Summary
Modifier and TypeMethodDescriptionextractPlan(Node node, Problem problem)
Extract a plan from a solution node for the specified planning problem.int
Returns the number of created nodes.int
Returns the number of explored nodes.Returns the heuristic to use to solve the planning problem.long
Returns the amount of memory used for the search.int
Returns the number of pending nodes.long
Returns the time spend to find a solution.int
Returns the time out of the planner in second.double
Returns the weight set to the heuristic.protected void
Reset Nodes statistics.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.void
setCreatedNodes(int createdNodes)
Sets the number of created nodes.void
setExploredNodes(int exploredNodes)
Sets the number of explored nodes.void
setHeuristic(StateHeuristic.Name heuristic)
Sets the heuristic to use to solved the problem.void
setMemoryUsed(long memoryUsed)
Sets the amount of memory used for the search.void
setPendingNodes(int pendingNodes)
Sets the number of pending nodes.void
setSearchingTime(long searchingTime)
Sets the time out of the planner.void
setTimeOut(int timeout)
Sets the time out of the planner in second.void
setWeight(double weight)
Sets the wight of the heuristic.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface fr.uga.pddl4j.planners.statespace.search.StateSpaceSearch
search
-
Constructor Details
-
AbstractStateSpaceSearch
public AbstractStateSpaceSearch()Create a new search strategy. -
AbstractStateSpaceSearch
public AbstractStateSpaceSearch(int timeout)Create a new search strategy.- Parameters:
timeout
- the time out of the planner in seconds.
-
AbstractStateSpaceSearch
Create a new search strategy.- Parameters:
timeout
- the time out of the planner in seconds.heuristic
- the heuristicType to use to solve the planning problem.weight
- the weight set to the heuristic.
-
-
Method Details
-
getHeuristic
Returns the heuristic to use to solve the planning problem.- Specified by:
getHeuristic
in interfaceStateSpaceSearch
- Returns:
- the heuristic to use to solve the planning problem.
-
setHeuristic
Sets the heuristic to use to solved the problem.- Specified by:
setHeuristic
in interfaceStateSpaceSearch
- Parameters:
heuristic
- the heuristic to use to solved the problem. The heuristic cannot be null.
-
getWeight
public final double getWeight()Returns the weight set to the heuristic.- Specified by:
getWeight
in interfaceStateSpaceSearch
- Returns:
- the weight set to the heuristic.
-
setWeight
public final void setWeight(double weight)Sets the wight of the heuristic.- Specified by:
setWeight
in interfaceStateSpaceSearch
- Parameters:
weight
- the weight of the heuristic. The weight must be positive.
-
setTimeOut
public final void setTimeOut(int timeout)Sets the time out of the planner in second.- Specified by:
setTimeOut
in interfaceStateSpaceSearch
- Parameters:
timeout
- the time allocated to the search in second. Timeout must be positive.
-
getTimeout
public int getTimeout()Returns the time out of the planner in second.- Specified by:
getTimeout
in interfaceStateSpaceSearch
- Returns:
- the time out of the planner, i.e., the time allocated to the search in second.
-
getSearchingTime
public long getSearchingTime()Returns the time spend to find a solution.- Specified by:
getSearchingTime
in interfaceStateSpaceSearch
- Returns:
- the time spend to find a solution.
-
setSearchingTime
public void setSearchingTime(long searchingTime)Sets the time out of the planner.- Specified by:
setSearchingTime
in interfaceStateSpaceSearch
- Parameters:
searchingTime
- the time allocated to the search in second. Timeout mus be positive.
-
getMemoryUsed
public long getMemoryUsed()Returns the amount of memory used for the search.- Specified by:
getMemoryUsed
in interfaceStateSpaceSearch
- Returns:
- the amount of memory used for the search.
-
setMemoryUsed
public void setMemoryUsed(long memoryUsed)Sets the amount of memory used for the search.- Specified by:
setMemoryUsed
in interfaceStateSpaceSearch
- Parameters:
memoryUsed
- the amount of memory used for the search.
-
getExploredNodes
public int getExploredNodes()Returns the number of explored nodes.- Specified by:
getExploredNodes
in interfaceStateSpaceSearch
- Returns:
- the number of explored nodes.
-
setExploredNodes
public void setExploredNodes(int exploredNodes)Sets the number of explored nodes.- Specified by:
setExploredNodes
in interfaceStateSpaceSearch
- Parameters:
exploredNodes
- the number of explored nodes.
-
getPendingNodes
public int getPendingNodes()Returns the number of pending nodes.- Specified by:
getPendingNodes
in interfaceStateSpaceSearch
- Returns:
- the number of pending nodes.
-
setPendingNodes
public void setPendingNodes(int pendingNodes)Sets the number of pending nodes.- Specified by:
setPendingNodes
in interfaceStateSpaceSearch
- Parameters:
pendingNodes
- the number of pending nodes.
-
getCreatedNodes
public int getCreatedNodes()Returns the number of created nodes.- Specified by:
getCreatedNodes
in interfaceStateSpaceSearch
- Returns:
- the number of created nodes.
-
setCreatedNodes
public void setCreatedNodes(int createdNodes)Sets the number of created nodes.- Specified by:
setCreatedNodes
in interfaceStateSpaceSearch
- Parameters:
createdNodes
- the number of created nodes.
-
searchSolutionNode
Search a solution node to a specified domain and problem.- Specified by:
searchSolutionNode
in interfaceStateSpaceSearch
- 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.- Specified by:
searchPlan
in interfaceStateSpaceSearch
- 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.- Specified by:
extractPlan
in interfaceStateSpaceSearch
- Parameters:
node
- the solution node.problem
- the problem to be solved.- Returns:
- the solution plan or null is no solution was found.
-
resetNodesStatistics
protected void resetNodesStatistics()Reset Nodes statistics.
-