Store membership to acceptance sets using bitsets, not BDDs.

This is a huge patch, that took over a month to complete.  The bit sets
are currently restricted to what 'unsigned can store', but it should be
easy to extend it to 'uint64_t' should we need it.

* NEWS: Update.
* src/tgba/acc.hh: New file.
* src/tgbatest/acc.cc, src/tgbatest/acc.test: Test it.
* src/tgba/tgbakvcomplement.cc, src/tgba/tgbakvcomplement.hh,
src/tgba/tgbasgba.cc, src/tgba/tgbasgba.hh: Delete.  The KV
complementation is too slow to be used in practice, and I somehow broke
it during the conversion to bitsets.  The tgba->sgba conversion was only
used for the KV complementation, and should be better redone on
tgba_digraph_ptr should it be needed again.
* src/bin/ltlcross.cc, src/dstarparse/dra2ba.cc,
src/dstarparse/nsa2tgba.cc, src/graphtest/tgbagraph.cc,
src/graphtest/tgbagraph.test, src/kripke/fairkripke.cc,
src/kripke/fairkripke.hh, src/kripke/kripke.cc, src/kripke/kripke.hh,
src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh,
src/misc/hash.hh, src/neverparse/neverclaimparse.yy, src/priv/accmap.hh,
src/ta/ta.cc, src/ta/ta.hh, src/ta/taexplicit.cc, src/ta/taexplicit.hh,
src/ta/taproduct.cc, src/ta/taproduct.hh, src/ta/tgta.cc,
src/ta/tgta.hh, src/ta/tgtaexplicit.cc, src/ta/tgtaexplicit.hh,
src/ta/tgtaproduct.cc, src/ta/tgtaproduct.hh, src/taalgos/dotty.cc,
src/taalgos/emptinessta.cc, src/taalgos/minimize.cc,
src/taalgos/tgba2ta.cc, src/tgba/Makefile.am, src/tgba/fwd.hh,
src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgba/tgba.cc,
src/tgba/tgba.hh, src/tgba/tgbagraph.cc, src/tgba/tgbagraph.hh,
src/tgba/tgbamask.cc, src/tgba/tgbamask.hh, src/tgba/tgbaproduct.cc,
src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh,
src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh,
src/tgbaalgos/bfssteps.cc, src/tgbaalgos/complete.cc,
src/tgbaalgos/compsusp.cc, src/tgbaalgos/degen.cc,
src/tgbaalgos/dotty.cc, src/tgbaalgos/dtbasat.cc,
src/tgbaalgos/dtgbacomp.cc, src/tgbaalgos/dtgbasat.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/emptiness.cc,
src/tgbaalgos/emptiness.hh, src/tgbaalgos/gtec/ce.cc,
src/tgbaalgos/gtec/gtec.cc, src/tgbaalgos/gtec/gtec.hh,
src/tgbaalgos/gtec/sccstack.cc, src/tgbaalgos/gtec/sccstack.hh,
src/tgbaalgos/gv04.cc, src/tgbaalgos/hoaf.cc,
src/tgbaalgos/isweakscc.cc, src/tgbaalgos/lbtt.cc,
src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/magic.cc,
src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/neverclaim.cc,
src/tgbaalgos/postproc.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh,
src/tgbaalgos/reducerun.cc, src/tgbaalgos/replayrun.cc,
src/tgbaalgos/safety.cc, src/tgbaalgos/save.cc, src/tgbaalgos/scc.cc,
src/tgbaalgos/scc.hh, src/tgbaalgos/sccfilter.cc,
src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh,
src/tgbaalgos/se05.cc, src/tgbaalgos/simulation.cc,
src/tgbaalgos/simulation.hh, src/tgbaalgos/stats.cc,
src/tgbaalgos/stripacc.cc, src/tgbaalgos/tau03.cc,
src/tgbaalgos/tau03opt.cc, src/tgbaalgos/weight.cc,
src/tgbaalgos/weight.hh, src/tgbaparse/tgbaparse.yy,
src/tgbatest/Makefile.am, src/tgbatest/complementation.cc,
src/tgbatest/complementation.test, src/tgbatest/degenlskip.test,
src/tgbatest/det.test, src/tgbatest/dstar.test, src/tgbatest/emptchk.cc,
src/tgbatest/explpro2.test, src/tgbatest/explpro3.test,
src/tgbatest/explpro4.test, src/tgbatest/explprod.test,
src/tgbatest/ltl2tgba.cc, src/tgbatest/ltl2tgba.test,
src/tgbatest/maskacc.cc, src/tgbatest/maskacc.test,
src/tgbatest/neverclaimread.test, src/tgbatest/randtgba.cc,
src/tgbatest/readsave.test, src/tgbatest/sim.test,
src/tgbatest/sim2.test, src/tgbatest/spotlbtt.test,
src/tgbatest/tgbaread.test, src/tgbatest/tripprod.test,
iface/dve2/dve2.cc: Adjust or use to the new acceptance interface.
This commit is contained in:
Alexandre Duret-Lutz 2014-09-29 18:17:34 +02:00
parent 37ece2b878
commit 2c764fb3c7
125 changed files with 1950 additions and 3254 deletions

