Clean the as_bdd() cache after LTL simplification.
Syntactic implication checks may use as_bdd() to compare Boolean formulae. By doing so, they register Boolean variables in an order that is usially detrimental to the LTL translator. The new, clear_as_bdd_cache() function offers a mean to unregister these variables, so that the LTL translator will register them again in the a more natural way. * src/ltlvisit/simplify.hh, src/ltlvisit/simplify.cc (clear_as_bdd_cache): New function. * src/tgbatest/ltl2tgba.cc, wrap/python/ajax/spot.in: Call it.
This commit is contained in:
parent
9633dd6e88
commit
e5a86290cf
4 changed files with 32 additions and 0 deletions
|
|
@ -131,6 +131,19 @@ namespace spot
|
||||||
<< "star normal form: " << snf_cache_.size() << " entries\n";
|
<< "star normal form: " << snf_cache_.size() << " entries\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clear_as_bdd_cache()
|
||||||
|
{
|
||||||
|
f2b_map::iterator i = as_bdd_.begin();
|
||||||
|
f2b_map::iterator end = as_bdd_.end();
|
||||||
|
while (i != end)
|
||||||
|
{
|
||||||
|
f2b_map::iterator old = i++;
|
||||||
|
old->first->destroy();
|
||||||
|
}
|
||||||
|
as_bdd_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Convert a Boolean formula into a BDD for easier comparison.
|
// Convert a Boolean formula into a BDD for easier comparison.
|
||||||
bdd
|
bdd
|
||||||
as_bdd(const formula* f)
|
as_bdd(const formula* f)
|
||||||
|
|
@ -4277,6 +4290,11 @@ namespace spot
|
||||||
cache_->print_stats(os);
|
cache_->print_stats(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ltl_simplifier::clear_as_bdd_cache()
|
||||||
|
{
|
||||||
|
cache_->clear_as_bdd_cache();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,15 @@ namespace spot
|
||||||
/// to the constructor.
|
/// to the constructor.
|
||||||
bdd as_bdd(const formula* f);
|
bdd as_bdd(const formula* f);
|
||||||
|
|
||||||
|
/// \brief Clear the as_bdd() cache.
|
||||||
|
///
|
||||||
|
/// Calling this function is recommended before running other
|
||||||
|
/// algorithms that create BDD variables in a more natural
|
||||||
|
/// order. For instance ltl_to_tgba_fm() will usually be more
|
||||||
|
/// efficient if the BDD variables for atomic propositions have
|
||||||
|
/// not been ordered before hand.
|
||||||
|
void clear_as_bdd_cache();
|
||||||
|
|
||||||
/// Return the bdd_dict used.
|
/// Return the bdd_dict used.
|
||||||
bdd_dict* get_dict() const;
|
bdd_dict* get_dict() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -849,6 +849,9 @@ main(int argc, char** argv)
|
||||||
else
|
else
|
||||||
std::cout << spot::ltl::to_string(f) << std::endl;
|
std::cout << spot::ltl::to_string(f) << std::endl;
|
||||||
}
|
}
|
||||||
|
// This helps ltl_to_tgba_fm() to order BDD variables in
|
||||||
|
// a more natural way.
|
||||||
|
simp->clear_as_bdd_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->is_psl_formula()
|
if (f->is_psl_formula()
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,8 @@ if dored:
|
||||||
f2 = simp.simplify(f)
|
f2 = simp.simplify(f)
|
||||||
f.destroy()
|
f.destroy()
|
||||||
f = f2
|
f = f2
|
||||||
|
# This also clears the as_bdd() cache.
|
||||||
|
simp = None
|
||||||
|
|
||||||
# Formula manipulation only.
|
# Formula manipulation only.
|
||||||
if output_type == 'f':
|
if output_type == 'f':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue