← Documentation
ADS-IDAC Engine 5.0.0
bncore::DiscretizationManager Class Reference

Splits states of graph variables while a per-variable bin limit allows it. More...

#include <manager.hpp>

Public Member Functions

 DiscretizationManager (std::size_t max_bins_per_var=50)
 
bool should_split (const Graph &graph, NodeId var) const
 Tests whether a variable still has fewer states than the limit. More...
 
void split_bin (Graph &graph, NodeId var, std::size_t state_idx)
 Splits one state of a variable into two. More...
 

Private Attributes

std::size_t max_bins_per_var_
 split_bin() is a no-op at or above this state count More...
 

Detailed Description

Splits states of graph variables while a per-variable bin limit allows it.

Definition at line 18 of file manager.hpp.

Constructor & Destructor Documentation

◆ DiscretizationManager()

bncore::DiscretizationManager::DiscretizationManager ( std::size_t  max_bins_per_var = 50)
explicit
Parameters
max_bins_per_varLargest number of states a variable may reach through split_bin().

Definition at line 5 of file manager.cpp.

Member Function Documentation

◆ should_split()

bool bncore::DiscretizationManager::should_split ( const Graph &  graph,
NodeId  var 
) const

Tests whether a variable still has fewer states than the limit.

Parameters
graphGraph that holds the variable.
varVariable id.
Returns
True when the variable's state count is below the limit.
Exceptions
std::out_of_rangeif var is not a variable of graph.

Definition at line 8 of file manager.cpp.

References bncore::Graph::get_variable(), max_bins_per_var_, and bncore::VariableMetadata::num_states().

Referenced by split_bin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_bin()

void bncore::DiscretizationManager::split_bin ( Graph &  graph,
NodeId  var,
std::size_t  state_idx 
)

Splits one state of a variable into two.

The state named S is replaced by "S_low" and "S_high" at the same position, through Graph::split_state(). If should_split() is false the call does nothing. The CPTs stored in the graph are not resized, so the tables of the variable and of its children have to be set again before inference.

Parameters
graphGraph to modify.
varVariable id.
state_idxIndex of the state to split. It must be less than the variable's state count.
Exceptions
std::out_of_rangeif var is not a variable of graph.

Definition at line 13 of file manager.cpp.

References bncore::Graph::get_variable(), should_split(), bncore::Graph::split_state(), and bncore::VariableMetadata::states.

Here is the call graph for this function:

Member Data Documentation

◆ max_bins_per_var_

std::size_t bncore::DiscretizationManager::max_bins_per_var_
private

split_bin() is a no-op at or above this state count

Definition at line 46 of file manager.hpp.

Referenced by should_split().


The documentation for this class was generated from the following files: