|
C Configuration Space and Tuning Library (CCS)
|
A CCS tree object represents a node in a tree structure. More...

Go to the source code of this file.
Functions | |
| ccs_result_t | ccs_create_tree (size_t arity, ccs_datum_t value, ccs_tree_t *tree_ret) |
| Create new tree node. | |
| ccs_result_t | ccs_tree_get_value (ccs_tree_t tree, ccs_datum_t *value_ret) |
| Get the value of a tree node. | |
| ccs_result_t | ccs_tree_get_arity (ccs_tree_t tree, size_t *arity_ret) |
| Get the arity of a tree node. | |
| ccs_result_t | ccs_tree_set_child (ccs_tree_t tree, size_t index, ccs_tree_t child) |
| Set an unset child in a tree node at the given index. | |
| ccs_result_t | ccs_tree_get_child (ccs_tree_t tree, size_t index, ccs_tree_t *child_ret) |
| Query a tree node for the child at the given index. | |
| ccs_result_t | ccs_tree_get_children (ccs_tree_t tree, size_t num_children, ccs_tree_t *children, size_t *num_children_ret) |
| Query all the children of a tree node. | |
| ccs_result_t | ccs_tree_get_parent (ccs_tree_t tree, ccs_tree_t *parent_ret, size_t *index_ret) |
| Get the parent node of a tree node. | |
| ccs_result_t | ccs_tree_get_position (ccs_tree_t tree, size_t position_size, size_t *position, size_t *position_size_ret) |
| Get the position of a node in it's tree. | |
| ccs_result_t | ccs_tree_get_values (ccs_tree_t tree, size_t num_values, ccs_datum_t *values, size_t *num_values_ret) |
| Get the values along the path leading to a node in it's tree. | |
| ccs_result_t | ccs_tree_get_values_at_position (ccs_tree_t tree, size_t position_size, const size_t *position, size_t num_values, ccs_datum_t *values) |
| Get the values along the path to a given position from a tree node. | |
| ccs_result_t | ccs_tree_get_node_at_position (ccs_tree_t tree, size_t position_size, const size_t *position, ccs_tree_t *tree_ret) |
| Get the node at a given position from a tree node. | |
| ccs_result_t | ccs_tree_get_weight (ccs_tree_t tree, ccs_float_t *weight_ret) |
| Get the weight of a tree node. | |
| ccs_result_t | ccs_tree_set_weight (ccs_tree_t tree, ccs_float_t weight) |
| Set the weight of a tree node. | |
| ccs_result_t | ccs_tree_get_bias (ccs_tree_t tree, ccs_float_t *bias_ret) |
| Get the bias of a subtree. | |
| ccs_result_t | ccs_tree_set_bias (ccs_tree_t tree, ccs_float_t bias) |
| Set the bias of a tree node. | |
| ccs_result_t | ccs_tree_sample (ccs_tree_t tree, ccs_rng_t rng, size_t *index_ret) |
| Sample the child index space of a a tree node. | |
| ccs_result_t | ccs_tree_samples (ccs_tree_t tree, ccs_rng_t rng, size_t num_indices, size_t *indices) |
| Sample the child index space of a tree node. | |
A CCS tree object represents a node in a tree structure.
Nodes have a given arity and are associated a give datum. Nodes can be sampled for the index of one of their children, but can also return themselves. By default children are sampled according to their subtree weight. This allows uniform sampling of the whole tree by recursively sampling selected children, and stopping when a node returns itself. This behavior can be changed by modifying individual nodes weights, as well as biasing subtrees.
|
extern |
Create new tree node.
| [in] | arity | the arity of the node |
| [in] | value | the value associated with the node |
| [out] | tree_ret | a pointer to the variable that will hold the newly created tree node. |
|
extern |
Get the arity of a tree node.
| [in] | tree | |
| [out] | arity_ret | a pointer to the variable that will contain the arity of the node. |
tree is not a valid CCS tree arity_ret is NULL
|
extern |
Get the bias of a subtree.
| [in] | tree | |
| [out] | bias_ret | a pointer to the variable that will contain the returned bias |
tree is not a valid CCS tree bias_ret is NULL
|
extern |
Query a tree node for the child at the given index.
| [in] | tree | |
| [in] | index | |
| [in] | child_ret | a pointer to the variable that will hold the returned child or NULL if the child was undefined |
tree is not a valid CCS tree index is greater than tree arity child_ret is NULL
|
extern |
Query all the children of a tree node.
| [in] | tree | |
| [in] | num_children | the size of the children array |
| [out] | children | an array of size num_children to hold the returned values, or NULL. If the array is too big, extra values are set to NULL. If children are undefined, NULL is returned as well |
| [out] | num_children_ret | a pointer to a variable that will contain the number of children that are or would be returned. Can be NULL |
tree is not a valid CCS tree children is NULL and num_children is greater than 0; or if children is NULL and num_children_ret is NULL; or if children is not NULL and num_children is less than the arity of tree
|
extern |
Get the node at a given position from a tree node.
| [in] | tree | |
| [in] | position_size | the number of entries in the position array |
| [in] | position | an array of indexes defining a location in the tree space. can be NULL if position_size is 0 |
| [out] | tree_ret | a pointer to the variable that will contain the node |
tree is not a valid CCS tree tree_ret is NULL; or if position is NULL and position_size is greater than 0 position does not define a valid position in tree position is undefined in tree
|
extern |
Get the parent node of a tree node.
| [in] | tree | |
| [out] | parent_ret | a pointer to a variable that will contain the returned parent node or NULL if the node has no parent. |
| [out] | index_ret | a pointer to a variable that will contain the index of the node in the parent if it has a parent. Can be NULL |
tree is not a valid CCS tree parent_ret is NULL
|
extern |
Get the position of a node in it's tree.
| [in] | tree | |
| [in] | position_size | the size of the position array |
| [out] | position | an array of size position_size to hold the returned values, or NULL. If the array is too big, extra values are set to 0 |
| [out] | position_size_ret | a pointer to a variable that will contain the number of values that are or would be returned. Can be NULL |
tree is not a valid CCS tree position is NULL and position_size is greater than 0; or if position is NULL and position_size_ret is NULL; or if position_size is less than the number of values that would be returned
|
extern |
Get the value of a tree node.
| [in] | tree | |
| [out] | value_ret | a pointer to the variable that will contain the value associated with the node. |
tree is not a valid CCS tree value_ret is NULL
|
extern |
Get the values along the path leading to a node in it's tree.
| [in] | tree | |
| [in] | num_values | the size of the values array |
| [out] | values | an array of size num_values to hold the returned values, or NULL. If the array is too big, extra values are set to CCS_DATA_TYPE_NONE |
| [out] | num_values_ret | a pointer to a variable that will contain the number of values that are or would be returned. Can be NULL |
tree is not a valid CCS tree values is NULL and num_values is greater than 0; or if values is NULL and num_values_ret is NULL; or if num_values is less than the number of values that would be returned
|
extern |
Get the values along the path to a given position from a tree node.
| [in] | tree | |
| [in] | position_size | the number of entries in the position array |
| [in] | position | an array of indexes defining a location in the tree space. can be NULL if position_size is 0 |
| [in] | num_values | the size of the values array |
| [out] | values | an array of size num_values to hold the returned values, or NULL. If the array is too big, extra values are set to CCS_DATA_TYPE_NONE |
tree is not a valid CCS tree position does not define a valid position in tree position is undefined in tree values is NULL; if num_values is less than position_size + 1; or if position is NULL and position_size is greater than 0
|
extern |
Get the weight of a tree node.
| [in] | tree | |
| [out] | weight_ret | a pointer to the variable that will contain the returned weight |
tree is not a valid CCS tree weight_ret is NULL
|
extern |
Sample the child index space of a a tree node.
If the returned index is equal to the arity, the node sampled itself. Sampling is proportional to each subtree weight and to the tree node own weight. A subtree weight is computed as the sum of each of it's subtree weights plus it's root node weight, multiplied by it's bias.
| [in] | tree | |
| [in] | rng | the rng to use while sampling |
| [out] | index_ret | a pointer to the variable that will contain the returned index |
tree is not a valid CCS tree index_ret is NULL tree and all it's subtrees are 0
|
extern |
Sample the child index space of a tree node.
If the returned index is equal to the arity, the node sampled itself. Sampling is proportional to each subtree weight and to the tree node own weight. A subtree weight is computed as the sum of each of it's subtree weights plus it's root node weight, multiplied by it's bias.
| [in] | tree | |
| [in] | rng | the rng to use while sampling |
| [in] | num_indices | |
| [out] | indices | an array of num_indices which will hold the returned values |
tree is not a valid CCS tree indices is NULL and num_indices is greater than 0 tree and all it's subtrees are 0 rng is only used by one thread at a time
|
extern |
Set the bias of a tree node.
| [in,out] | tree | |
| [in] | bias |
tree is not a valid CCS tree
|
extern |
Set an unset child in a tree node at the given index.
| [in] | tree | |
| [in] | index | |
| [in] | child |
tree is not a valid CCS tree; or if child is not a valid CCS tree index is greater than tree arity tree already has a child at index child is already a child of another node; or if child is the root of a tree space
|
extern |
Set the weight of a tree node.
| [in,out] | tree | |
| [in] | weight |
tree is not a valid CCS tree