Replace most uses of scc_map by scc_info.
This involves reimplementing some algorithms using tgba_digraph, and implementing an explicit product that takes two tgba_digraphs and produces a tgba_digraph. * src/tgbaalgos/product.cc, src/tgbaalgos/product.hh: New files. * src/tgbaalgos/Makefile.am: Adjust. * src/bin/ltlcross.cc, src/tgba/tgba.cc, src/tgba/tgba.hh, src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh, src/tgbaalgos/cycles.cc, src/tgbaalgos/cycles.hh, src/tgbaalgos/degen.cc, src/tgbaalgos/degen.hh, src/tgbaalgos/isweakscc.cc, src/tgbaalgos/isweakscc.hh, src/tgbaalgos/minimize.cc, src/tgbaalgos/minimize.hh, src/tgbaalgos/powerset.cc, src/tgbaalgos/powerset.hh, src/tgbaalgos/safety.cc, src/tgbaalgos/safety.hh, src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh, src/tgbatest/complementation.cc, src/tgbatest/emptchk.cc, src/tgbatest/ltl2ta.test, src/tgbatest/ltl2tgba.cc, src/tgbatest/randtgba.cc: Update to use scc_info and/or tgba_digraph.
This commit is contained in:
parent
b6745482af
commit
2fb436a174
27 changed files with 497 additions and 394 deletions
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "tgba.hh"
|
||||
#include "tgbaalgos/gtec/gtec.hh"
|
||||
#include <utility>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -38,6 +39,10 @@ namespace spot
|
|||
if (last_support_conditions_input_)
|
||||
last_support_conditions_input_->destroy();
|
||||
delete iter_cache_;
|
||||
|
||||
// Destroy all named properties.
|
||||
for (auto& np: named_prop_)
|
||||
np.second.second(np.second.first);
|
||||
}
|
||||
|
||||
bdd
|
||||
|
|
@ -78,4 +83,30 @@ namespace spot
|
|||
return !couvreur99(shared_from_this())->check();
|
||||
}
|
||||
|
||||
void
|
||||
tgba::set_named_prop(std::string s,
|
||||
void* val, std::function<void(void*)> destructor)
|
||||
{
|
||||
auto p = named_prop_.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(s),
|
||||
std::forward_as_tuple(val, destructor));
|
||||
if (!p.second)
|
||||
{
|
||||
p.first->second.second(p.first->second.first);
|
||||
p.first->second = std::make_pair(val, destructor);
|
||||
}
|
||||
}
|
||||
|
||||
void*
|
||||
tgba::get_named_prop(std::string s) const
|
||||
{
|
||||
auto i = named_prop_.find(s);
|
||||
if (i == named_prop_.end())
|
||||
return nullptr;
|
||||
return i->second.first;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#include "acc.hh"
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
#include "misc/casts.hh"
|
||||
#include "misc/hash.hh"
|
||||
|
||||
|
|
@ -657,8 +659,20 @@ namespace spot
|
|||
bprop is;
|
||||
};
|
||||
|
||||
#ifndef SWIG
|
||||
// Dynamic properties, are given with a name and a destructor function.
|
||||
std::unordered_map<std::string,
|
||||
std::pair<void*,
|
||||
std::function<void(void*)>>> named_prop_;
|
||||
#endif
|
||||
public:
|
||||
|
||||
#ifndef SWIG
|
||||
void set_named_prop(std::string s,
|
||||
void* val, std::function<void(void*)> destructor);
|
||||
void* get_named_prop(std::string s) const;
|
||||
#endif
|
||||
|
||||
bool has_single_acc_set() const
|
||||
{
|
||||
return is.single_acc_set;
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
static safra_tree_automaton*
|
||||
create_safra_automaton(const const_tgba_ptr& a);
|
||||
create_safra_automaton(const const_tgba_digraph_ptr& a);
|
||||
private:
|
||||
typedef std::set<int> atomic_list_t;
|
||||
typedef std::set<bdd, bdd_less_than> conjunction_list_t;
|
||||
|
|
@ -585,7 +585,8 @@ namespace spot
|
|||
|
||||
/// \brief The body of Safra's construction.
|
||||
safra_tree_automaton*
|
||||
safra_determinisation::create_safra_automaton(const const_tgba_ptr& a)
|
||||
safra_determinisation::create_safra_automaton
|
||||
(const const_tgba_digraph_ptr& a)
|
||||
{
|
||||
// initialization.
|
||||
auto sba_aut = degeneralize(a);
|
||||
|
|
@ -1074,7 +1075,7 @@ namespace spot
|
|||
// tgba_safra_complement
|
||||
//////////////////////////
|
||||
|
||||
tgba_safra_complement::tgba_safra_complement(const const_tgba_ptr& a)
|
||||
tgba_safra_complement::tgba_safra_complement(const const_tgba_digraph_ptr& a)
|
||||
: tgba(a->get_dict()), automaton_(a),
|
||||
safra_(safra_determinisation::create_safra_automaton(a))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace spot
|
|||
class SPOT_API tgba_safra_complement : public tgba
|
||||
{
|
||||
public:
|
||||
tgba_safra_complement(const const_tgba_ptr& a);
|
||||
tgba_safra_complement(const const_tgba_digraph_ptr& a);
|
||||
virtual ~tgba_safra_complement();
|
||||
|
||||
// tgba interface.
|
||||
|
|
@ -67,7 +67,7 @@ namespace spot
|
|||
protected:
|
||||
virtual bdd compute_support_conditions(const state* state) const;
|
||||
private:
|
||||
const_tgba_ptr automaton_;
|
||||
const_tgba_digraph_ptr automaton_;
|
||||
void* safra_;
|
||||
#if TRANSFORM_TO_TBA
|
||||
acc_cond::mark_t the_acceptance_cond_;
|
||||
|
|
@ -82,7 +82,7 @@ namespace spot
|
|||
typedef std::shared_ptr<const tgba_safra_complement>
|
||||
const_tgba_safra_complement_ptr;
|
||||
inline tgba_safra_complement_ptr
|
||||
make_safra_complement(const const_tgba_ptr& a)
|
||||
make_safra_complement(const const_tgba_digraph_ptr& a)
|
||||
{
|
||||
return std::make_shared<tgba_safra_complement>(a);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue