I - N - A - V - public class BestFirst<I extends GraphSearchWithSubpathEvaluationsInput<N,A,V>,N,A,V extends java.lang.Comparable<V>> extends AOptimalPathInORGraphSearch<I,N,A,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
BestFirst.ParentDiscarding |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicInteger |
activeJobs |
protected int |
additionalThreadsForNodeAttachment |
protected boolean |
checkGoalPropertyOnEntirePath |
protected java.util.Map<N,Node<N,V>> |
ext2int |
protected GraphGenerator<N,A> |
graphGenerator |
protected INodeEvaluator<N,V> |
nodeEvaluator |
protected NodeGoalTester<N> |
nodeGoalTester |
protected java.util.Queue<Node<N,V>> |
open |
protected PathGoalTester<N> |
pathGoalTester |
protected java.util.Queue<EvaluatedSearchSolutionCandidateFoundEvent<N,A,V>> |
pendingSolutionFoundEvents |
protected RootGenerator<N> |
rootGenerator |
protected java.util.Queue<EvaluatedSearchGraphPath<N,A,V>> |
solutions |
protected SuccessorGenerator<N,A> |
successorGenerator |
| Constructor and Description |
|---|
BestFirst(I problem) |
BestFirst(IBestFirstConfig config,
I problem) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterExpansion(Node<N,V> node) |
protected void |
afterInitialization()
BLOCK C: Hooks
|
protected void |
afterSelection(Node<N,V> node) |
protected void |
beforeExpansion(Node<N,V> node) |
protected boolean |
beforeSelection() |
void |
bootstrap(java.util.Collection<Node<N,V>> initialNodes)
This method can be used to create an initial graph different from just root nodes.
|
protected ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent |
expandNextNode()
This method conducts the expansion of the next node.
|
int |
getAdditionalThreadsForExpansion() |
IBestFirstConfig |
getConfig() |
int |
getCreatedCounter() |
java.util.List<N> |
getCurrentPathToNode(N node)
BLOCK D: Getters and Setters
|
int |
getExpandedCounter()
Check how many times a node was expanded.
|
V |
getFValue(N node) |
V |
getFValue(Node<N,V> node) |
Node<N,V> |
getInternalRepresentationOf(N node) |
protected Node<N,V> |
getLocalVersionOfNode(Node<N,V> node)
This is relevant if we work with several copies of a node (usually if we need to copy the search space somewhere).
|
java.lang.String |
getLoggerName() |
java.lang.Object |
getNodeAnnotation(N node,
java.lang.String annotation) |
java.util.Map<java.lang.String,java.lang.Object> |
getNodeAnnotations(N node) |
INodeEvaluator<N,V> |
getNodeEvaluator() |
java.util.List<Node<N,V>> |
getOpen() |
java.util.Queue<EvaluatedSearchGraphPath<N,A,V>> |
getSolutionQueue() |
int |
getTimeoutForComputationOfF() |
protected void |
initGraph()
This method setups the graph by inserting the root nodes.
|
protected void |
insertNodeIntoLocalGraph(Node<N,V> node) |
protected void |
labelNode(Node<N,V> node) |
protected Node<N,V> |
newNode(Node<N,V> parent,
N t2) |
protected Node<N,V> |
newNode(Node<N,V> parent,
N t2,
V evaluation) |
NodeExpansionJobSubmittedEvent<N,A,V> |
nextNodeExpansion() |
EvaluatedSearchGraphPath<N,A,V> |
nextSolutionThatDominatesOpen() |
ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent |
nextWithException() |
void |
onFValueReceivedEvent(FValueEvent<V> event) |
void |
receiveNodeAnnotationEvent(NodeAnnotationEvent<N> event) |
void |
receiveRolloutEvent(RolloutEvent<N,V> event) |
void |
receiveSolutionCandidateAnnotationEvent(SolutionAnnotationEvent<N,A,V> event) |
void |
receiveSolutionCandidateEvent(EvaluatedSearchSolutionCandidateFoundEvent<N,A,V> solutionEvent) |
protected EvaluatedSearchSolutionCandidateFoundEvent<N,A,V> |
registerSolution(EvaluatedSearchGraphPath<N,A,V> solutionPath) |
void |
selectNodeForNextExpansion(N node) |
protected void |
selectNodeForNextExpansion(Node<N,V> node) |
void |
setLoggerName(java.lang.String name) |
void |
setOpen(java.util.Queue<Node<N,V>> collection) |
void |
setTimeoutForComputationOfF(int timeoutInMS,
INodeEvaluator<N,V> timeoutEvaluator) |
protected void |
shutdown() |
java.lang.String |
toString() |
getGraphGenerator, nextSolutionCandidateEventcall, getBestSeenSolution, nextSolutionCandidate, setBestSeenSolution, updateBestSeenSolutioncollectAllSolutionsactivate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, cancel, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getId, getInput, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeouted, iterator, next, post, registerActiveThread, registerListener, resolveShutdownInterruptOnCurrentThread, setConfig, setMaxNumThreads, setNumCPUs, setState, setTimeout, setTimeout, setTimeoutPrecautionOffset, terminate, unregisterActiveThread, unregisterThreadAndShutdownclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnextSolutionCandidateprotected final GraphGenerator<N,A> graphGenerator
protected final RootGenerator<N> rootGenerator
protected final SuccessorGenerator<N,A> successorGenerator
protected final PathGoalTester<N> pathGoalTester
protected final NodeGoalTester<N> nodeGoalTester
protected final INodeEvaluator<N,V extends java.lang.Comparable<V>> nodeEvaluator
protected final boolean checkGoalPropertyOnEntirePath
protected final java.util.Queue<EvaluatedSearchGraphPath<N,A,V extends java.lang.Comparable<V>>> solutions
protected final java.util.Queue<EvaluatedSearchSolutionCandidateFoundEvent<N,A,V extends java.lang.Comparable<V>>> pendingSolutionFoundEvents
protected int additionalThreadsForNodeAttachment
protected final java.util.concurrent.atomic.AtomicInteger activeJobs
public BestFirst(I problem)
public BestFirst(IBestFirstConfig config, I problem)
protected Node<N,V> newNode(Node<N,V> parent, N t2) throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected Node<N,V> newNode(Node<N,V> parent, N t2, V evaluation) throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected void labelNode(Node<N,V> node) throws ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException, ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException, java.lang.InterruptedException, ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmException
ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionjava.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmExceptionprotected void initGraph()
throws ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException,
ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException,
java.lang.InterruptedException,
ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmException
java.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionjava.util.concurrent.TimeoutExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedExceptionprotected void selectNodeForNextExpansion(Node<N,V> node) throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent expandNextNode()
throws java.lang.InterruptedException,
ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException,
ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException,
ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmException
java.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionjava.util.concurrent.TimeoutExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedExceptionprotected EvaluatedSearchSolutionCandidateFoundEvent<N,A,V> registerSolution(EvaluatedSearchGraphPath<N,A,V> solutionPath)
registerSolution in class AOptimalPathInORGraphSearch<I extends GraphSearchWithSubpathEvaluationsInput<N,A,V>,N,A,V extends java.lang.Comparable<V>>protected void shutdown()
shutdown in class ai.libs.jaicore.basic.algorithm.AAlgorithm<I extends GraphSearchWithSubpathEvaluationsInput<N,A,V>,EvaluatedSearchGraphPath<N,A,V extends java.lang.Comparable<V>>>public void receiveSolutionCandidateEvent(EvaluatedSearchSolutionCandidateFoundEvent<N,A,V> solutionEvent)
public void receiveRolloutEvent(RolloutEvent<N,V> event)
public void receiveSolutionCandidateAnnotationEvent(SolutionAnnotationEvent<N,A,V> event)
public void receiveNodeAnnotationEvent(NodeAnnotationEvent<N> event)
protected void insertNodeIntoLocalGraph(Node<N,V> node) throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected Node<N,V> getLocalVersionOfNode(Node<N,V> node)
node - public void bootstrap(java.util.Collection<Node<N,V>> initialNodes) throws java.lang.InterruptedException
initialNodes - java.lang.InterruptedExceptionpublic ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent nextWithException()
throws java.lang.InterruptedException,
ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException,
ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException,
ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmException
java.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmExceptionpublic void selectNodeForNextExpansion(N node) throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic NodeExpansionJobSubmittedEvent<N,A,V> nextNodeExpansion()
public EvaluatedSearchGraphPath<N,A,V> nextSolutionThatDominatesOpen() throws java.lang.InterruptedException, ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException, java.util.concurrent.TimeoutException, ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmException
java.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionjava.util.concurrent.TimeoutExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmExceptionprotected void afterInitialization()
protected boolean beforeSelection()
public java.util.List<N> getCurrentPathToNode(N node)
public INodeEvaluator<N,V> getNodeEvaluator()
public int getAdditionalThreadsForExpansion()
public int getTimeoutForComputationOfF()
public void setTimeoutForComputationOfF(int timeoutInMS,
INodeEvaluator<N,V> timeoutEvaluator)
public void setOpen(java.util.Queue<Node<N,V>> collection)
open - the openCollection to setpublic java.lang.String getLoggerName()
getLoggerName in interface ai.libs.jaicore.basic.ILoggingCustomizablegetLoggerName in class AOptimalPathInORGraphSearch<I extends GraphSearchWithSubpathEvaluationsInput<N,A,V>,N,A,V extends java.lang.Comparable<V>>public void setLoggerName(java.lang.String name)
setLoggerName in interface ai.libs.jaicore.basic.ILoggingCustomizablesetLoggerName in class AOptimalPathInORGraphSearch<I extends GraphSearchWithSubpathEvaluationsInput<N,A,V>,N,A,V extends java.lang.Comparable<V>>public java.util.Queue<EvaluatedSearchGraphPath<N,A,V>> getSolutionQueue()
public int getExpandedCounter()
public int getCreatedCounter()
public java.util.Map<java.lang.String,java.lang.Object> getNodeAnnotations(N node)
public java.lang.Object getNodeAnnotation(N node, java.lang.String annotation)
public void onFValueReceivedEvent(FValueEvent<V> event)
public IBestFirstConfig getConfig()
getConfig in interface ai.libs.jaicore.basic.algorithm.IAlgorithm<I extends GraphSearchWithSubpathEvaluationsInput<N,A,V>,EvaluatedSearchGraphPath<N,A,V extends java.lang.Comparable<V>>>getConfig in class ai.libs.jaicore.basic.algorithm.AAlgorithm<I extends GraphSearchWithSubpathEvaluationsInput<N,A,V>,EvaluatedSearchGraphPath<N,A,V extends java.lang.Comparable<V>>>public java.lang.String toString()
toString in class java.lang.Object