Class TimeAwareNodeEvaluator<T,​A,​V extends java.lang.Comparable<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.ILoggingCustomizable
    This 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 Detail

      • TimeAwareNodeEvaluator

        public TimeAwareNodeEvaluator​(int pTimeoutInMS)
      • TimeAwareNodeEvaluator

        public TimeAwareNodeEvaluator​(int pTimeoutInMS,
                                      org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,​A,​V> pFallbackNodeEvaluator)
    • 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.PathEvaluationException
        java.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:
        evaluate in interface org.api4.java.common.attributedobjects.IObjectEvaluator<T,​A>
        Specified by:
        evaluate in interface org.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.PathEvaluationException
        java.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:
        setLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
      • getLoggerName

        public java.lang.String getLoggerName()
        Specified by:
        getLoggerName in interface org.api4.java.common.control.ILoggingCustomizable