This commit is contained in:
Alexandre Duret-Lutz 2003-06-03 17:02:33 +00:00
parent 2f19a35e97
commit c4c90de3f6
8 changed files with 64 additions and 50 deletions

View file

@ -1,6 +1,7 @@
#include <set>
#include "dictunion.hh"
#include <bdd.h>
#include <cassert>
namespace spot
{
@ -9,45 +10,45 @@ namespace spot
tgba_bdd_dict_union(const tgba_bdd_dict& l, const tgba_bdd_dict& r)
{
tgba_bdd_dict res;
std::set<const ltl::formula*> now;
std::set<const ltl::formula*> var;
std::set<const ltl::formula*> prom;
tgba_bdd_dict::fv_map::const_iterator i;
// Merge Now variables.
for (i = l.now_map.begin(); i != l.now_map.end(); ++i)
now.insert(i->first);
for (i = r.now_map.begin(); i != r.now_map.end(); ++i)
now.insert(i->first);
// Merge atomic propositions.
for (i = l.var_map.begin(); i != l.var_map.end(); ++i)
var.insert(i->first);
for (i = r.var_map.begin(); i != r.var_map.end(); ++i)
var.insert(i->first);
// Merge promises.
for (i = l.prom_map.begin(); i != l.prom_map.end(); ++i)
prom.insert(i->first);
for (i = r.prom_map.begin(); i != r.prom_map.end(); ++i)
prom.insert(i->first);
// Ensure we have enough BDD variables.
int have = bdd_extvarnum(0);
int want = now.size() * 2 + var.size() + prom.size();
if (have < want)
bdd_setvarnum(want);
// Fill in the "defragmented" union dictionary.
// FIXME: Make some experiments with ordering of prom/var/now variables.
// Maybe there is one order that usually produces smaller BDDs?
// Next BDD variable to use.
int v = 0;
std::set<const ltl::formula*>::const_iterator f;
for (f = prom.begin(); f != prom.end(); ++f)
{
@ -67,7 +68,7 @@ namespace spot
res.now_formula_map[v] = *f;
v += 2;
}
assert (v == want);
return res;
}