c++11: introduce tgba::succ(s) to replace tgba::succ_iter(s).

| tgba_succ_iterator* i = aut->succ_iter(s);
| for (i->begin(); !i->done(); i->next())
|   {
|      // ...
|   }
| delete i;

becomes

| for (auto i: aut->succ(s))
|   {
|      // ...
|   }

hiding the begin()/done()/next() interface, taking care of the delete,
and allowing more optimization to come.

* src/tgba/succiter.hh, src/tgba/tgba.hh: Implement the above
new interface.
* iface/gspn/ssp.cc, src/dstarparse/nsa2tgba.cc,
src/saba/sabacomplementtgba.cc, src/tgba/tgbakvcomplement.cc,
src/tgba/tgbamask.cc, src/tgba/tgbasafracomplement.cc,
src/tgba/tgbatba.cc, src/tgbaalgos/compsusp.cc, src/tgbaalgos/cutscc.cc,
src/tgbaalgos/degen.cc, src/tgbaalgos/emptiness.cc,
src/tgbaalgos/isdet.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/minimize.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/safety.cc, src/tgbaalgos/simulation.cc,
src/tgbaalgos/tau03.cc, src/tgbatest/explicit2.cc: Update for
loops.
This commit is contained in:
Alexandre Duret-Lutz 2014-01-25 19:48:28 +01:00
parent f59773e3c7
commit 487cd01d9f
21 changed files with 418 additions and 522 deletions

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -99,6 +99,73 @@ namespace spot
//@}
};
class tgba;
namespace internal
{
struct SPOT_API succ_iterator
{
protected:
tgba_succ_iterator* it_;
public:
succ_iterator(tgba_succ_iterator* it):
it_(it)
{
}
bool operator==(succ_iterator o) const
{
return it_ == o.it_;
}
bool operator!=(succ_iterator o) const
{
return it_ != o.it_;
}
const tgba_succ_iterator* operator*() const
{
return it_;
}
void operator++()
{
it_->next();
if (it_->done())
it_ = nullptr;
}
};
class SPOT_API succ_iterable
{
protected:
const tgba* aut_;
tgba_succ_iterator* it_;
public:
succ_iterable(const tgba* aut, tgba_succ_iterator* it)
: aut_(aut), it_(it)
{
}
~succ_iterable()
{
delete it_;
}
succ_iterator begin()
{
it_->first();
return it_->done() ? nullptr : it_;
}
succ_iterator end()
{
return nullptr;
}
};
}
}

View file

