Interface Generator.Width

Enclosing interface:
Generator<T,S>
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 static interface Generator.Width
The generator type specifically used for generating the variable branching factor at each node of a VariantAGP artificial game tree.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Generator.Width
    A default generator which always returns the maximum branching factor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    generate(Random r, int min_allowed, int max_allowed, long current_depth)
    Generates a random branching factor for one node given the provided parameters.
  • Field Details

    • FIXED

      static final Generator.Width FIXED
      A default generator which always returns the maximum branching factor.
  • Method Details

    • generate

      int generate(Random r, int min_allowed, int max_allowed, long current_depth)
      Generates a random branching factor for one node given the provided parameters.

      If it is desired to produce fewer than the minimum allowed number of children, to terminate the tree at this node, then it is advised to instead program this into the Generator.Bounds generator. The correct termination of nodes should occur when their lower and upper bounds are equal, and thus should not occur when this is not the case. The Generator.Width generator is only ever called on nodes which are not already terminal nodes, so they should have at least 1 child.

      Parameters:
      r - The random number generator to use, this should be the only source of randomness in any implementation of this method.
      min_allowed - The minimum allowed output, this is the minimum branching factor, typically 1. The output should not be below this value.
      max_allowed - The maximum allowed output, this is the maximum branching factor. The output should not be above this value, or risk unpredictable seed overlapping behaviour.
      current_depth - The depth of the current node, for which this generator returns the number of children to generate.
      Returns:
      The number of children to generate for this node.