Class DNGPolicy<N,A>
- java.lang.Object
-
- ai.libs.jaicore.search.algorithms.standard.mcts.thompson.DNGPolicy<N,A>
-
- Type Parameters:
N-A-
- All Implemented Interfaces:
IPathUpdatablePolicy<N,A,java.lang.Double>,IPolicy<N,A,java.lang.Double>,org.api4.java.common.control.ILoggingCustomizable,org.api4.java.common.event.IEventEmitter<java.lang.Object>,org.api4.java.common.event.IRelaxedEventEmitter
public class DNGPolicy<N,A> extends java.lang.Object implements IPathUpdatablePolicy<N,A,java.lang.Double>, org.api4.java.common.control.ILoggingCustomizable, org.api4.java.common.event.IRelaxedEventEmitter
This is a slightly simplified implementation of the algorithm presented in
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgetAction(N node, java.util.Map<A,N> actionsWithSuccessors)java.lang.StringgetLoggerName()doublegetQValue(N state, N successorState)In the deterministic case (and when transitions are clear), without discounts, and inner rewards = 0, the QValue function in the paper degenerates to just returning the value of the successor state of the given state.doublegetValue(N state)The Value procedure of the papervoidregisterListener(java.lang.Object listener)ai.libs.jaicore.basic.sets.Pair<java.lang.Double,java.lang.Double>sampleWithNormalGamma(N state)AsampleWithThompson(N state, java.util.Map<A,N> actions)The ThompsonSampling procedure of the papervoidsetLoggerName(java.lang.String name)voidupdatePath(org.api4.java.datastructure.graph.ILabeledPath<N,A> path, java.lang.Double playoutScore, int lengthOfPlayoutPath)
-
-
-
Method Detail
-
getAction
public A getAction(N node, java.util.Map<A,N> actionsWithSuccessors) throws ActionPredictionFailedException
- Specified by:
getActionin interfaceIPolicy<N,A,java.lang.Double>- Throws:
ActionPredictionFailedException
-
updatePath
public void updatePath(org.api4.java.datastructure.graph.ILabeledPath<N,A> path, java.lang.Double playoutScore, int lengthOfPlayoutPath)
- Specified by:
updatePathin interfaceIPathUpdatablePolicy<N,A,java.lang.Double>
-
sampleWithThompson
public A sampleWithThompson(N state, java.util.Map<A,N> actions) throws org.api4.java.common.attributedobjects.ObjectEvaluationFailedException, java.lang.InterruptedException
The ThompsonSampling procedure of the paper- Parameters:
state-actions-- Returns:
- Throws:
java.lang.InterruptedExceptionorg.api4.java.common.attributedobjects.ObjectEvaluationFailedException
-
getQValue
public double getQValue(N state, N successorState) throws org.api4.java.common.attributedobjects.ObjectEvaluationFailedException, java.lang.InterruptedException
In the deterministic case (and when transitions are clear), without discounts, and inner rewards = 0, the QValue function in the paper degenerates to just returning the value of the successor state of the given state.- Parameters:
state- This is not needed and may be null; is rather for documentation here.successorState-- Returns:
- Throws:
java.lang.InterruptedExceptionorg.api4.java.common.attributedobjects.ObjectEvaluationFailedException
-
sampleWithNormalGamma
public ai.libs.jaicore.basic.sets.Pair<java.lang.Double,java.lang.Double> sampleWithNormalGamma(N state)
-
getValue
public double getValue(N state) throws org.api4.java.common.attributedobjects.ObjectEvaluationFailedException, java.lang.InterruptedException
The Value procedure of the paper- Returns:
- Throws:
java.lang.InterruptedExceptionorg.api4.java.common.attributedobjects.ObjectEvaluationFailedException
-
getLoggerName
public java.lang.String getLoggerName()
- Specified by:
getLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable
-
setLoggerName
public void setLoggerName(java.lang.String name)
- Specified by:
setLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable
-
registerListener
public void registerListener(java.lang.Object listener)
- Specified by:
registerListenerin interfaceorg.api4.java.common.event.IEventEmitter<N>
-
-