@ -1,8 +1,9 @@
// Copyright (C) 2009, 2011, 2013 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -23,12 +24,14 @@
# define SPOT_TGBA_TGBA_HH
#include "state.hh"
#include "succiter.hh"
#include "bdddict.hh"
#include "succiter.hh"
namespace spot
{
/// \defgroup tgba TGBA (Transition-based Generalized Büchi Automata)
class tgba_succ_iterator;
/// \defgroup tgba TGBA (Transition-based Generalized Büchi Automata)
///
/// Spot is centered around the spot::tgba type. This type and its
/// cousins are listed \ref tgba_essentials "here". This is an
@ -42,15 +45,15 @@ namespace spot
/// \ingroup tgba
/// \ingroup tgba_essentials
/// \brief A Transition-based Generalized Büchi Automaton.
/// \brief A Transition-based Generalized Büchi Automaton.
///
/// The acronym TGBA (Transition-based Generalized Büchi Automaton)
/// The acronym TGBA (Transition-based Generalized Büchi Automaton)
/// was coined by Dimitra Giannakopoulou and Flavio Lerda
/// in "From States to Transitions: Improving Translation of LTL
/// Formulae to Büchi Automata". (FORTE'02)
/// Formulae to Büchi Automata". (FORTE'02)
///
/// TGBAs are transition-based, meanings their labels are put
/// on arcs, not on nodes. They use Generalized Büchi acceptance
/// on arcs, not on nodes. They use Generalized Büchi acceptance
/// conditions: there are several acceptance sets (of
/// transitions), and a path can be accepted only if it traverses
/// at least one transition of each set infinitely often.
@ -105,8 +108,18 @@ namespace spot
/// product automaton. Otherwise, 0.
virtual tgba_succ_iterator*
succ_iter(const state* local_state,
const state* global_state = 0,
const tgba* global_automaton = 0) const = 0;
const state* global_state = nullptr,
const tgba* global_automaton = nullptr) const = 0;
/// \brief Build an iterable over the successors of \a s.
///
/// This is meant to be used as
/// <code>for (auto i: aut->out(s)) { /* i->current_state() */ }</code>.
internal::succ_iterable
succ(const state* s) const
{
return {this, succ_iter(s)};
}
/// \brief Get a formula that must hold whatever successor is taken.
///

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2013 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2009, 2010, 2011, 2013, 2014 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -325,13 +325,11 @@ namespace spot
i != sr_map.end();
++i)
{
tgba_succ_iterator* iterator = automaton_->succ_iter(i->first.get());
for (iterator->first(); !iterator->done(); iterator->next())
for (auto iterator: automaton_->succ(i->first.get()))
{
bdd c = iterator->current_condition();
get_atomics(atomics, c);
}
delete iterator;
}
// Compute the conjunction of all those atomic properties.
@ -433,8 +431,7 @@ namespace spot
i != sr_map.end();
++i)
{
tgba_succ_iterator* iterator = automaton_->succ_iter(i->first.get());
for (iterator->first(); !iterator->done(); iterator->next())
for (auto iterator: automaton_->succ(i->first.get()))
{
bdd c = iterator->current_condition();
if ((c & condition) != bddfalse)
@ -449,7 +446,6 @@ namespace spot
highest_current_ranks_[s] = i->second;
}
}
delete iterator;
}
// Highest $O$ set of the algorithm.
@ -460,8 +456,7 @@ namespace spot
i != s_set.end();
++i)
{
tgba_succ_iterator* iterator = automaton_->succ_iter(i->get());
for (iterator->first(); !iterator->done(); iterator->next())
for (auto iterator: automaton_->succ(i->get()))
{
bdd c = iterator->current_condition();
if ((c & condition) != bddfalse)
@ -470,7 +465,6 @@ namespace spot
highest_state_set_.insert(s);
}
}
delete iterator;
}
current_ranks_ = highest_current_ranks_;
@ -683,22 +677,18 @@ namespace spot
bdd
tgba_kv_complement::compute_support_conditions(const state* state) const
{
tgba_succ_iterator* i = succ_iter(state);
bdd result = bddtrue;
for (i->first(); !i->done(); i->next())
bdd result = bddfalse;
for (auto i: succ(state))
result |= i->current_condition();
delete i;
return result;
}
bdd
tgba_kv_complement::compute_support_variables(const state* state) const
{
tgba_succ_iterator* i = succ_iter(state);
bdd result = bddtrue;
for (i->first(); !i->done(); i->next())
for (auto i: succ(state))
result &= bdd_support(i->current_condition());
delete i;
return result;
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -36,8 +36,8 @@ namespace spot
{
~succ_iter_filtered()
{
for (first(); !done(); next())
it_->dest->destroy();
for (auto& t: trans_)
t.dest->destroy();
}
void first()
@ -138,15 +138,11 @@ namespace spot
tgba_succ_iterator*
tgba_mask::succ_iter(const state* local_state,
const state* global_state,
const tgba* global_automaton) const
const state*,
const tgba*) const
{
tgba_succ_iterator* it = original_->succ_iter(local_state,
global_state,
global_automaton);
succ_iter_filtered* res = new succ_iter_filtered;
for (it->first(); !it->done(); it->next())
for (auto it: original_->succ(local_state))
{
const state* s = it->current_state();
if (!wanted(s))
@ -159,7 +155,6 @@ namespace spot
it->current_acceptance_conditions() };
res->trans_.push_back(t);
}
delete it;
return res;
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -153,10 +153,9 @@ namespace spot
name = other.name;
parent = 0;
nodes = other.nodes;
for (child_list::const_iterator i = other.children.begin();
i != other.children.end(); ++i)
for (auto i: other.children)
{
safra_tree* c = new safra_tree(**i);
safra_tree* c = new safra_tree(*i);
c->parent = this;
children.push_back(c);
}
@ -170,11 +169,10 @@ namespace spot
safra_tree::~safra_tree()
{
for (child_list::iterator i = children.begin(); i != children.end(); ++i)
delete *i;
for (subset_t::iterator i = nodes.begin(); i != nodes.end(); ++i)
(*i)->destroy();
for (auto c: children)
delete c;
for (auto n: nodes)
n->destroy();
}
safra_tree&
@ -237,13 +235,10 @@ namespace spot
hash ^= wang32_hash(name);
hash ^= wang32_hash(marked);
for (subset_t::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
hash ^= (*i)->hash();
for (child_list::const_iterator i = children.begin();
i != children.end();
++i)
hash ^= (*i)->hash();
for (auto n: nodes)
hash ^= n->hash();
for (auto c: children)
hash ^= c->hash();
return hash;
}
@ -262,13 +257,12 @@ namespace spot
safra_tree::max_name() const
{
int max_name = name;
for (child_list::const_iterator i = children.begin();
i != children.end(); ++i)
max_name = std::max(max_name, (*i)->max_name());
for (auto c: children)
max_name = std::max(max_name, c->max_name());
return max_name;
}
/// \brief Get an unused name in the tree for a new node.
/// \brief Get a unused name in the tree for a new node.
///
/// The root of the tree maintains a list of unused names.
/// When this list is empty, new names are computed.
@ -287,9 +281,8 @@ namespace spot
const safra_tree* current = queue.front();
queue.pop_front();
used_names.insert(current->name);
for (child_list::const_iterator i = current->children.begin();
i != current->children.end(); ++i)
queue.push_back(*i);
for (auto c: current->children)
queue.push_back(c);
}
int l = 0;
@ -325,13 +318,13 @@ namespace spot
safra_tree*
safra_tree::branch_accepting(const sba& a)
{
for (child_list::iterator i = children.begin(); i != children.end(); ++i)
(*i)->branch_accepting(a);
for (auto c: children)
c->branch_accepting(a);
subset_t subset;
for (subset_t::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
if (a.state_is_accepting(*i))
subset.insert(*i);
for (auto n: nodes)
if (a.state_is_accepting(n))
subset.insert(n);
if (!subset.empty())
children.push_back(new safra_tree(subset, this, get_new_name()));
@ -354,22 +347,20 @@ namespace spot
{
subset_t new_subset;
for (subset_t::iterator i = nodes.begin(); i != nodes.end(); ++i)
for (auto n: nodes)
{
cache_t::const_iterator it = cache_transition.find(*i);
cache_t::const_iterator it = cache_transition.find(n);
if (it == cache_transition.end())
continue;
const tr_cache_t& transitions = it->second;
for (tr_cache_t::const_iterator t_it = transitions.begin();
t_it != transitions.end();
++t_it)
for (auto t: transitions)
{
if ((t_it->first & condition) != bddfalse)
if ((t.first & condition) != bddfalse)
{
if (new_subset.find(t_it->second) == new_subset.end())
if (new_subset.find(t.second) == new_subset.end())
{
const state* s = t_it->second->clone();
const state* s = t.second->clone();
new_subset.insert(s);
}
}
@ -377,8 +368,8 @@ namespace spot
}
nodes = new_subset;
for (child_list::iterator i = children.begin(); i != children.end(); ++i)
(*i)->succ_create(condition, cache_transition);
for (auto c: children)
c->succ_create(condition, cache_transition);
return this;
}
@ -391,18 +382,16 @@ namespace spot
safra_tree::normalize_siblings()
{
std::set<const state*, state_ptr_less_than> node_set;
for (child_list::iterator child_it = children.begin();
child_it != children.end();
++child_it)
for (auto c: children)
{
subset_t::iterator node_it = (*child_it)->nodes.begin();
while (node_it != (*child_it)->nodes.end())
subset_t::iterator node_it = c->nodes.begin();
while (node_it != c->nodes.end())
{
if (!node_set.insert(*node_it).second)
{
const state* s = *node_it;
(*child_it)->remove_node_from_children(*node_it);
(*child_it)->nodes.erase(node_it++);
c->remove_node_from_children(*node_it);
c->nodes.erase(node_it++);
s->destroy();
}
else
@ -411,7 +400,7 @@ namespace spot
}
}
(*child_it)->normalize_siblings();
c->normalize_siblings();
}
return this;
@ -421,18 +410,16 @@ namespace spot
void
safra_tree::remove_node_from_children(const state* state)
{
for (child_list::iterator child_it = children.begin();
child_it != children.end();
++child_it)
for (auto c: children)
{
subset_t::iterator it = (*child_it)->nodes.find(state);
if (it != (*child_it)->nodes.end())
subset_t::iterator it = c->nodes.find(state);
if (it != c->nodes.end())
{
const spot::state* s = *it;
(*child_it)->nodes.erase(it);
c->nodes.erase(it);
s->destroy();
}
(*child_it)->remove_node_from_children(state);
c->remove_node_from_children(state);
}
}
@ -470,12 +457,10 @@ namespace spot
safra_tree::mark()
{
std::set<const state*, state_ptr_less_than> node_set;
for (child_list::const_iterator child_it = children.begin();
child_it != children.end();
++child_it)
for (auto c: children)
{
node_set.insert((*child_it)->nodes.begin(), (*child_it)->nodes.end());
(*child_it)->mark();
node_set.insert(c->nodes.begin(), c->nodes.end());
c->mark();
}
char same = node_set.size() == nodes.size();
@ -500,10 +485,8 @@ namespace spot
if (same)
{
marked = true;
for (child_list::iterator i = children.begin();
i != children.end();
++i)
delete *i;
for (auto c: children)
delete c;
children = child_list();
}
@ -526,10 +509,8 @@ namespace spot
assert(bitset.size() > static_cast<unsigned>(name));
if (marked && !nodes.empty())
bitset.set(name);
for (child_list::const_iterator i = children.begin();
i != children.end();
++i)
(*i)->getL(bitset);
for (auto c: children)
c->getL(bitset);
}
/// Returns in which sets U (the semantic differs according to Rabin or
@ -544,10 +525,8 @@ namespace spot
assert(bitset.size() > static_cast<unsigned>(name));
if (!nodes.empty())
bitset.clear(name);
for (child_list::const_iterator i = children.begin();
i != children.end();
++i)
(*i)->getU(bitset);
for (auto c: children)
c->getU(bitset);
}
bool
@ -632,12 +611,11 @@ namespace spot
// Create successors of the Safra's tree.
safra_tree_automaton::transition_list transitions;
for (conjunction_list_t::const_iterator i = conjunction.begin();
i != conjunction.end(); ++i)
for (auto i: conjunction)
{
safra_tree* successor = new safra_tree(*current);
successor->branch_accepting(*sba_aut); // Step 2
successor->succ_create(*i, cache); // Step 3
successor->succ_create(i, cache); // Step 3
successor->normalize_siblings(); // Step 4
successor->remove_empty(); // Step 5
successor->mark(); // Step 6
@ -646,7 +624,7 @@ namespace spot
safra_tree_ptr_equal comparator(successor);
if (st->automaton.find(successor) != st->automaton.end())
{
transitions[*i] = st->automaton.find(successor)->first;
transitions[i] = st->automaton.find(successor)->first;
}
else
{
@ -654,12 +632,12 @@ namespace spot
std::find_if(queue.begin(), queue.end(), comparator);
if (item_in_queue != queue.end())
{
transitions[*i] = *item_in_queue;
transitions[i] = *item_in_queue;
}
else
{
delete_this_successor = false;
transitions[*i] = successor;
transitions[i] = successor;
queue.push_back(successor);
}
}
@ -672,13 +650,9 @@ namespace spot
queue.pop_front();
for (safra_tree::cache_t::iterator i = cache.begin();
i != cache.end();
++i)
for (safra_tree::tr_cache_t::iterator j = i->second.begin();
j != i->second.end();
++j)
j->second->destroy();
for (auto i: cache)
for (auto j: i.second)
j.second->destroy();
// delete node;
}
@ -694,21 +668,17 @@ namespace spot
safra_tree::cache_t& cache,
atomic_list_t& atomic_list)
{
for (safra_tree::subset_t::iterator it = node->nodes.begin();
it != node->nodes.end();
++it)
for (auto n: node->nodes)
{
safra_tree::tr_cache_t transitions;
tgba_succ_iterator* iterator = sba_aut->succ_iter(*it);
for (iterator->first(); !iterator->done(); iterator->next())
for (auto iterator: sba_aut->succ(n))
{
bdd condition = iterator->current_condition();
typedef std::pair<bdd, const state*> bdd_state;
transitions.insert(bdd_state(condition, iterator->current_state()));
set_atomic_list(atomic_list, condition);
}
delete iterator;
cache[*it] = transitions;
cache[n] = transitions;
}
}
@ -741,16 +711,15 @@ namespace spot
{
bdd result = bddtrue;
unsigned position = 1;
for (atomic_list_t::const_iterator a_it = atomics.begin();
a_it != atomics.end();
++a_it, position <<= 1)
for (auto a: atomics)
{
bdd this_atomic;
if (position & i)
this_atomic = bdd_ithvar(*a_it);
this_atomic = bdd_ithvar(a);
else
this_atomic = bdd_nithvar(*a_it);
result = bdd_apply(result, this_atomic, bddop_and);
this_atomic = bdd_nithvar(a);
result &= this_atomic;
position <<= 1;
}
list.insert(result);
}
@ -787,14 +756,12 @@ namespace spot
std::cout << "node" << this_node << "[label=\"";
std::cout << this_node->name << "|";
for (safra_tree::subset_t::const_iterator j = this_node->nodes.begin();
j != this_node->nodes.end();
++j)
for (auto j: this_node->nodes)
{
stnum_t::const_iterator it = node_names.find(*j);
stnum_t::const_iterator it = node_names.find(j);
int name;
if (it == node_names.end())
name = node_names[*j] = current_node++;
name = node_names[j] = current_node++;
else
name = it->second;
std::cout << name << ", ";
@ -820,8 +787,6 @@ namespace spot
{
typedef safra_tree_automaton::automaton_t::reverse_iterator
automaton_cit;
typedef safra_tree_automaton::transition_list::const_iterator
trans_cit;
stnum_t node_names;
int current_node = 0;
int nb_accepting_conditions = a->get_nb_acceptance_pairs();
@ -840,20 +805,19 @@ namespace spot
std::cout << "}" << std::endl;
// Successors.
for (trans_cit j = i->second.begin(); j != i->second.end(); ++j)
for (const auto& j: i->second)
std::cout << "node" << i->first << "->"
<< "node" << j->second <<
" [label=\"" << bddset << j->first << "\"];" << std::endl;
<< "node" << j.second <<
" [label=\"" << bddset << j.first << "\"];" << std::endl;
}
// Output the real name of all states.
std::cout << "{ rank=sink; legend [shape=none,margin=0,label=<\n"
<< "<TABLE BORDER='1' CELLBORDER='0' CELLSPACING='0'>\n";
for (stnum_t::const_iterator it = node_names.begin();
it != node_names.end(); ++it)
std::cout << "<TR><TD>" << it->second << "</TD><TD>"
<< a->get_sba()->format_state(it->first)
for (const auto& nn: node_names)
std::cout << "<TR><TD>" << nn.second << "</TD><TD>"
<< a->get_sba()->format_state(nn.first)
<< "</TD></TR>\n";
std::cout << "</TABLE>\n"
<< ">]}" << std::endl;
@ -1008,8 +972,8 @@ namespace spot
virtual
~tgba_safra_complement_succ_iterator()
{
for (succ_list_t::iterator i = list_.begin(); i != list_.end(); ++i)
delete i->second;
for (auto& p: list_)
delete p.second;
}
virtual void first();
@ -1076,12 +1040,8 @@ namespace spot
safra_tree_automaton::~safra_tree_automaton()
{
for (automaton_t::iterator i = automaton.begin();
i != automaton.end();
++i)
{
delete i->first;
}
for (auto& p: automaton)
delete p.first;
delete a_;
}
@ -1092,10 +1052,8 @@ namespace spot
return max_nb_pairs_;
int max = -1;
for (automaton_t::const_iterator i = automaton.begin();
i != automaton.end();
++i)
max = std::max(max, i->first->max_name());
for (auto& p: automaton)
max = std::max(max, p.first->max_name());
return max_nb_pairs_ = max + 1;
}
@ -1215,8 +1173,6 @@ namespace spot
safra_tree_automaton::automaton_t::const_iterator tr =
a->automaton.find(const_cast<safra_tree*>(s->get_safra()));
typedef safra_tree_automaton::transition_list::const_iterator trans_iter;
if (tr != a->automaton.end())
{
bdd condition = bddfalse;
@ -1226,14 +1182,14 @@ namespace spot
if (!s->get_use_bitset()) // if \delta'(q, a)
{
for (trans_iter i = tr->second.begin(); i != tr->second.end(); ++i)
for (auto& p: tr->second)
{
state_complement* s1 = new state_complement(e->clone(), e->clone(),
i->second, false);
p.second, false);
state_complement* s2 = new state_complement(e->clone(), e->clone(),
i->second, true);
succ_list.insert(std::make_pair(i->first, s1));
succ_list.insert(std::make_pair(i->first, s2));
p.second, true);
succ_list.insert(std::make_pair(p.first, s1));
succ_list.insert(std::make_pair(p.first, s2));
}
}
else
@ -1254,19 +1210,19 @@ namespace spot
// \delta'((q, I, J), a) if I'\subseteq J'
if (newI->is_subset_of(*newJ))
{
for (trans_iter i = tr->second.begin(); i != tr->second.end(); ++i)
for (auto& p: tr->second)
{
st = new state_complement(e->clone(), e->clone(), i->second, true);
succ_list.insert(std::make_pair(i->first, st));
st = new state_complement(e->clone(), e->clone(), p.second, true);
succ_list.insert(std::make_pair(p.first, st));
}
condition = the_acceptance_cond_;
}
else // \delta'((q, I, J), a)
{
for (trans_iter i = tr->second.begin(); i != tr->second.end(); ++i)
for (auto& p: tr->second)
{
st = new state_complement(newI, newJ, i->second, true);
succ_list.insert(std::make_pair(i->first, st));
st = new state_complement(newI, newJ, p.second, true);
succ_list.insert(std::make_pair(p.first, st));
}
}
delete newI;
@ -1277,11 +1233,11 @@ namespace spot
bitvect* pending = S.clone();
*pending |= *l;
*pending -= *u;
for (trans_iter i = tr->second.begin(); i != tr->second.end(); ++i)
for (auto& p: tr->second)
{
st = new state_complement(pending->clone(), e->clone(),
i->second, true);
succ_list.insert(std::make_pair(i->first, st));
p.second, true);
succ_list.insert(std::make_pair(p.first, st));
}
delete pending;
@ -1341,16 +1297,14 @@ namespace spot
const state_complement* s = down_cast<const state_complement*>(state);
assert(s);
typedef safra_tree_automaton::automaton_t::const_iterator auto_it;
typedef safra_tree_automaton::transition_list::const_iterator trans_it;
auto_it node(a->automaton.find(const_cast<safra_tree*>(s->get_safra())));
if (node == a->automaton.end())
return bddtrue;
bdd res = bddtrue;
trans_it i;
for (i = node->second.begin(); i != node->second.end(); ++i)
res |= i->first;
for (auto& i: node->second)
res |= i.first;
return res;
}
@ -1361,16 +1315,14 @@ namespace spot
const state_complement* s = down_cast<const state_complement*>(state);
assert(s);
typedef safra_tree_automaton::automaton_t::const_iterator auto_it;
typedef safra_tree_automaton::transition_list::const_iterator trans_it;
auto_it node(a->automaton.find(const_cast<safra_tree*>(s->get_safra())));
if (node == a->automaton.end())
return bddtrue;
bdd res = bddtrue;
trans_it i;
for (i = node->second.begin(); i != node->second.end(); ++i)
res &= bdd_support(i->first);
for (auto& i: node->second)
res &= bdd_support(i.first);
return res;
}