View file

@ -28,7 +28,7 @@ namespace spot
{
index = i;
is_accepting = false;
condition = bddfalse;
condition = 0U;
}
scc_stack_ta::connected_component&

View file

@ -76,8 +76,15 @@ namespace spot
class SPOT_API ta
{
protected:
acc_cond acc_;
public:
ta(const bdd_dict_ptr& d)
: acc_(d)
{
}
virtual
~ta()
{
@ -128,8 +135,11 @@ namespace spot
/// This is useful when dealing with several automata (which
/// may use the same BDD variable for different formula),
/// or simply when printing.
virtual bdd_dict_ptr
get_dict() const = 0;
bdd_dict_ptr
get_dict() const
{
return acc_.get_dict();
}
/// \brief Format the state as a string for printing.
///
@ -160,17 +170,16 @@ namespace spot
virtual void
free_state(const spot::state* s) const = 0;
/// \brief Return the set of all acceptance conditions used
/// by this automaton
/// (for Generalized form: Transition-based Generalized Testing Automata).
///
/// The goal of the emptiness check is to ensure that
/// a strongly connected component walks through each
/// of these acceptiong conditions. I.e., the union
/// of the acceptiong conditions of all transition in
/// the SCC should be equal to the result of this function.
virtual bdd
all_acceptance_conditions() const = 0;
const acc_cond& acc() const
{
return acc_;
}
acc_cond& acc()
{
return acc_;
}
};
@ -206,7 +215,7 @@ namespace spot
virtual bdd
current_condition() const = 0;
bdd
acc_cond::mark_t
current_acceptance_conditions() const = 0;
};
@ -228,7 +237,7 @@ namespace spot
/// The bdd condition is the union of all acceptance conditions of
/// transitions which connect the states of the connected component.
bdd condition;
acc_cond::mark_t condition;
std::list<state*> rem;
};

View file

