Class RandomCompletionBasedNodeEvaluator<T,​A,​V extends java.lang.Comparable<V>>

  • All Implemented Interfaces:
    org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.ICancelablePathEvaluator, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPathEvaluator<T,​A,​V>, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyGraphDependentPathEvaluator<T,​A,​V>, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallySolutionReportingPathEvaluator<T,​A,​V>, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyUncertaintyAnnotatingPathEvaluator<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

    public class RandomCompletionBasedNodeEvaluator<T,​A,​V extends java.lang.Comparable<V>>
    extends TimeAwareNodeEvaluator<T,​A,​V>
    implements org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyGraphDependentPathEvaluator<T,​A,​V>, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallySolutionReportingPathEvaluator<T,​A,​V>, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.ICancelablePathEvaluator, org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyUncertaintyAnnotatingPathEvaluator<T,​A,​V>, org.api4.java.common.control.ILoggingCustomizable
    • Field Detail

      • unsuccessfulPaths

        protected java.util.Set<java.util.List<T>> unsuccessfulPaths
      • postedSolutions

        protected java.util.Set<org.api4.java.datastructure.graph.ILabeledPath<T,​A>> postedSolutions
      • timesToComputeEvaluations

        protected java.util.Map<java.util.List<T>,​java.lang.Integer> timesToComputeEvaluations
      • scoresOfSolutionPaths

        protected java.util.Map<java.util.List<T>,​V extends java.lang.Comparable<V>> scoresOfSolutionPaths
      • fValues

        protected java.util.Map<org.api4.java.datastructure.graph.ILabeledPath<T,​A>,​V extends java.lang.Comparable<V>> fValues
      • ppFails

        protected java.util.Map<java.lang.String,​java.lang.Integer> ppFails
      • plFails

        protected java.util.Map<java.lang.String,​java.lang.Integer> plFails
      • plSuccesses

        protected java.util.Map<java.lang.String,​java.lang.Integer> plSuccesses
      • root

        protected T root
      • generator

        protected org.api4.java.datastructure.graph.implicit.IGraphGenerator<T,​A> generator
      • goalTester

        protected org.api4.java.ai.graphsearch.problem.implicit.graphgenerator.IPathGoalTester<T,​A> goalTester
      • timestampOfFirstEvaluation

        protected long timestampOfFirstEvaluation
      • random

        protected final java.util.Random random
      • desiredNumberOfSuccesfulSamples

        protected final int desiredNumberOfSuccesfulSamples
      • maxSamples

        protected final int maxSamples
      • solutionEvaluator

        protected final org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<T,​A>,​V extends java.lang.Comparable<V>> solutionEvaluator
      • uncertaintySource

        protected org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IUncertaintySource<T,​A,​V extends java.lang.Comparable<V>> uncertaintySource
    • Constructor Detail

      • RandomCompletionBasedNodeEvaluator

        public RandomCompletionBasedNodeEvaluator​(java.util.Random random,
                                                  int samples,
                                                  org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<T,​A>,​V> solutionEvaluator)
      • RandomCompletionBasedNodeEvaluator

        public RandomCompletionBasedNodeEvaluator​(java.util.Random random,
                                                  int desiredNumberOfSuccessfulSamples,
                                                  int maxSamples,
                                                  org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<T,​A>,​V> solutionEvaluator)
      • RandomCompletionBasedNodeEvaluator

        public RandomCompletionBasedNodeEvaluator​(java.util.Random random,
                                                  int desiredNumberOfSuccessfulSamples,
                                                  int maxSamples,
                                                  org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<T,​A>,​V> solutionEvaluator,
                                                  int timeoutForSingleCompletionEvaluationInMS,
                                                  int timeoutForNodeEvaluationInMS)
      • RandomCompletionBasedNodeEvaluator

        public RandomCompletionBasedNodeEvaluator​(java.util.Random random,
                                                  int desiredNumberOfSuccessfulSamples,
                                                  int maxSamples,
                                                  org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<T,​A>,​V> solutionEvaluator,
                                                  int timeoutForSingleCompletionEvaluationInMS,
                                                  int timeoutForNodeEvaluationInMS,
                                                  java.util.function.Predicate<T> priorityPredicateForRDFS)
    • Method Detail

      • evaluateTimeouted

        protected V evaluateTimeouted​(org.api4.java.datastructure.graph.ILabeledPath<T,​A> path,
                                      int timeout)
                               throws java.lang.InterruptedException,
                                      org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationException
        Specified by:
        evaluateTimeouted in class TimeAwareNodeEvaluator<T,​A,​V extends java.lang.Comparable<V>>
        Throws:
        java.lang.InterruptedException
        org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationException
      • getFValueOfSolutionPath

        protected V getFValueOfSolutionPath​(org.api4.java.datastructure.graph.ILabeledPath<T,​A> path)
                                     throws java.lang.InterruptedException,
                                            org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationException
        Throws:
        java.lang.InterruptedException
        org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.PathEvaluationException
      • postSolution

        protected void postSolution​(org.api4.java.datastructure.graph.ILabeledPath<T,​A> solution)
      • setGenerator

        public void setGenerator​(org.api4.java.datastructure.graph.implicit.IGraphGenerator<T,​A> generator,
                                 org.api4.java.ai.graphsearch.problem.implicit.graphgenerator.IPathGoalTester<T,​A> goalTester)
        Specified by:
        setGenerator in interface org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyGraphDependentPathEvaluator<T,​A,​V extends java.lang.Comparable<V>>
      • registerSolutionListener

        public void registerSolutionListener​(java.lang.Object listener)
        Specified by:
        registerSolutionListener in interface org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallySolutionReportingPathEvaluator<T,​A,​V extends java.lang.Comparable<V>>
      • cancelActiveTasks

        public void cancelActiveTasks()
        Specified by:
        cancelActiveTasks in interface org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.ICancelablePathEvaluator
      • setUncertaintySource

        public void setUncertaintySource​(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IUncertaintySource<T,​A,​V> uncertaintySource)
        Specified by:
        setUncertaintySource in interface org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyUncertaintyAnnotatingPathEvaluator<T,​A,​V extends java.lang.Comparable<V>>
      • getSolutionEvaluator

        public org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<T,​A>,​V> getSolutionEvaluator()
      • isVisualizeSubSearch

        public boolean isVisualizeSubSearch()
      • setVisualizeSubSearch

        public void setVisualizeSubSearch​(boolean visualizeSubSearch)
      • setLoggerName

        public void setLoggerName​(java.lang.String name)
        Specified by:
        setLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
        Overrides:
        setLoggerName in class TimeAwareNodeEvaluator<T,​A,​V extends java.lang.Comparable<V>>
      • getLoggerName

        public java.lang.String getLoggerName()
        Specified by:
        getLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
        Overrides:
        getLoggerName in class TimeAwareNodeEvaluator<T,​A,​V extends java.lang.Comparable<V>>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • requiresGraphGenerator

        public boolean requiresGraphGenerator()
        Specified by:
        requiresGraphGenerator in interface org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyGraphDependentPathEvaluator<T,​A,​V extends java.lang.Comparable<V>>
      • reportsSolutions

        public boolean reportsSolutions()
        Specified by:
        reportsSolutions in interface org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallySolutionReportingPathEvaluator<T,​A,​V extends java.lang.Comparable<V>>
      • annotatesUncertainty

        public boolean annotatesUncertainty()
        Specified by:
        annotatesUncertainty in interface org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IPotentiallyUncertaintyAnnotatingPathEvaluator<T,​A,​V extends java.lang.Comparable<V>>