spot  1.0.2
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
spot::bdd_dict Class Reference

Map BDD variables to formulae. More...

#include <tgba/bdddict.hh>

Inheritance diagram for spot::bdd_dict:
Inheritance graph
Collaboration diagram for spot::bdd_dict:
Collaboration graph

Classes

class  anon_free_list
struct  bdd_info

Public Types

enum  var_type {
  anon = 0, now, next, var,
  acc
}
typedef std::map< const
ltl::formula *, int > 
fv_map
 Formula-to-BDD-variable maps.
typedef std::map< int, const
ltl::formula * > 
vf_map
 BDD-variable-to-formula maps.
typedef std::set< const void * > ref_set
 BDD-variable reference counts.
typedef std::vector< bdd_infobdd_info_map

Public Member Functions

 bdd_dict ()
 ~bdd_dict ()
 Destroy the BDD dict.
int register_proposition (const ltl::formula *f, const void *for_me)
 Register an atomic proposition.
void register_propositions (bdd f, const void *for_me)
 Register BDD variables as atomic propositions.
int register_state (const ltl::formula *f, const void *for_me)
 Register a couple of Now/Next variables.
int register_acceptance_variable (const ltl::formula *f, const void *for_me)
 Register an atomic proposition.
int register_clone_acc (int var, const void *for_me)
 Clone an acceptance variable VAR for FOR_ME.
void register_acceptance_variables (bdd f, const void *for_me)
 Register BDD variables as acceptance variables.
const ltl::formulaoneacc_to_formula (bdd oneacc) const
 Convert one acceptance condition into the associated formula.
const ltl::formulaoneacc_to_formula (int var) const
 Convert one acceptance condition into the associated formula.
int register_anonymous_variables (int n, const void *for_me)
 Register anonymous BDD variables.
void register_all_variables_of (const void *from_other, const void *for_me)
 Duplicate the variable usage of another object.
void unregister_all_my_variables (const void *me)
 Release all variables used by an object.
void unregister_variable (int var, const void *me)
 Release a variable used by me.
std::ostream & dump (std::ostream &os) const
 Dump all variables for debugging.
void assert_emptiness () const
 Make sure the dictionary is empty.
int allocate_variables (int n)
 Allocate n BDD variables.
void release_variables (int base, int n)
 Release n BDD variables starting at base.
bool is_registered_proposition (const ltl::formula *f, const void *by_me)
bool is_registered_state (const ltl::formula *f, const void *by_me)
bool is_registered_acceptance_variable (const ltl::formula *f, const void *by_me)

Static Public Member Functions

static void initialize ()
 Initialize the BDD library.

Public Attributes

fv_map now_map
 Maps formulae to "Now" BDD variables.
fv_map var_map
 Maps atomic propositions to BDD variables.
fv_map acc_map
 Maps acceptance conditions to BDD variables.
bdd_info_map bdd_map
bddPair * next_to_now
 Map Next variables to Now variables.
bddPair * now_to_next
 Map Now variables to Next variables.

Protected Types

typedef std::map< const void
*, anon_free_list
free_anonymous_list_of_type
 List of unused anonymous variable number for each automaton.

Protected Attributes

free_anonymous_list_of_type free_anonymous_list_of
int lvarnum
 number of variables in use in this allocator.

Static Protected Attributes

static bool initialized
 Whether the BDD library has been initialized.

Private Member Functions

 bdd_dict (const bdd_dict &other)
bdd_dictoperator= (const bdd_dict &other)

Detailed Description

Map BDD variables to formulae.

The BDD library uses integers to designate Boolean variables in its decision diagrams. This class is used to map such integers to objects actually used in Spot. These objects are usually atomic propositions, but they can also be acceptance conditions, or "Now/Next" variables (although the latter should be eventually removed).

