Class MCTSPathSearch<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,A,V>,N,A,V extends java.lang.Comparable<V>>
- java.lang.Object
-
- ai.libs.jaicore.basic.algorithm.AAlgorithm<I,O>
-
- ai.libs.jaicore.basic.algorithm.ASolutionCandidateIterator<I,O>
-
- ai.libs.jaicore.basic.algorithm.AOptimizer<I,EvaluatedSearchGraphPath<N,A,V>,V>
-
- ai.libs.jaicore.search.core.interfaces.AOptimalPathInORGraphSearch<I,N,A,V>
-
- ai.libs.jaicore.search.algorithms.standard.mcts.MCTSPathSearch<I,N,A,V>
-
- All Implemented Interfaces:
IPolicy<N,A,V>,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
- Direct Known Subclasses:
BRUEPathSearch,DNGMCTSPathSearch,EnsembleMCTSPathSearch,FixedCommitmentMCTSPathSearch,PlackettLuceMCTSPathSearch,SPUCTPathSearch,TAGMCTSPathSearch,UCTPathSearch
public class MCTSPathSearch<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> implements IPolicy<N,A,V>
MCTS algorithm implementation. This implementation follows the description in Browne, Cb AND Powley, Edward - A survey of monte carlo tree search methods (2012)
-
-
Field Summary
Fields Modifier and Type Field Description protected IPolicy<N,A,V>defaultPolicyprotected ai.libs.jaicore.graph.LabeledGraph<N,A>exploredGraphprotected org.api4.java.ai.graphsearch.problem.implicit.graphgenerator.IPathGoalTester<N,A>goalTesterprotected org.api4.java.datastructure.graph.implicit.IGraphGenerator<N,A>graphGeneratorprotected java.util.Map<N,org.api4.java.datastructure.graph.implicit.ILazySuccessorGenerator<N,A>>lazySuccessorGeneratorsprotected org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<N,A>,V>playoutSimulatorprotected org.api4.java.datastructure.graph.implicit.IRootGenerator<N>rootGeneratorprotected org.api4.java.datastructure.graph.implicit.ISuccessorGenerator<N,A>successorGeneratorprotected IPathUpdatablePolicy<N,A,V>treePolicyprotected booleanuseLazySuccessorGeneration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenforcePrefixPathOnAllRollouts(org.api4.java.datastructure.graph.ILabeledPath<N,A> path)AgetAction(N node, java.util.Map<A,N> actionsWithSuccessors)IPolicy<N,A,V>getDefaultPolicy()java.lang.StringgetLoggerName()intgetNumberOfNodesInMemory()intgetNumberOfPlayouts()org.api4.java.datastructure.graph.ILabeledPath<N,A>getSubPathUpToDeepestRegisteredNode(org.api4.java.datastructure.graph.ILabeledPath<N,A> path)IPathUpdatablePolicy<N,A,V>getTreePolicy()booleanhasTreePolicyReachedLeafs()org.api4.java.algorithm.events.IAlgorithmEventnextWithException()voidsetLoggerName(java.lang.String name)-
Methods inherited from class ai.libs.jaicore.search.core.interfaces.AOptimalPathInORGraphSearch
getGoalTester, getGraphGenerator, nextSolutionCandidateEvent, registerSolution
-
Methods inherited from class ai.libs.jaicore.basic.algorithm.AOptimizer
call, getBestSeenSolution, nextSolutionCandidate, setBestSeenSolution, 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, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, 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
-
-
-
-
Field Detail
-
graphGenerator
protected final org.api4.java.datastructure.graph.implicit.IGraphGenerator<N,A> graphGenerator
-
rootGenerator
protected final org.api4.java.datastructure.graph.implicit.IRootGenerator<N> rootGenerator
-
successorGenerator
protected final org.api4.java.datastructure.graph.implicit.ISuccessorGenerator<N,A> successorGenerator
-
goalTester
protected final org.api4.java.ai.graphsearch.problem.implicit.graphgenerator.IPathGoalTester<N,A> goalTester
-
useLazySuccessorGeneration
protected final boolean useLazySuccessorGeneration
-
lazySuccessorGenerators
protected final java.util.Map<N,org.api4.java.datastructure.graph.implicit.ILazySuccessorGenerator<N,A>> lazySuccessorGenerators
-
treePolicy
protected final IPathUpdatablePolicy<N,A,V extends java.lang.Comparable<V>> treePolicy
-
playoutSimulator
protected final org.api4.java.common.attributedobjects.IObjectEvaluator<org.api4.java.datastructure.graph.ILabeledPath<N,A>,V extends java.lang.Comparable<V>> playoutSimulator
-
-
Method Detail
-
getAction
public A getAction(N node, java.util.Map<A,N> actionsWithSuccessors) throws ActionPredictionFailedException
-
nextWithException
public org.api4.java.algorithm.events.IAlgorithmEvent nextWithException() throws java.lang.InterruptedException, org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException, org.api4.java.algorithm.exceptions.AlgorithmException, org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException- Specified by:
nextWithExceptionin interfaceorg.api4.java.algorithm.IAlgorithm<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,A,V>,N>- Throws:
java.lang.InterruptedExceptionorg.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledExceptionorg.api4.java.algorithm.exceptions.AlgorithmExceptionorg.api4.java.algorithm.exceptions.AlgorithmTimeoutedException
-
getSubPathUpToDeepestRegisteredNode
public org.api4.java.datastructure.graph.ILabeledPath<N,A> getSubPathUpToDeepestRegisteredNode(org.api4.java.datastructure.graph.ILabeledPath<N,A> path)
-
getLoggerName
public java.lang.String getLoggerName()
- Specified by:
getLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable- Overrides:
getLoggerNamein classAOptimalPathInORGraphSearch<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,A,V>,N,A,V extends java.lang.Comparable<V>>
-
setLoggerName
public void setLoggerName(java.lang.String name)
- Specified by:
setLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable- Overrides:
setLoggerNamein classAOptimalPathInORGraphSearch<I extends org.api4.java.ai.graphsearch.problem.IPathSearchWithPathEvaluationsInput<N,A,V>,N,A,V extends java.lang.Comparable<V>>
-
getNumberOfPlayouts
public int getNumberOfPlayouts()
-
getTreePolicy
public IPathUpdatablePolicy<N,A,V> getTreePolicy()
-
enforcePrefixPathOnAllRollouts
public void enforcePrefixPathOnAllRollouts(org.api4.java.datastructure.graph.ILabeledPath<N,A> path)
-
getNumberOfNodesInMemory
public int getNumberOfNodesInMemory()
-
hasTreePolicyReachedLeafs
public boolean hasTreePolicyReachedLeafs()
-
-