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:
Alexandre Duret-Lutz 2014-10-07 18:21:37 +02:00
parent b6745482af
commit 2fb436a174
27 changed files with 497 additions and 394 deletions

View file

@ -122,7 +122,7 @@ int main(int argc, char* argv[])
{
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_ptr a = spot::tgba_parse(file, pel, dict, env);
spot::tgba_digraph_ptr a = spot::tgba_parse(file, pel, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, file, pel))
return 2;
@ -147,15 +147,13 @@ int main(int argc, char* argv[])
}
else if (print_formula)
{
spot::tgba_ptr a;
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;
a = spot::ltl_to_tgba_fm(f1, dict);
auto a = spot::ltl_to_tgba_fm(f1, dict);
spot::tgba_ptr complement = 0;
complement = spot::make_safra_complement(a);
@ -164,7 +162,7 @@ int main(int argc, char* argv[])
}
else if (stats)
{
spot::tgba_ptr a;
spot::tgba_digraph_ptr a;
const spot::ltl::formula* f1 = 0;
if (formula)
@ -211,10 +209,8 @@ int main(int argc, char* argv[])
if (formula)
{
const spot::ltl::formula* nf1 =
spot::ltl::unop::instance(spot::ltl::unop::Not,
f1->clone());
spot::tgba_ptr a2 = spot::ltl_to_tgba_fm(nf1, dict);
auto nf1 = spot::ltl::unop::instance(spot::ltl::unop::Not, f1->clone());
auto a2 = spot::ltl_to_tgba_fm(nf1, dict);
spot::tgba_statistics a_size = spot::stats_reachable(a2);
std::cout << "Not Formula: "
<< a_size.states << ", "
@ -234,14 +230,11 @@ int main(int argc, char* argv[])
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;
spot::tgba_ptr Af = spot::ltl_to_tgba_fm(f1, dict);
const spot::ltl::formula* nf1 =
spot::ltl::unop::instance(spot::ltl::unop::Not, f1->clone());
spot::tgba_ptr Anf = spot::ltl_to_tgba_fm(nf1, dict);
spot::tgba_ptr nAf = spot::make_safra_complement(Af);
spot::tgba_ptr nAnf = spot::make_safra_complement(Anf);
auto Af = spot::ltl_to_tgba_fm(f1, dict);
auto nf1 = spot::ltl::unop::instance(spot::ltl::unop::Not, f1->clone());
auto Anf = spot::ltl_to_tgba_fm(nf1, dict);
auto nAf = spot::make_safra_complement(Af);
auto nAnf = spot::make_safra_complement(Anf);
auto ec = spot::couvreur99(spot::product(nAf, nAnf));
auto res = ec->check();
spot::tgba_statistics a_size = spot::stats_reachable(ec->automaton());

View file

@ -103,7 +103,7 @@ main(int argc, char** argv)
{
auto a = spot::ltl_to_taa(f, d);
aut[0] = a;
aut[1] = spot::degeneralize_tba(a);
aut[1] = spot::degeneralize_tba(spot::tgba_dupexp_bfs(a));
}
{
auto a = spot::ltl_to_tgba_fm(f, d);

View file

@ -400,15 +400,15 @@ in: FG((WaitRight4 M (HasRight1 W GWaitLeft0)) M HasLeft4)
-TA -lv -sp | 45 | 676 | 9
-TA -lv -sp -RT | 35 | 566 | 4
-TA -DS | 54 | 722 | 26
-TA -DS -RT | 42 | 608 | 18
-TA -DS -RT | 38 | 534 | 17
-TA -DS -lv | 55 | 800 | 19
-TA -DS -lv -RT | 44 | 702 | 13
-TA -DS -lv -RT | 39 | 608 | 11
-TA -DS -sp | 54 | 776 | 18
-TA -DS -sp -RT | 43 | 678 | 12
-TA -DS -sp -RT | 38 | 586 | 10
-TA -DS -lv -sp | 55 | 800 | 19
-TA -DS -lv -sp -RT | 44 | 702 | 13
-x -TA -DS -in | 55 | 694 | 11
-x -TA -DS -in -RT | 41 | 597 | 8
-TA -DS -lv -sp -RT | 39 | 608 | 11
-x -TA -DS -in | 55 | 696 | 11
-x -TA -DS -in -RT | 42 | 603 | 8
in: G(F(GWaitLeft7 U Idle4) U (WaitLeft2 M IsEating2))
-TGTA | 69 | 1539 | XXX
-TGTA -RT | 49 | 935 | XXX
@ -429,7 +429,7 @@ in: G(F(GWaitLeft7 U Idle4) U (WaitLeft2 M IsEating2))
-TA -DS -lv -sp | 125 | 3028 | 42
-TA -DS -lv -sp -RT | 97 | 2149 | 40
-x -TA -DS -in | 125 | 1838 | 25
-x -TA -DS -in -RT | 87 | 1296 | 25
-x -TA -DS -in -RT | 90 | 1368 | 25
EOF
sed -n 's/in: \(.*\)/\1/p' checkta.txt > input.txt

View file

@ -54,7 +54,7 @@
#include "tgbaalgos/gtec/gtec.hh"
#include "misc/timer.hh"
#include "tgbaalgos/stats.hh"
#include "tgbaalgos/scc.hh"
#include "tgbaalgos/sccinfo.hh"
#include "tgbaalgos/emptiness_stats.hh"
#include "tgbaalgos/scc.hh"
#include "tgbaalgos/sccinfo.hh"
@ -1286,14 +1286,14 @@ checked_main(int argc, char** argv)
{
if (degeneralize_opt == DegenTBA)
{
a = spot::degeneralize_tba(a, degen_reset, degen_order,
degen_cache);
a = spot::degeneralize_tba(ensure_digraph(a),
degen_reset, degen_order, degen_cache);
}
else if (degeneralize_opt == DegenSBA)
{
tm.start("degeneralization");
a = spot::degeneralize(a, degen_reset, degen_order,
degen_cache);
a = spot::degeneralize(ensure_digraph(a),
degen_reset, degen_order, degen_cache);
tm.stop("degeneralization");
assume_sba = true;
}
@ -1303,7 +1303,8 @@ checked_main(int argc, char** argv)
&& (!f || f->is_syntactic_recurrence()))
{
tm.start("determinization 2");
auto determinized = tba_determinize(a, 0, opt_determinize_threshold);
auto determinized = tba_determinize(ensure_digraph(a), 0,
opt_determinize_threshold);
tm.stop("determinization 2");
if (determinized)
a = determinized;
@ -1312,7 +1313,7 @@ checked_main(int argc, char** argv)
if (opt_monitor)
{
tm.start("Monitor minimization");
a = minimize_monitor(a);
a = minimize_monitor(ensure_digraph(a));
tm.stop("Monitor minimization");
assume_sba = false; // All states are accepting, so double
// circles in the dot output are
@ -1397,7 +1398,7 @@ checked_main(int argc, char** argv)
if (opt_monitor)
{
tm.start("Monitor minimization");
a = minimize_monitor(a);
a = minimize_monitor(ensure_digraph(a));
tm.stop("Monitor minimization");
assume_sba = false; // All states are accepting, so double
// circles in the dot output are
@ -1509,7 +1510,7 @@ checked_main(int argc, char** argv)
if (degeneralize_opt == DegenTBA)
{
tm.start("degeneralize product");
a = spot::degeneralize_tba(a,
a = spot::degeneralize_tba(ensure_digraph(a),
degen_reset,
degen_order,
degen_cache);
@ -1518,7 +1519,7 @@ checked_main(int argc, char** argv)
else if (degeneralize_opt == DegenSBA)
{
tm.start("degeneralize product");
a = spot::degeneralize(a,
a = spot::degeneralize(ensure_digraph(a),
degen_reset,
degen_order,
degen_cache);
@ -1572,7 +1573,7 @@ checked_main(int argc, char** argv)
// It is possible that we have applied other
// operations to the automaton since its initial
// degeneralization. Let's degeneralize again!
auto s = spot::degeneralize(a, degen_reset,
auto s = spot::degeneralize(ensure_digraph(a), degen_reset,
degen_order, degen_cache);
spot::never_claim_reachable(std::cout, s, f, spin_comments);
}
@ -1621,8 +1622,8 @@ checked_main(int argc, char** argv)
}
else
{
bool g = is_guarantee_automaton(a);
bool s = is_safety_mwdba(a);
bool g = is_guarantee_automaton(ensure_digraph(a));
bool s = is_safety_mwdba(ensure_digraph(a));
if (g && !s)
{
std::cout << "this is a guarantee property (hence, "
@ -1649,8 +1650,7 @@ checked_main(int argc, char** argv)
break;
case 15:
{
spot::scc_map m(a);
m.build_map();
spot::scc_info m(ensure_digraph(a));
spot::enumerate_cycles c(m);
unsigned max = m.scc_count();
for (unsigned n = 0; n < max; ++n)
@ -1662,8 +1662,7 @@ checked_main(int argc, char** argv)
}
case 16:
{
spot::scc_map m(a);
m.build_map();
spot::scc_info m(ensure_digraph(a));
unsigned max = m.scc_count();
for (unsigned n = 0; n < max; ++n)
{

View file

@ -46,7 +46,7 @@
#include "misc/random.hh"
#include "misc/optionmap.hh"
#include "tgbaalgos/degen.hh"
#include "tgba/tgbaproduct.hh"
#include "tgbaalgos/product.hh"
#include "misc/timer.hh"
#include "tgbaalgos/ltl2tgba_fm.hh"
@ -85,8 +85,8 @@ const char* default_algos[] = {
std::vector<ec_algo> ec_algos;
spot::emptiness_check_ptr
cons_emptiness_check(int num, spot::const_tgba_ptr a,
const spot::const_tgba_ptr& degen,
cons_emptiness_check(int num, spot::const_tgba_digraph_ptr a,
const spot::const_tgba_digraph_ptr& degen,
unsigned int n_acc)
{
auto inst = ec_algos[num].inst;
@ -579,8 +579,8 @@ main(int argc, char** argv)
bool stop_on_first_difference = false;
spot::tgba_ptr formula = nullptr;
spot::tgba_ptr product = nullptr;
spot::tgba_digraph_ptr formula = nullptr;
spot::tgba_digraph_ptr product = nullptr;
spot::option_map options;
@ -906,7 +906,7 @@ main(int argc, char** argv)
spot::srand(opt_ec_seed);
spot::tgba_ptr a =
spot::tgba_digraph_ptr a =
spot::random_graph(opt_n, opt_d, apf, dict,
opt_n_acc, opt_a, opt_t);
if (formula)
@ -925,7 +925,7 @@ main(int argc, char** argv)
}
else
{
spot::tgba_ptr degen = nullptr;
spot::tgba_digraph_ptr degen = nullptr;
if (opt_degen && real_n_acc > 1)
degen = degeneralize_tba(a);