Class MCTS<N,​A>

  • Type Parameters:
    N - Type of states (nodes)
    A - Type of actions
    All Implemented Interfaces:
    java.lang.Iterable<org.api4.java.algorithm.events.IAlgorithmEvent>, java.util.concurrent.Callable<IPolicy<N,​A>>, java.util.Iterator<org.api4.java.algorithm.events.IAlgorithmEvent>, org.api4.java.algorithm.IAlgorithm<IMDP<N,​A,​java.lang.Double>,​IPolicy<N,​A>>, org.api4.java.common.control.ICancelable, org.api4.java.common.control.ILoggingCustomizable, org.api4.java.common.event.IEventEmitter<java.lang.Object>, org.api4.java.common.event.IRelaxedEventEmitter
    Direct Known Subclasses:
    BRUE, DNGMCTS, EnsembleMCTS, FixedCommitmentMCTS, PlackettLuceMCTS, SPUCT, TAGMCTS, UCT, UUCT

    public class MCTS<N,​A>
    extends ai.libs.jaicore.basic.algorithm.AAlgorithm<IMDP<N,​A,​java.lang.Double>,​IPolicy<N,​A>>
    • Constructor Summary

      Constructors 
      Constructor Description
      MCTS​(IMDP<N,​A,​java.lang.Double> input, IPathUpdatablePolicy<N,​A,​java.lang.Double> treePolicy, IPolicy<N,​A> defaultPolicy, int maxIterations, double gamma, double epsilon, boolean tabooExhaustedNodes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IPolicy<N,​A> call()  
      void enforcePrefixPathOnAllRollouts​(org.api4.java.datastructure.graph.ILabeledPath<N,​A> path)  
      org.api4.java.datastructure.graph.ILabeledPath<N,​A> getEnforcedPrefixPath()  
      java.lang.String getLoggerName()  
      int getMsSpentInRollouts()  
      int getMsSpentInTreePolicyQueries()  
      int getMsSpentInTreePolicyUpdates()  
      int getNumberOfNodesInMemory()  
      int getNumberOfRealizedPlayouts()  
      java.util.List<A> getPotentialActions​(org.api4.java.datastructure.graph.ILabeledPath<N,​A> path, java.util.Collection<A> applicableActions)  
      IPathUpdatablePolicy<N,​A,​java.lang.Double> getTreePolicy()  
      boolean hasTreePolicyReachedLeafs()  
      boolean isTabooExhaustedNodes()  
      org.api4.java.algorithm.events.IAlgorithmEvent nextWithException()  
      void setLoggerName​(java.lang.String name)  
      • Methods inherited from class ai.libs.jaicore.basic.algorithm.AAlgorithm

        activate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, cancel, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getConfig, getDeadline, getId, getInput, getListeners, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeoutDefined, 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 java.lang.Iterable

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

        forEachRemaining, remove
    • Constructor Detail

      • MCTS

        public MCTS​(IMDP<N,​A,​java.lang.Double> input,
                    IPathUpdatablePolicy<N,​A,​java.lang.Double> treePolicy,
                    IPolicy<N,​A> defaultPolicy,
                    int maxIterations,
                    double gamma,
                    double epsilon,
                    boolean tabooExhaustedNodes)
    • Method Detail

      • getPotentialActions

        public java.util.List<A> getPotentialActions​(org.api4.java.datastructure.graph.ILabeledPath<N,​A> path,
                                                     java.util.Collection<A> applicableActions)
      • 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
      • getNumberOfRealizedPlayouts

        public int getNumberOfRealizedPlayouts()
      • call

        public IPolicy<N,​A> call()
                                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
      • enforcePrefixPathOnAllRollouts

        public void enforcePrefixPathOnAllRollouts​(org.api4.java.datastructure.graph.ILabeledPath<N,​A> path)
      • getEnforcedPrefixPath

        public org.api4.java.datastructure.graph.ILabeledPath<N,​A> getEnforcedPrefixPath()
      • setLoggerName

        public void setLoggerName​(java.lang.String name)
        Specified by:
        setLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
        Overrides:
        setLoggerName in class ai.libs.jaicore.basic.algorithm.AAlgorithm<IMDP<N,​A,​java.lang.Double>,​IPolicy<N,​A>>
      • hasTreePolicyReachedLeafs

        public boolean hasTreePolicyReachedLeafs()
      • getLoggerName

        public java.lang.String getLoggerName()
        Specified by:
        getLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
        Overrides:
        getLoggerName in class ai.libs.jaicore.basic.algorithm.AAlgorithm<IMDP<N,​A,​java.lang.Double>,​IPolicy<N,​A>>
      • getNumberOfNodesInMemory

        public int getNumberOfNodesInMemory()
      • getMsSpentInRollouts

        public int getMsSpentInRollouts()
      • getMsSpentInTreePolicyQueries

        public int getMsSpentInTreePolicyQueries()
      • getMsSpentInTreePolicyUpdates

        public int getMsSpentInTreePolicyUpdates()
      • isTabooExhaustedNodes

        public boolean isTabooExhaustedNodes()