Class TimeAwareNodeEvaluator<T,A,V extends java.lang.Comparable<V>>
- java.lang.Object
-
- ai.libs.jaicore.search.algorithms.standard.bestfirst.nodeevaluation.TimeAwareNodeEvaluator<T,A,V>
-
- Type Parameters:
T-V-
- All Implemented Interfaces:
org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,A,V>,org.api4.java.common.attributedobjects.IGetter<org.api4.java.datastructure.graph.ILabeledPath<T,A>,V>,org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<T,A>,V>,org.api4.java.common.control.ILoggingCustomizable
- Direct Known Subclasses:
RandomCompletionBasedNodeEvaluator
public abstract class TimeAwareNodeEvaluator<T,A,V extends java.lang.Comparable<V>> extends java.lang.Object implements org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,A,V>, org.api4.java.common.control.ILoggingCustomizableThis class can be used to create node evaluators with a time limit for the evaluation of each node. The remaining time for the evaluation of the node is given with the call of f. The thread will be interrupted after the timeout if it has not returned control in time.
-
-
Constructor Summary
Constructors Constructor Description TimeAwareNodeEvaluator(int pTimeoutInMS)TimeAwareNodeEvaluator(int pTimeoutInMS, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,A,V> pFallbackNodeEvaluator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckInterruption()Vevaluate(org.api4.java.datastructure.graph.ILabeledPath<T,A> path)protected abstract VevaluateTimeouted(org.api4.java.datastructure.graph.ILabeledPath<T,A> node, int timeoutInMS)org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,A,V>getFallbackNodeEvaluator()java.lang.StringgetLoggerName()intgetTimeoutForNodeEvaluationInMS()longgetTotalDeadline()voidsetLoggerName(java.lang.String name)voidsetTotalDeadline(long totalDeadline)
-
-
-
Method Detail
-
evaluateTimeouted
protected abstract V evaluateTimeouted(org.api4.java.datastructure.graph.ILabeledPath<T,A> node, int timeoutInMS) throws org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationException, java.lang.InterruptedException
- Throws:
org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationExceptionjava.lang.InterruptedException
-
evaluate
public final V evaluate(org.api4.java.datastructure.graph.ILabeledPath<T,A> path) throws org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationException, java.lang.InterruptedException
- Specified by:
evaluatein interfaceorg.api4.java.common.attributedobjects.IObjectEvaluator<T,A>- Specified by:
evaluatein interfaceorg.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,A,V extends java.lang.Comparable<V>>- Throws:
org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationExceptionjava.lang.InterruptedException
-
getTimeoutForNodeEvaluationInMS
public int getTimeoutForNodeEvaluationInMS()
-
getFallbackNodeEvaluator
public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,A,V> getFallbackNodeEvaluator()
-
getTotalDeadline
public long getTotalDeadline()
-
setTotalDeadline
public void setTotalDeadline(long totalDeadline)
-
checkInterruption
protected void checkInterruption() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
setLoggerName
public void setLoggerName(java.lang.String name)
- Specified by:
setLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable
-
getLoggerName
public java.lang.String getLoggerName()
- Specified by:
getLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable
-
-