Interface Generator<T,S>
- Type Parameters:
T- The output type, this is what is being generatedS- The input type, this is what parameters are provided to this generator
- All Known Subinterfaces:
Generator.Bounds
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A generator for customising the tree structure of artificial game trees made with the
VariantAGP class.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe generator type specifically used for generating the bounds of the children generated as the children of each node of aVariantAGPartificial game tree.static interfaceThe generator type specifically used for generating the variable branching factor at each node of aVariantAGPartificial game tree. -
Method Summary
Modifier and TypeMethodDescriptionstatic Generator.BoundsDEFAULT(int num_alts) Generates nodes with the same distribution asArtificialGamePositionwith the suppliednum_altsvariable.Generate the output value of typeTwith the random number generatorrand the inputparamsof typeS.static Generator.BoundsMAXDEPTH(int maxDepth, Generator.Bounds generator) Generates according to the supplied generator, unless the parent's depth is above or equal to the maxDepth.static Generator.BoundsMAXRANGE(long maxRange, Generator.Bounds generator) Creates a modified generator which does not produce nodes with a range beyond the provided maxRange.static Generator.BoundsMINRANGE(long minRange, Generator.Bounds generator) Generates according to the supplied generator, unless the parent's range is lower than or equal to the minRange.static Generator.BoundsSTEADY_SHRINK(long minShrink, long maxShrink) Generates nodes with a fixed range defined as the parent's range minus a random variable.
-
Method Details
-
generate
Generate the output value of typeTwith the random number generatorrand the inputparamsof typeS.- Parameters:
r- The random number generator to use, this should be the only source of randomness in any implementation of this method.params- The input parameteres identifying all information available to the generator. This is the only information the generator has to base its output on.- Returns:
- A generated value, which may be constant, based on the
paramsand deterministically, pseudo-randomly, seeded only by the provided randomiserr.
-
DEFAULT
Generates nodes with the same distribution asArtificialGamePositionwith the suppliednum_altsvariable. Bounds are the minimum and maximum of a list ofnum_altsrandom variables within the parent's bounds or beyond it (with a growth factor greater than 1).- Parameters:
num_alts- SeeArtificialGamePosition.Settings.num_alts.- Returns:
- The described generator.
-
STEADY_SHRINK
Generates nodes with a fixed range defined as the parent's range minus a random variable.- Parameters:
minShrink- The minimum amount of shrinking per depth of the tree (in evaluation function value units)maxShrink- The maximum amount of shrinking per depth of the tree (in evaluation function value units)- Returns:
- The described generator.
-
MINRANGE
Generates according to the supplied generator, unless the parent's range is lower than or equal to the minRange. In which case the children will all be generated as terminal nodes, with at least one within the parent's range.- Parameters:
minRange- The minimum range for non-terminal nodes in the tree.generator- The base generator to apply when conditions are not met.- Returns:
- The described generator.
-
MAXDEPTH
Generates according to the supplied generator, unless the parent's depth is above or equal to the maxDepth. In which case, the children will all be generated as terminal nodes, with at least one within the parent's range.- Parameters:
maxDepth- Maximum depth of the tree, for which any nodes beyond it are all terminal nodes.generator- The base generator to apply when conditions are not met.- Returns:
- The described generator.
-
MAXRANGE
Creates a modified generator which does not produce nodes with a range beyond the provided maxRange. It does so in the simplest possible way, by effectively setting a limit on the effects of the growth factor. It does not modify how values are generated, only which bounds are provided to the base generator.- Parameters:
maxRange- The maximum range of nodes of the tree.generator- The base generator to modify.- Returns:
- The described generator.
-