When a BDD variable is registered using a bdd_dict, it is always associated to a "user" (or "owner") object. This is done by supplying the bdd_dict with a pointer to the intended user of the variable. When the user object dies, it should release the BDD variables it was using by calling (for instance) unregister_all_my_variables(), giving the same pointer. Variables can also by unregistered one by one using unregister_variable().

Member Typedef Documentation

typedef std::vector<bdd_info> spot::bdd_dict::bdd_info_map
typedef std::map<const void*, anon_free_list> spot::bdd_dict::free_anonymous_list_of_type
protected

List of unused anonymous variable number for each automaton.

typedef std::map<const ltl::formula*, int> spot::bdd_dict::fv_map

Formula-to-BDD-variable maps.

typedef std::set<const void*> spot::bdd_dict::ref_set

BDD-variable reference counts.

typedef std::map<int, const ltl::formula*> spot::bdd_dict::vf_map

BDD-variable-to-formula maps.

Member Enumeration Documentation

Enumerator:
anon 
now 
next 
var 
acc 

Constructor & Destructor Documentation

spot::bdd_dict::bdd_dict ( )
spot::bdd_dict::~bdd_dict ( )

Destroy the BDD dict.

This always calls assert_emptiness() to diagnose cases where variables have not been unregistered.

spot::bdd_dict::bdd_dict ( const bdd_dict other)
private

Member Function Documentation

int spot::bdd_allocator::allocate_variables ( int  n)
inherited

Allocate n BDD variables.

void spot::bdd_dict::assert_emptiness ( ) const

Make sure the dictionary is empty.

This will print diagnostics if the dictionary is not empty. Use for debugging. This is called automatically by the destructor. When Spot is compiled in development mode (i.e., with ./configure –enable-devel), this function will abort if the dictionary is not empty.

The errors detected by this function usually indicate missing calls to unregister_variable() or unregister_all_my_variables().

std::ostream& spot::bdd_dict::dump ( std::ostream &  os) const

Dump all variables for debugging.

Parameters
osThe output stream.
static void spot::bdd_allocator::initialize ( )
staticinherited

Initialize the BDD library.

bool spot::bdd_dict::is_registered_acceptance_variable ( const ltl::formula f,
const void *  by_me 
)
bool spot::bdd_dict::is_registered_proposition ( const ltl::formula f,
const void *  by_me 
)

Check whether formula f has already been registered by by_me.

bool spot::bdd_dict::is_registered_state ( const ltl::formula f,
const void *  by_me 
)
const ltl::formula* spot::bdd_dict::oneacc_to_formula ( bdd  oneacc) const

Convert one acceptance condition into the associated formula.

This version accepts a conjunction of Acc variables, in which only one must be positive. This positive variable will be converted back into the associated formula.

The returned formula is not cloned, and is valid until the BDD variable used in oneacc are unregistered.

const ltl::formula* spot::bdd_dict::oneacc_to_formula ( int  var) const

Convert one acceptance condition into the associated formula.

This version takes the number of a BDD variable that must has been returned by a call to register_acceptance_variable().

The returned formula is not cloned, and is valid until the BDD variable var is unregistered.

bdd_dict& spot::bdd_dict::operator= ( const bdd_dict other)
private
int spot::bdd_dict::register_acceptance_variable ( const ltl::formula f,
const void *  for_me 
)

Register an atomic proposition.

Return (and maybe allocate) a BDD variable designating an acceptance set associated to formula f. The for_me argument should point to the object using this BDD variable, this is used for reference counting. It is perfectly safe to call this function several time with the same arguments.

Returns
The variable number. Use bdd_ithvar() or bdd_nithvar() to convert this to a BDD.

Referenced by spot::taa_tgba_labelled< std::string, string_hash >::add_acceptance_condition(), and spot::explicit_graph< State, tgba >::declare_acceptance_condition().

void spot::bdd_dict::register_acceptance_variables ( bdd  f,
const void *  for_me 
)

Register BDD variables as acceptance variables.

