Interface Generator<T,S>

Type Parameters:
T - The output type, this is what is being generated
S - 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.

@FunctionalInterface public interface Generator<T,S>
A generator for customising the tree structure of artificial game trees made with the VariantAGP class.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    The generator type specifically used for generating the bounds of the children generated as the children of each node of a VariantAGP artificial game tree.
    static interface 
    The generator type specifically used for generating the variable branching factor at each node of a VariantAGP artificial game tree.
  • Method Summary

    Modifier and Type
    Method
    Description
    DEFAULT(int num_alts)
    Generates nodes with the same distribution as ArtificialGamePosition with the supplied num_alts variable.
    generate(Random r, S params)
    Generate the output value of type T with the random number generator r and the input params of type S.
    MAXDEPTH(int maxDepth, Generator.Bounds generator)
    Generates according to the supplied generator, unless the parent's depth is above or equal to the maxDepth.
    MAXRANGE(long maxRange, Generator.Bounds generator)
    Creates a modified generator which does not produce nodes with a range beyond the provided maxRange.
    MINRANGE(long minRange, Generator.Bounds generator)
    Generates according to the supplied generator, unless the parent's range is lower than or equal to the minRange.
    STEADY_SHRINK(long minShrink, long maxShrink)
    Generates nodes with a fixed range defined as the parent's range minus a random variable.
  • Method Details

    • generate

      T generate(Random r, S params)
      Generate the output value of type T with the random number generator r and the input params of type S.
      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 params and deterministically, pseudo-randomly, seeded only by the provided randomiser r.
    • DEFAULT

      static Generator.Bounds DEFAULT(int num_alts)
      Generates nodes with the same distribution as ArtificialGamePosition with the supplied num_alts variable. Bounds are the minimum and maximum of a list of num_alts random variables within the parent's bounds or beyond it (with a growth factor greater than 1).
      Parameters:
      num_alts - See ArtificialGamePosition.Settings.num_alts.
      Returns:
      The described generator.
    • STEADY_SHRINK

      static Generator.Bounds STEADY_SHRINK(long minShrink, long maxShrink)
      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

      static Generator.Bounds MINRANGE(long minRange, Generator.Bounds generator)
      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

      static Generator.Bounds MAXDEPTH(int maxDepth, Generator.Bounds generator)
      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

      static Generator.Bounds MAXRANGE(long maxRange, Generator.Bounds generator)
      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.