chipiron.players.move_selector.treevalue.indices.node_indices package

Submodules

chipiron.players.move_selector.treevalue.indices.node_indices.factory module

This module provides functions for creating exploration index data for tree nodes.

The main function in this module is create_exploration_index_data, which takes a tree node and optional parameters to create the exploration index data for that node.

The module also defines the ExplorationIndexDataFactory type, which is a callable type for creating exploration index data.

Functions: - create_exploration_index_data: Creates exploration index data for a given tree node.

Types: - ExplorationIndexDataFactory: A callable type for creating exploration index data.

chipiron.players.move_selector.treevalue.indices.node_indices.factory.create_exploration_index_data(tree_node: TreeNode[Any], index_computation: IndexComputationType | None = None, depth_index: bool = False) NodeExplorationData | None[source]

Creates exploration index data for a given tree node.

Parameters:
  • tree_node (TreeNode) – The tree node for which to create the exploration index data.

  • index_computation (IndexComputationType | None, optional) – The type of index computation to use. Defaults to None.

  • depth_index (bool, optional) – Whether to include depth information in the index data. Defaults to False.

Returns:

The created exploration index data.

Return type:

NodeExplorationData | None

Raises:

ValueError – If the index_computation value is not recognized.

chipiron.players.move_selector.treevalue.indices.node_indices.index_data module

Module that contains the classes for the exploration data of a tree node.

class chipiron.players.move_selector.treevalue.indices.node_indices.index_data.IntervalExplo(tree_node: TreeNode[ITreeNode[Any]], index: float | None = None, interval: ~chipiron.utils.small_tools.Interval | None = <factory>)[source]

Bases: NodeExplorationData

Represents the exploration data for a tree node with an interval.

interval

The interval associated with the node. Defaults to None.

Type:

Interval | None

dot_description()[source]

Returns a string representation of the exploration data for dot visualization.

dot_description() str[source]

Returns a string representation of the interval values.

If the interval is None, returns ‘None’. Otherwise, returns a string in the format ‘min_interval_value: {min_value}, max_interval_value: {max_value}’.

Returns:

A string representation of the interval values.

Return type:

str

interval: Interval | None
class chipiron.players.move_selector.treevalue.indices.node_indices.index_data.MaxDepthDescendants(tree_node: TreeNode[ITreeNode[Any]], index: float | None = None, max_depth_descendants: int = 0)[source]

Bases: NodeExplorationData

Represents the exploration data for a tree node with maximum depth of descendants.

dot_description() str[source]

Returns a string representation of the dot description for the node indices.

Returns:

The dot description for the node indices.

Return type:

str

max_depth_descendants: int = 0
update_from_child(child_max_depth_descendants: int) bool[source]

Updates the max_depth_descendants value based on the child’s max_depth_descendants.

Parameters:

child_max_depth_descendants (int) – The max_depth_descendants value of the child node.

Returns:

True if the max_depth_descendants value has changed, False otherwise.

Return type:

bool

class chipiron.players.move_selector.treevalue.indices.node_indices.index_data.MinMaxPathValue(tree_node: TreeNode[ITreeNode[Any]], index: float | None = None, min_path_value: float | None = None, max_path_value: float | None = None)[source]

Bases: NodeExplorationData

Represents the exploration data for a tree node with minimum and maximum path values.

min_path_value

The minimum path value associated with the node. Defaults to None.

Type:

float | None

max_path_value

The maximum path value associated with the node. Defaults to None.

Type:

float | None

dot_description()[source]

Returns a string representation of the exploration data for dot visualization.

dot_description() str[source]

Returns a string representation of the dot description for the index.

Returns:

The dot description of the index.

Return type:

str

max_path_value: float | None = None
min_path_value: float | None = None
class chipiron.players.move_selector.treevalue.indices.node_indices.index_data.NodeExplorationData(tree_node: TreeNode[ITreeNode[Any]], index: float | None = None)[source]

