Record Class SearchAlgorithm.SearchResult<N extends GameTreeNode<N,P>, P extends IGamePosition<P>>

java.lang.Object
java.lang.Record
algorithm.SearchAlgorithm.SearchResult<N,P>
Record Components:
root - a game-tree node at the root position of the original tree. This node should at least contain the updated optimistic and pessimistic values of the root's children nodes, reflecting the updated values as a result of the search.
metrics - a list of metrics to be stored as part of this result. The first MetricKeeper in the list is considered the "main" metrics representing the result described by this object.
Enclosing interface:
SearchAlgorithm

public static record SearchAlgorithm.SearchResult<N extends GameTreeNode<N,P>, P extends IGamePosition<P>>(N extends GameTreeNode<N,P> root, MetricKeeper[] metrics) extends Record
Encapsulates the results and metrics captured from an adversarial tree search.
  • Constructor Details

    • SearchResult

      public SearchResult(N root, MetricKeeper... metrics)
      Creates an instance of a SearchResult record class.
      Parameters:
      root - the value for the root record component
      metrics - the value for the metrics record component
  • Method Details

    • intractable

      public boolean intractable()
      Returns:
      true if the tree resulting from search was terminated for intractability (tree grew too large) rather than for completion of the proof. This is when there is no separation at the root node after search has terminated. false is returned if search terminated normally.
    • complete

      public boolean complete()
      Returns:
      true if the tree resulting from search was terminated through separation. This signifies that the proof has been completed and is therefore valid given the assumption of a valid evaluation function and algorithm used to generate this result. false is returned if the resulting tree has not achieved separation and the proof is likely not (yet) completed.
    • mostOptimisticNodes

      public GameTreeNode.Result<N,P> mostOptimisticNodes()
    • leastPessimisticNodes

      public GameTreeNode.Result<N,P> leastPessimisticNodes()
    • mostOptimisticNode

      public N mostOptimisticNode()
      This is the position with the most optimistic value. However, this may not be the proven best value (if the search did not reach separation) as some other node may have the least pessimistic value (which may guarantee a better value, but may have a lower optimistic value).
      Returns:
      the position with proven most optimistic value.
    • mostOptimisticNodeIndex

      public int mostOptimisticNodeIndex()
      Returns:
      the index of the move returned by mostOptimisticNode()
    • leastPessimisticNode

      public N leastPessimisticNode()
      This is the position with the least pessimistic value. This node guarantees the best minimum return as proven by the search. Some other node may have a higher most optimistic value (if the search did not reach separation), but may not guarantee the same pessimistic value.
      Returns:
      the position with the proven least pessimistic value.
    • leastPessimisticNodeIndex

      public int leastPessimisticNodeIndex()
      Returns:
      the index of the move returned by leastPessimisticNode()
    • bestMove

      public P bestMove()
      Alias for leastPessimisticNode() followed by GameTreeNode.position().

      the tree is intractable, the best position is the least pessimistic position. If the tree is not intractable, leastPessimisticNode() and mostOptimisticNode() return the same value: the best position.

      Returns:
      the position with the proven least pessimistic value (always) and most optimistic value (if separation was reached during the search).
    • bestMoveIndex

      public int bestMoveIndex()
      Returns:
      the index of the best move as returned by bestMove()
    • mainMetrics

      public MetricKeeper mainMetrics()
    • describe

      public String describe()
      Returns:
      A description of the results described by this object. Best used for printing or writing to a file read with a standard text editor.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • root

      public N root()
      Returns the value of the root record component.
      Returns:
      the value of the root record component
    • metrics

      public MetricKeeper[] metrics()
      Returns the value of the metrics record component.
      Returns:
      the value of the metrics record component