View file

@ -1,8 +1,9 @@
// Copyright (C) 2010, 2011, 2012, 2013 Laboratoire de Recherche et
// Développement de l'Epita.
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche
// et Développement de l'Epita.
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -517,10 +518,12 @@ namespace spot
return i->second;
bdd common = a_->all_acceptance_conditions();
tgba_succ_iterator* it = a_->succ_iter(s);
for (it->first(); !it->done() && common != bddfalse; it->next())
common &= it->current_acceptance_conditions();
delete it;
for (auto it: a_->succ(s))
{
common &= it->current_acceptance_conditions();
if (common == bddfalse)
break;
}
// Populate cache
accmap_[s->clone()] = common;
@ -537,10 +540,8 @@ namespace spot
return i->second;
bdd common = bddfalse;
tgba_succ_iterator* it = a_->succ_iter(s);
for (it->first(); !it->done(); it->next())
for (auto it: a_->succ(s))
common |= it->current_acceptance_conditions();
delete it;
// Populate cache
accmapu_[s->clone()] = common;
@ -618,8 +619,7 @@ namespace spot
bdd all = a->all_acceptance_conditions();
state* init = a->get_init_state();
tgba_succ_iterator* it = a->succ_iter(init);
for (it->first(); !it->done(); it->next())
for (auto it: a->succ(init))
{
// Look only for transitions that are accepting.
if (all != it->current_acceptance_conditions())
@ -635,13 +635,11 @@ namespace spot
// The cycle_start_ points to the right starting
// point already, so just return.
dest->destroy();
delete it;
init->destroy();
return;
}
dest->destroy();
}
delete it;
init->destroy();
}