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
ConstructorsConstructorDescriptionCreate 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.intReturns the number of created nodes.intReturns the number of explored nodes.Returns the heuristic to use to solve the planning problem.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 in second.doubleReturns the weight set to the heuristic.protected voidReset 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.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 out of the planner.voidsetTimeOut(int timeout)Sets the time out of the planner in second.voidsetWeight(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, waitMethods 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:
getHeuristicin interfaceStateSpaceSearch- Returns:
- the heuristic to use to solve the planning problem.
-
setHeuristic
Sets the heuristic to use to solved the problem.- Specified by:
setHeuristicin 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:
getWeightin interfaceStateSpaceSearch- Returns:
- the weight set to the heuristic.
-
setWeight
public final void setWeight(double weight)Sets the wight of the heuristic.- Specified by:
setWeightin 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:
setTimeOutin 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:
getTimeoutin 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:
getSearchingTimein interfaceStateSpaceSearch- Returns:
- the time spend to find a solution.
-
setSearchingTime
public void setSearchingTime(long searchingTime)Sets the time out of the planner.- Specified by:
setSearchingTimein 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:
getMemoryUsedin 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:
setMemoryUsedin interfaceStateSpaceSearch- Parameters:
memoryUsed- the amount of memory used for the search.
-
getExploredNodes
public int getExploredNodes()Returns the number of explored nodes.- Specified by:
getExploredNodesin interfaceStateSpaceSearch- Returns:
- the number of explored nodes.
-
setExploredNodes
public void setExploredNodes(int exploredNodes)Sets the number of explored nodes.- Specified by:
setExploredNodesin interfaceStateSpaceSearch- Parameters:
exploredNodes- the number of explored nodes.
-
getPendingNodes
public int getPendingNodes()Returns the number of pending nodes.- Specified by:
getPendingNodesin interfaceStateSpaceSearch- Returns:
- the number of pending nodes.
-
setPendingNodes
public void setPendingNodes(int pendingNodes)Sets the number of pending nodes.- Specified by:
setPendingNodesin interfaceStateSpaceSearch- Parameters:
pendingNodes- the number of pending nodes.
-
getCreatedNodes
public int getCreatedNodes()Returns the number of created nodes.- Specified by:
getCreatedNodesin interfaceStateSpaceSearch- Returns:
- the number of created nodes.
-
setCreatedNodes
public void setCreatedNodes(int createdNodes)Sets the number of created nodes.- Specified by:
setCreatedNodesin interfaceStateSpaceSearch- Parameters:
createdNodes- the number of created nodes.
-
searchSolutionNode
Search a solution node to a specified domain and problem.- Specified by:
searchSolutionNodein 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:
searchPlanin 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:
extractPlanin 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.
-