LydiaSyft
|
A dictionary that maps variable names to indices and vice versa. More...
#include <VarMgr.h>
Public Member Functions | |
VarMgr () | |
Constructs a VarMgr with no variables. | |
void | create_named_variables (const std::vector< std::string > &variable_names) |
Creates BDD variables and associates each with a name. More... | |
std::size_t | create_state_variables (std::size_t variable_count) |
Creates and stores state variables. More... | |
std::size_t | create_product_state_space (const std::vector< std::size_t > &automaton_ids) |
Registers a new automaton ID associated with a product state space. More... | |
CUDD::BDD | state_variable (std::size_t automaton_id, std::size_t i) const |
Returns the i-th state variable for a given automaton. | |
CUDD::BDD | state_vector_to_bdd (std::size_t automaton_id, const std::vector< int > &state_vector) const |
Converts a state vector to a BDD. More... | |
void | partition_variables (const std::vector< std::string > &input_names, const std::vector< std::string > &output_names) |
Partitions the named variables between inputs and outputs. More... | |
std::shared_ptr< CUDD::Cudd > | cudd_mgr () const |
Returns the CUDD manager used to create the variables. | |
CUDD::BDD | name_to_variable (const std::string &name) const |
Returns the index of the variable with the given name. | |
std::string | index_to_name (int index) const |
Returns the name of the variable at index index. | |
std::size_t | total_variable_count () const |
Returns the total number of variables, including named and state. | |
std::size_t | total_state_variable_count () const |
Returns the total number of state variables. | |
std::size_t | state_variable_count (std::size_t automaton_id) const |
Returns the number of state variables for a given automaton. | |
std::size_t | input_variable_count () const |
Returns the number of input variables. | |
std::size_t | output_variable_count () const |
Returns the number of output variables. | |
CUDD::BDD | input_cube () const |
Returns a BDD formed by the conjunction of all input variables. | |
CUDD::BDD | output_cube () const |
Returns a BDD formed by the conjunction of all output variables. | |
CUDD::BDD | state_variables_cube (std::size_t automaton_id) const |
Returns a BDD formed by the conjunction of all state variables of automaton automaton_id. | |
std::vector< int > | make_eval_vector (std::size_t automaton_id, const std::vector< int > &state_vector) const |
Creates a valid input to CUDD::BDD::Eval. More... | |
std::vector< int > | make_state_eval_vector (std::size_t automaton_id, const std::vector< int > &state_vector) const |
Creates a valid input to CUDD::BDD::Eval. More... | |
std::vector< CUDD::BDD > | make_compose_vector (std::size_t automaton_id, const std::vector< CUDD::BDD > &state_bdds) const |
Creates a valid input to CUDD::BDD::VectorCompose. More... | |
std::vector< std::string > | variable_labels () const |
Returns a vector with a label for each variable. More... | |
std::vector< std::string > | input_variable_labels () const |
Returns a vector with a label for each input variable. More... | |
std::vector< std::string > | output_variable_labels () const |
Returns a vector with a label for each output variable. More... | |
std::vector< std::string > | state_variable_labels (std::size_t automaton_id) const |
Returns a vector with a label for each state variable. More... | |
void | dump_dot (const CUDD::ADD &add, const std::string &filename) const |
Saves an ADD in a .dot file. More... | |
void | dump_dot (const std::vector< CUDD::ADD > &adds, const std::vector< std::string > &function_labels, const std::string &filename) const |
Saves ADDs to a .dot file with corresponding labels. More... | |
std::size_t | automaton_num () const |
Returns the number of DFAs the manager handles. | |
std::string | bdd_to_string (const CUDD::BDD &bdd) const |
Prints a BDD as a Boolean formula, where each variable has a specific label. More... | |
std::size_t | create_complement_state_space (const std::size_t automaton_id) |
Create the state space when complementing a DFA. | |
A dictionary that maps variable names to indices and vice versa.
std::string Syft::VarMgr::bdd_to_string | ( | const CUDD::BDD & | bdd | ) | const |
Prints a BDD as a Boolean formula, where each variable has a specific label.
A | given BDD. |
void Syft::VarMgr::create_named_variables | ( | const std::vector< std::string > & | variable_names | ) |
Creates BDD variables and associates each with a name.
variable_names | The names of the variables to create. A new variable is only created if a variable by that name does not already exist. |
std::size_t Syft::VarMgr::create_product_state_space | ( | const std::vector< std::size_t > & | automaton_ids | ) |
Registers a new automaton ID associated with a product state space.
This function does not create new state variables. Instead, the variables associated with the new ID are the union of all variables for the automata that form the product.
automaton_ids | A vector of automaton IDs all of which must already exist in the manager. |
std::size_t Syft::VarMgr::create_state_variables | ( | std::size_t | variable_count | ) |
Creates and stores state variables.
Multiple calls of this function create separate groups of state variables. The call generates an ID for the automaton whose state space the variables represent, so that the correct group of variables can be retrieved later.
variable_count | The number of state variables to create. |
void Syft::VarMgr::dump_dot | ( | const CUDD::ADD & | add, |
const std::string & | filename | ||
) | const |
Saves an ADD in a .dot file.
Uses ADD for better visualization in the .dot file. To call with a BDD, use dump_dot(bdd.Add(), filename).
An | ADD add and filename. |
void Syft::VarMgr::dump_dot | ( | const std::vector< CUDD::ADD > & | adds, |
const std::vector< std::string > & | function_labels, | ||
const std::string & | filename | ||
) | const |
Saves ADDs to a .dot file with corresponding labels.
adds | A vector of ADDs to be saved to file. |
function_labels | A vector such that function_labels[i] contains the label for adds[i]. The labels appear above the corresponding ADD in the file. |
filename | The name of the .dot file. |
std::vector< std::string > Syft::VarMgr::input_variable_labels | ( | ) | const |
Returns a vector with a label for each input variable.
To be used with CUDD::Cudd::DumpDot.
std::vector< CUDD::BDD > Syft::VarMgr::make_compose_vector | ( | std::size_t | automaton_id, |
const std::vector< CUDD::BDD > & | state_bdds | ||
) | const |
Creates a valid input to CUDD::BDD::VectorCompose.
automaton_id | The ID of the automaton whose variables to use. |
state_bdds | A vector containing one BDD for each state variable of the automaton. |
std::vector< int > Syft::VarMgr::make_eval_vector | ( | std::size_t | automaton_id, |
const std::vector< int > & | state_vector | ||
) | const |
Creates a valid input to CUDD::BDD::Eval.
automaton_id | The ID of the automaton whose variables to use. |
state_vector | A vector of 1s and 0s encoding a state's binary representation. |
std::vector< int > Syft::VarMgr::make_state_eval_vector | ( | std::size_t | automaton_id, |
const std::vector< int > & | state_vector | ||
) | const |
Creates a valid input to CUDD::BDD::Eval.
automaton_id | The ID of the automaton whose variables to use. |
state_vector | A vector of 1s and 0s encoding a state's binary representation. |
std::vector< std::string > Syft::VarMgr::output_variable_labels | ( | ) | const |
Returns a vector with a label for each output variable.
To be used with CUDD::Cudd::DumpDot.
void Syft::VarMgr::partition_variables | ( | const std::vector< std::string > & | input_names, |
const std::vector< std::string > & | output_names | ||
) |
Partitions the named variables between inputs and outputs.
input_names | The names of the variables that should be considered inputs. |
output_names | The names of the variables that should be considered outputs. |
std::vector< std::string > Syft::VarMgr::state_variable_labels | ( | std::size_t | automaton_id | ) | const |
Returns a vector with a label for each state variable.
To be used with CUDD::Cudd::DumpDot.
CUDD::BDD Syft::VarMgr::state_vector_to_bdd | ( | std::size_t | automaton_id, |
const std::vector< int > & | state_vector | ||
) | const |
Converts a state vector to a BDD.
automaton_id | The ID of the automaton whose variables to use. |
state_vector | A vector of 1s and 0s encoding a state's binary representation. |
std::vector< std::string > Syft::VarMgr::variable_labels | ( | ) | const |
Returns a vector with a label for each variable.
To be used with CUDD::Cudd::DumpDot.