Register all variables occurring in f as acceptance variables used by for_me. This assumes that these acceptance variables are already known from the dictionary (i.e., they have already been registered by register_acceptance_variable() for another automaton).

Referenced by spot::explicit_graph< State, tgba >::add_acceptance_conditions(), spot::explicit_graph< State, tgba >::copy_acceptance_conditions_of(), and spot::explicit_graph< State, tgba >::set_acceptance_conditions().

void spot::bdd_dict::register_all_variables_of ( const void *  from_other,
const void *  for_me 
)

Duplicate the variable usage of another object.

This tells this dictionary that the for_me object will be using the same BDD variables as the from_other objects. This ensure that the variables won't be freed when from_other is deleted if from_other is still alive.

int spot::bdd_dict::register_anonymous_variables ( int  n,
const void *  for_me 
)

Register anonymous BDD variables.

Return (and maybe allocate) n consecutive BDD variables which will be used only by for_me.

Returns
The variable number. Use bdd_ithvar() or bdd_nithvar() to convert this to a BDD.
int spot::bdd_dict::register_clone_acc ( int  var,
const void *  for_me 
)

Clone an acceptance variable VAR for FOR_ME.

This is used in products TGBAs when both operands share the same acceptance variables but they need to be distinguished in the result.

int spot::bdd_dict::register_proposition ( const ltl::formula f,
const void *  for_me 
)

Register an atomic proposition.

Return (and maybe allocate) a BDD variable designating formula f. The for_me argument should point to the object using this BDD variable, this is used for reference counting. It is perfectly safe to call this function several time with the same arguments.

Returns
The variable number. Use bdd_ithvar() or bdd_nithvar() to convert this to a BDD.
void spot::bdd_dict::register_propositions ( bdd  f,
const void *  for_me 
)

Register BDD variables as atomic propositions.

Register all variables occurring in f as atomic propositions used by for_me. This assumes that these atomic propositions are already known from the dictionary (i.e., they have already been registered by register_proposition() for another automaton).

Referenced by spot::explicit_graph< State, tgba >::add_conditions().

int spot::bdd_dict::register_state ( const ltl::formula f,
const void *  for_me 
)

Register a couple of Now/Next variables.

Return (and maybe allocate) two BDD variables for a state associated to formula f. The for_me argument should point to the object using this BDD variable, this is used for reference counting. It is perfectly safe to call this function several time with the same arguments.

Returns
The first variable number. Add one to get the second variable. Use bdd_ithvar() or bdd_nithvar() to convert this to a BDD.
void spot::bdd_allocator::release_variables ( int  base,
int  n 
)
inherited

Release n BDD variables starting at base.

void spot::bdd_dict::unregister_all_my_variables ( const void *  me)

Release all variables used by an object.

Usually called in the destructor if me.

Referenced by spot::explicit_graph< State, tgba >::~explicit_graph().

void spot::bdd_dict::unregister_variable ( int  var,
const void *  me 
)

Release a variable used by me.

Member Data Documentation

fv_map spot::bdd_dict::acc_map
bdd_info_map spot::bdd_dict::bdd_map
free_anonymous_list_of_type spot::bdd_dict::free_anonymous_list_of
protected
bool spot::bdd_allocator::initialized
staticprotectedinherited

Whether the BDD library has been initialized.

int spot::bdd_allocator::lvarnum
protectedinherited

number of variables in use in this allocator.

bddPair* spot::bdd_dict::next_to_now

Map Next variables to Now variables.

Use with BuDDy's bdd_replace() function.

fv_map spot::bdd_dict::now_map

Maps formulae to "Now" BDD variables.

bddPair* spot::bdd_dict::now_to_next

Map Now variables to Next variables.

Use with BuDDy's bdd_replace() function.

fv_map spot::bdd_dict::var_map

Maps atomic propositions to BDD variables.


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

Please comment this page and report errors about it on the RefDocComments page.
Generated on Wed Mar 6 2013 09:25:16 for spot by doxygen 1.8.1.2