@ -97,7 +97,7 @@ namespace spot
return (*i_)->condition;
}
bdd
acc_cond::mark_t
ta_explicit_succ_iterator::current_acceptance_conditions() const
{
assert(!done());
@ -352,13 +352,14 @@ namespace spot
ta_explicit::ta_explicit(const const_tgba_ptr& tgba,
bdd all_acceptance_conditions,
unsigned n_acc,
state_ta_explicit* artificial_initial_state):
ta(tgba->get_dict()),
tgba_(tgba),
all_acceptance_conditions_(all_acceptance_conditions),
artificial_initial_state_(artificial_initial_state)
{
get_dict()->register_all_variables_of(&tgba_, this);
acc().add_sets(n_acc);
if (artificial_initial_state != 0)
{
state_ta_explicit* is = add_state(artificial_initial_state);
@ -403,7 +404,7 @@ namespace spot
{
state_ta_explicit* i =
down_cast<state_ta_explicit*>(get_artificial_initial_state());
create_transition(i, condition, bddfalse, s);
create_transition(i, condition, 0U, s);
}
}
@ -420,7 +421,7 @@ namespace spot
void
ta_explicit::create_transition(state_ta_explicit* source, bdd condition,
bdd acceptance_conditions,
acc_cond::mark_t acceptance_conditions,
state_ta_explicit* dest, bool add_at_beginning)
{
state_ta_explicit::transition* t = new state_ta_explicit::transition;

View file

@ -41,7 +41,8 @@ namespace spot
class SPOT_API ta_explicit : public ta
{
public:
ta_explicit(const const_tgba_ptr& tgba, bdd all_acceptance_conditions,
ta_explicit(const const_tgba_ptr& tgba,
unsigned n_acc,
state_ta_explicit* artificial_initial_state = 0);
const_tgba_ptr
@ -55,8 +56,9 @@ namespace spot
void
create_transition(state_ta_explicit* source, bdd condition,
bdd acceptance_conditions, state_ta_explicit* dest,
bool add_at_beginning = false);
acc_cond::mark_t acceptance_conditions,
state_ta_explicit* dest,
bool add_at_beginning = false);
void
delete_stuttering_transitions();
@ -115,27 +117,12 @@ namespace spot
return states_set_;
}
/// \brief Return the set of all acceptance conditions used
/// by this automaton.
///
/// The goal of the emptiness check is to ensure that
/// a strongly connected component walks through each
/// of these acceptiong conditions. I.e., the union
/// of the acceptiong conditions of all transition in
/// the SCC should be equal to the result of this function.
bdd
all_acceptance_conditions() const
{
return all_acceptance_conditions_;
}
private:
// Disallow copy.
ta_explicit(const ta_explicit& other) SPOT_DELETED;
ta_explicit& operator=(const ta_explicit& other) SPOT_DELETED;
const_tgba_ptr tgba_;
bdd all_acceptance_conditions_;
state_ta_explicit* artificial_initial_state_;
ta::states_set_t states_set_;
ta::states_set_t initial_states_set_;
@ -152,7 +139,7 @@ namespace spot
struct transition
{
bdd condition;
bdd acceptance_conditions;
acc_cond::mark_t acceptance_conditions;
state_ta_explicit* dest;
};
@ -255,7 +242,7 @@ namespace spot
virtual bdd
current_condition() const;
virtual bdd
virtual acc_cond::mark_t
current_acceptance_conditions() const;
private:
@ -267,13 +254,11 @@ namespace spot
typedef std::shared_ptr<const ta_explicit> const_ta_explicit_ptr;
inline ta_explicit_ptr make_ta_explicit(const const_tgba_ptr& tgba,
bdd all_acceptance_conditions,
unsigned n_acc,
state_ta_explicit*
artificial_initial_state = 0)
{
return std::make_shared<ta_explicit>(tgba,
all_acceptance_conditions,
artificial_initial_state);
return std::make_shared<ta_explicit>(tgba, n_acc, artificial_initial_state);
}
}

View file

@ -190,7 +190,7 @@ namespace spot
//if stuttering transition, the TA automata stays in the same state
current_state_ = new state_ta_product(source_->get_ta_state(),
kripke_current_dest_state->clone());
current_acceptance_conditions_ = bddfalse;
current_acceptance_conditions_ = 0U;
return true;
}
@ -232,7 +232,7 @@ namespace spot
return current_condition_;
}
bdd
acc_cond::mark_t
ta_succ_iterator_product::current_acceptance_conditions() const
{
return current_acceptance_conditions_;
@ -244,6 +244,7 @@ namespace spot
ta_product::ta_product(const const_ta_ptr& testing_automata,
const const_kripke_ptr& kripke_structure):
ta(testing_automata->get_dict()),
dict_(testing_automata->get_dict()),
ta_(testing_automata),
kripke_(kripke_structure)
@ -387,12 +388,6 @@ namespace spot
return is_hole_state;
}
bdd
ta_product::all_acceptance_conditions() const
{
return get_ta()->all_acceptance_conditions();
}
bdd
ta_product::get_state_condition(const spot::state* s) const
{

View file

@ -93,7 +93,7 @@ namespace spot
bdd
current_condition() const;
bdd
acc_cond::mark_t
current_acceptance_conditions() const;
/// \brief Return true if the changeset of the current transition is empty
@ -120,7 +120,7 @@ namespace spot
tgba_succ_iterator* kripke_succ_it_;
state_ta_product* current_state_;
bdd current_condition_;
bdd current_acceptance_conditions_;
acc_cond::mark_t current_acceptance_conditions_;
bool is_stuttering_transition_;
bdd kripke_source_condition;
state * kripke_current_dest_state;
@ -174,9 +174,6 @@ namespace spot
virtual bdd
get_state_condition(const spot::state* s) const;
virtual bdd
all_acceptance_conditions() const;
virtual void
free_state(const spot::state* s) const;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement
// Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -22,11 +22,9 @@
namespace spot
{
tgta::tgta()
{};
tgta::~tgta()
{};
tgta::tgta(const bdd_dict_ptr& d)
: tgba(d)
{};
tgta::~tgta()
{};
}

View file

@ -62,9 +62,9 @@ namespace spot
{
protected:
tgta();
public:
tgta(const bdd_dict_ptr& d);
public:
virtual
~tgta();

View file

@ -30,10 +30,10 @@ namespace spot
{
tgta_explicit::tgta_explicit(const const_tgba_ptr& tgba,
bdd all_acceptance_conditions,
unsigned n_acc,
state_ta_explicit* artificial_initial_state) :
ta_(make_ta_explicit(tgba, all_acceptance_conditions,
artificial_initial_state))
tgta(tgba->get_dict()),
ta_(make_ta_explicit(tgba, n_acc, artificial_initial_state))
{
}
@ -63,18 +63,6 @@ namespace spot
return ta_->get_dict();
}
bdd
tgta_explicit::all_acceptance_conditions() const
{
return ta_->all_acceptance_conditions();
}
bdd
tgta_explicit::neg_acceptance_conditions() const
{
return ta_->get_tgba()->neg_acceptance_conditions();
}
std::string
tgta_explicit::format_state(const spot::state* s) const
{

View file

@ -39,7 +39,7 @@ namespace spot
{
public:
tgta_explicit(const const_tgba_ptr& tgba,
bdd all_acceptance_conditions,
unsigned n_acc,
state_ta_explicit* artificial_initial_state);
// tgba interface
@ -54,9 +54,6 @@ namespace spot
const_ta_explicit_ptr get_ta() const { return ta_; }
ta_explicit_ptr get_ta() { return ta_; }
virtual bdd all_acceptance_conditions() const;
virtual bdd neg_acceptance_conditions() const;
virtual std::string format_state(const spot::state* s) const;
virtual tgba_succ_iterator*
@ -71,12 +68,11 @@ namespace spot
typedef std::shared_ptr<const tgta_explicit> const_tgta_explicit_ptr;
inline tgta_explicit_ptr make_tgta_explicit(const const_tgba_ptr& tgba,
bdd all_acceptance_conditions,
unsigned n_acc,
state_ta_explicit*
artificial_initial_state = 0)
{
return std::make_shared<tgta_explicit>(tgba,
all_acceptance_conditions,
return std::make_shared<tgta_explicit>(tgba, n_acc,
artificial_initial_state);
}
}

View file

@ -207,7 +207,7 @@ namespace spot
kripke_current_dest_state->clone(),
tgta_succ_it_->current_state(), pool_);
current_acceptance_conditions_
= tgta_succ_it_->current_acceptance_conditions();
= tgta_succ_it_->current_acceptance_conditions();
return true;
}
@ -244,7 +244,7 @@ namespace spot
return current_condition_;
}
bdd
acc_cond::mark_t
tgta_succ_iterator_product::current_acceptance_conditions() const
{
return current_acceptance_conditions_;

View file

@ -72,7 +72,7 @@ namespace spot
bdd
current_condition() const;
bdd
acc_cond::mark_t
current_acceptance_conditions() const;
private:
@ -96,7 +96,7 @@ namespace spot
tgba_succ_iterator* kripke_succ_it_;
state_product* current_state_;
bdd current_condition_;
bdd current_acceptance_conditions_;
acc_cond::mark_t current_acceptance_conditions_;
bdd kripke_source_condition;
state* kripke_current_dest_state;
};