Class IteratingGraphSearchOptimizer<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,​A,​V>,​N,​A,​V extends java.lang.Comparable<V>>

  • Type Parameters:
    I -
    N -
    A -
    V -
    All Implemented Interfaces:
    java.lang.Iterable<org.api4.java.algorithm.events.IAlgorithmEvent>, java.util.concurrent.Callable<EvaluatedSearchGraphPath<N,​A,​V>>, java.util.Iterator<org.api4.java.algorithm.events.IAlgorithmEvent>, org.api4.java.ai.graphsearch.problem.IOptimalPathInORGraphSearch<I,​EvaluatedSearchGraphPath<N,​A,​V>,​N,​A,​V>, org.api4.java.ai.graphsearch.problem.IPathInORGraphSearch<I,​EvaluatedSearchGraphPath<N,​A,​V>,​N,​A>, org.api4.java.ai.graphsearch.problem.IPathSearch<I,​EvaluatedSearchGraphPath<N,​A,​V>,​N,​A>, org.api4.java.algorithm.IAlgorithm<I,​EvaluatedSearchGraphPath<N,​A,​V>>, org.api4.java.algorithm.IOptimizationAlgorithm<I,​EvaluatedSearchGraphPath<N,​A,​V>,​V>, org.api4.java.algorithm.ISolutionCandidateIterator<I,​EvaluatedSearchGraphPath<N,​A,​V>>, org.api4.java.common.control.ICancelable, org.api4.java.common.control.ILoggingCustomizable

    public class IteratingGraphSearchOptimizer<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,​A,​V>,​N,​A,​V extends java.lang.Comparable<V>>
    extends AOptimalPathInORGraphSearch<I,​N,​A,​V>
    This is a wrapper class to turn non-optimization algorithms into (uninformed working) optimizers. The algorithm just iterates over all solutions, evaluates them with the given scoring function and eventually returns the best scored solution.
    • Constructor Summary

      Constructors 
      Constructor Description
      IteratingGraphSearchOptimizer​(I problem, org.api4.java.ai.graphsearch.problem.IPathSearch<org.api4.java.ai.graphsearch.problem.IPathSearchInput<N,​A>,​SearchGraphPath<N,​A>,​N,​A> baseAlgorithm)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.api4.java.ai.graphsearch.problem.IPathSearch<org.api4.java.ai.graphsearch.problem.IPathSearchInput<N,​A>,​SearchGraphPath<N,​A>,​N,​A> getBaseAlgorithm()  
      boolean hasNext()  
      org.api4.java.algorithm.events.IAlgorithmEvent nextWithException()  
      • Methods inherited from class ai.libs.jaicore.basic.algorithm.AOptimizer

        call, getBestScoreKnownToExist, getBestSeenSolution, nextSolutionCandidate, setBestSeenSolution, tellAboutBestScoreKnownToExist, updateBestSeenSolution
      • Methods inherited from class ai.libs.jaicore.basic.algorithm.ASolutionCandidateIterator

        collectAllSolutions
      • Methods inherited from class ai.libs.jaicore.basic.algorithm.AAlgorithm

        activate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, cancel, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getConfig, getId, getInput, getListeners, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeouted, iterator, next, post, registerActiveThread, registerListener, resolveShutdownInterruptOnCurrentThread, setConfig, setDeadline, setMaxNumThreads, setNumCPUs, setState, setTimeout, setTimeout, setTimeoutPrecautionOffset, shutdown, terminate, unregisterActiveThread, unregisterThreadAndShutdown
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.api4.java.algorithm.IAlgorithm

        call, getConfig, getId, getInput, getNumCPUs, getTimeout, registerListener, setMaxNumThreads, setNumCPUs, setTimeout, setTimeout
      • Methods inherited from interface org.api4.java.common.control.ICancelable

        cancel
      • Methods inherited from interface org.api4.java.algorithm.ISolutionCandidateIterator

        nextSolutionCandidate
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, next, remove
    • Constructor Detail

      • IteratingGraphSearchOptimizer

        public IteratingGraphSearchOptimizer​(I problem,
                                             org.api4.java.ai.graphsearch.problem.IPathSearch<org.api4.java.ai.graphsearch.problem.IPathSearchInput<N,​A>,​SearchGraphPath<N,​A>,​N,​A> baseAlgorithm)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,​A,​V>>
        Overrides:
        hasNext in class ai.libs.jaicore.basic.algorithm.AAlgorithm<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,​A,​V>,​EvaluatedSearchGraphPath<N,​A,​V extends java.lang.Comparable<V>>>
      • nextWithException

        public org.api4.java.algorithm.events.IAlgorithmEvent nextWithException()
                                                                         throws java.lang.InterruptedException,
                                                                                org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException,
                                                                                org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException,
                                                                                org.api4.java.algorithm.exceptions.AlgorithmException
        Throws:
        java.lang.InterruptedException
        org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException
        org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException
        org.api4.java.algorithm.exceptions.AlgorithmException
      • getBaseAlgorithm

        public org.api4.java.ai.graphsearch.problem.IPathSearch<org.api4.java.ai.graphsearch.problem.IPathSearchInput<N,​A>,​SearchGraphPath<N,​A>,​N,​A> getBaseAlgorithm()