Bases: object

Represents the exploration data for a tree node.

tree_node

The tree node associated with the exploration data.

Type:

TreeNode

index

The index value associated with the node. Defaults to None.

Type:

float | None

dot_description()[source]

Returns a string representation of the exploration data for dot visualization.

dot_description() str[source]

Returns a string representation of the dot description for the index.

Returns:

The dot description of the index.

Return type:

str

index: float | None = None
tree_node: TreeNode[ITreeNode[Any]]
class chipiron.players.move_selector.treevalue.indices.node_indices.index_data.RecurZipfQuoolExplorationData(tree_node: TreeNode[ITreeNode[Any]], index: float | None = None, zipf_factored_proba: float | None = None)[source]

Bases: NodeExplorationData

Represents the exploration data for a tree node with recursive zipf-quool factor.

zipf_factored_proba

The probability associated with the node, factored by zipf-quool factor. Defaults to None.

Type:

float | None

dot_description()[source]

Returns a string representation of the exploration data for dot visualization.

dot_description() str[source]

Returns a string representation of the index and zipf_factored_proba values.

Returns:

A string representation of the index and zipf_factored_proba values.

Return type:

str

zipf_factored_proba: float | None = None

chipiron.players.move_selector.treevalue.indices.node_indices.index_types module

This module defines the enumeration for index computation types.

class chipiron.players.move_selector.treevalue.indices.node_indices.index_types.IndexComputationType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Enumeration for index computation types.

MinGlobalChange

Represents the minimum global change computation type.

Type:

str

MinLocalChange

Represents the minimum local change computation type.

Type:

str

RecurZipf

Represents the recurzipf computation type.

Type:

str

MinGlobalChange = 'min_global_change'
MinLocalChange = 'min_local_change'
RecurZipf = 'recurzipf'

Module contents

This module provides functionality for managing node indices in the tree value package.

The following classes and functions are available:

  • NodeExplorationData: Represents exploration data for a node.

  • ExplorationIndexDataFactory: Factory class for creating exploration index data.

  • IndexComputationType: Enum class representing different types of index computations.

  • create_exploration_index_data: Function for creating exploration index data.

class chipiron.players.move_selector.treevalue.indices.node_indices.IndexComputationType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Enumeration for index computation types.

MinGlobalChange

Represents the minimum global change computation type.

Type:

str

MinLocalChange

Represents the minimum local change computation type.

Type:

str

RecurZipf

Represents the recurzipf computation type.

Type:

str

MinGlobalChange = 'min_global_change'
MinLocalChange = 'min_local_change'
RecurZipf = 'recurzipf'
class chipiron.players.move_selector.treevalue.indices.node_indices.NodeExplorationData(tree_node: TreeNode[ITreeNode[Any]], index: float | None = None)[source]

Bases: object

Represents the exploration data for a tree node.

tree_node

The tree node associated with the exploration data.

Type:

TreeNode

index

The index value associated with the node. Defaults to None.

Type:

float | None

dot_description()[source]

Returns a string representation of the exploration data for dot visualization.

dot_description() str[source]

Returns a string representation of the dot description for the index.

Returns:

The dot description of the index.

Return type:

str

index: float | None = None
tree_node: TreeNode[ITreeNode[Any]]
chipiron.players.move_selector.treevalue.indices.node_indices.create_exploration_index_data(tree_node: TreeNode[Any], index_computation: IndexComputationType | None = None, depth_index: bool = False) NodeExplorationData | None[source]

Creates exploration index data for a given tree node.

Parameters:
  • tree_node (TreeNode) – The tree node for which to create the exploration index data.

  • index_computation (IndexComputationType | None, optional) – The type of index computation to use. Defaults to None.

  • depth_index (bool, optional) – Whether to include depth information in the index data. Defaults to False.

Returns:

The created exploration index data.

Return type:

NodeExplorationData | None

Raises:

ValueError – If the index_computation value is not recognized.