diff --git a/python/spot/__init__.py b/python/spot/__init__.py index a9d278609..944d53657 100644 --- a/python/spot/__init__.py +++ b/python/spot/__init__.py @@ -858,7 +858,7 @@ for fun in ['remove_x', 'relabel', 'relabel_bse', # Better interface to the corresponding C++ function. def sat_minimize(aut, acc=None, colored=False, state_based=False, states=0, - max_states=0, dichotomy=False, + max_states=0, dicho=False, param=0, incr=False, assume=False): args='' if acc is not None: @@ -875,8 +875,8 @@ def sat_minimize(aut, acc=None, colored=False, if type(max_states) is not int or max_states < 0: raise ValueError("argument 'states' should be a positive integer") args += ',max-states=' + str(max_states) - if dichotomy: - args += ',dichotomy' + if dicho: + args += ',dicho'; if param: args += ',param=' + str(param) if incr: diff --git a/spot/priv/satcommon.cc b/spot/priv/satcommon.cc index 17f6f76b9..9af7d887b 100644 --- a/spot/priv/satcommon.cc +++ b/spot/priv/satcommon.cc @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -185,4 +186,13 @@ namespace spot out << "\"\n"; } } + + int + get_number_of_distinct_vals(std::vector v) + { + std::set distinct; + for (auto it = v.begin(); it != v.end(); ++it) + distinct.insert(*it); + return distinct.size(); + } } diff --git a/spot/priv/satcommon.hh b/spot/priv/satcommon.hh index f327c8a51..664019b35 100644 --- a/spot/priv/satcommon.hh +++ b/spot/priv/satcommon.hh @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -235,4 +236,8 @@ public: void print_log(timer_map& t, int target_state_number, twa_graph_ptr& res, satsolver& solver); + + /// \brief Returns the number of distinct values containted in a vector. + int + get_number_of_distinct_vals(std::vector v); } diff --git a/spot/twaalgos/dtbasat.cc b/spot/twaalgos/dtbasat.cc index 3076b2403..b3b31e195 100644 --- a/spot/twaalgos/dtbasat.cc +++ b/spot/twaalgos/dtbasat.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1005,11 +1006,19 @@ namespace spot twa_graph_ptr dtba_sat_minimize_dichotomy(const const_twa_graph_ptr& a, - bool state_based, int max_states) + bool state_based, bool langmap, int max_states) { + trace << "Dichomoty\n"; if (max_states < 0) max_states = stats_reachable(a).states - 1; int min_states = 1; + if (langmap) + { + trace << "Langmap\n"; + std::vector v = language_map(a); + min_states = get_number_of_distinct_vals(v); + } + trace << "min_states=" << min_states << '\n'; twa_graph_ptr prev = nullptr; while (min_states <= max_states) diff --git a/spot/twaalgos/dtbasat.hh b/spot/twaalgos/dtbasat.hh index 114b8681b..a2a480566 100644 --- a/spot/twaalgos/dtbasat.hh +++ b/spot/twaalgos/dtbasat.hh @@ -64,6 +64,7 @@ namespace spot SPOT_API twa_graph_ptr dtba_sat_minimize_dichotomy(const const_twa_graph_ptr& a, bool state_based = false, + bool langmap = false, int max_states = -1); /// \brief Attempt to minimize a det. TBA with a SAT solver. diff --git a/spot/twaalgos/dtwasat.cc b/spot/twaalgos/dtwasat.cc index 8ebb653eb..ed337b0c0 100644 --- a/spot/twaalgos/dtwasat.cc +++ b/spot/twaalgos/dtwasat.cc @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -1338,12 +1339,20 @@ namespace spot dtwa_sat_minimize_dichotomy(const const_twa_graph_ptr& a, unsigned target_acc_number, const acc_cond::acc_code& target_acc, - bool state_based, int max_states, - bool colored) + bool state_based, bool langmap, + int max_states, bool colored) { + trace << "Dichotomy\n"; if (max_states < 1) max_states = stats_reachable(a).states - 1; int min_states = 1; + if (langmap) + { + trace << "Langmap\n"; + std::vector v = language_map(a); + min_states = get_number_of_distinct_vals(v); + } + trace << "min_states=" << min_states << '\n'; twa_graph_ptr prev = nullptr; while (min_states <= max_states) @@ -1382,10 +1391,11 @@ namespace spot throw std::runtime_error ("SAT-based minimization only works with deterministic automata"); - bool dicho = om.get("dichotomy", 0); bool incr = om.get("incr", 0); bool assume = om.get("assume", 0); int param = om.get("param", 0); + bool dicho = om.get("dicho", 0); + bool dicho_langmap = om.get("langmap", 0); int states = om.get("states", -1); int max_states = om.get("max-states", -1); auto accstr = om.get_str("acc"); @@ -1492,9 +1502,12 @@ namespace spot a = dtwa_sat_minimize_assume(a, nacc, target_acc, state_based, max_states, colored, param); + else if (dicho) + a = dtwa_sat_minimize_dichotomy + (a, nacc, target_acc, state_based, dicho_langmap, max_states, + colored); else - a = (dicho ? dtwa_sat_minimize_dichotomy - : dtwa_sat_minimize) + a = dtwa_sat_minimize (a, nacc, target_acc, state_based, max_states, colored); } else @@ -1505,10 +1518,12 @@ namespace spot else if (assume) a = dtba_sat_minimize_assume(a, state_based, max_states, assume); + else if (dicho) + a = dtba_sat_minimize_dichotomy + (a, state_based, dicho_langmap, max_states); + else - a = (dicho ? dtba_sat_minimize_dichotomy - : dtba_sat_minimize) - (a, state_based, max_states); + a = dtba_sat_minimize(a, state_based, max_states); } if (!a && !user_supplied_acc) diff --git a/spot/twaalgos/dtwasat.hh b/spot/twaalgos/dtwasat.hh index 8929ddd54..1399d9b05 100644 --- a/spot/twaalgos/dtwasat.hh +++ b/spot/twaalgos/dtwasat.hh @@ -80,6 +80,7 @@ namespace spot unsigned target_acc_number, const acc_cond::acc_code& target_acc, bool state_based = false, + bool langmap = false, int max_states = -1, bool colored = false); diff --git a/spot/twaalgos/postproc.cc b/spot/twaalgos/postproc.cc index c29c1f666..8871aa2f3 100644 --- a/spot/twaalgos/postproc.cc +++ b/spot/twaalgos/postproc.cc @@ -71,6 +71,7 @@ namespace spot tba_determinisation_ = opt->get("tba-det", 0); sat_minimize_ = opt->get("sat-minimize", 0); param_ = opt->get("param", 0); + dicho_langmap_ = opt->get("langmap", 0); sat_acc_ = opt->get("sat-acc", 0); sat_states_ = opt->get("sat-states", 0); state_based_ = opt->get("state-based", 0); @@ -429,7 +430,8 @@ namespace spot else if (sat_minimize_ == 1 || sat_minimize_ == -1) res = dtba_sat_minimize(res, state_based_); else if (sat_minimize_ == 2) - res = dtba_sat_minimize_dichotomy(res, state_based_); + res = dtba_sat_minimize_dichotomy + (res, state_based_, dicho_langmap_); else if (sat_minimize_ == 3) res = dtba_sat_minimize_incr(res, state_based_, -1, param_); else // if (sat_minimize == 4) @@ -451,7 +453,7 @@ namespace spot res = dtwa_sat_minimize_dichotomy (res, target_acc, acc_cond::acc_code::generalized_buchi(target_acc), - state_based_); + state_based_, dicho_langmap_); else if (sat_minimize_ == 3) res = dtwa_sat_minimize_incr (res, target_acc, diff --git a/spot/twaalgos/postproc.hh b/spot/twaalgos/postproc.hh index 0cdb6c561..5e6f637dc 100644 --- a/spot/twaalgos/postproc.hh +++ b/spot/twaalgos/postproc.hh @@ -190,6 +190,7 @@ namespace spot bool tba_determinisation_ = false; int sat_minimize_ = 0; int param_ = 0; + bool dicho_langmap_ = false; int sat_acc_ = 0; int sat_states_ = 0; bool state_based_ = false; diff --git a/tests/core/satmin.test b/tests/core/satmin.test index e2a826a7d..c89247527 100755 --- a/tests/core/satmin.test +++ b/tests/core/satmin.test @@ -103,21 +103,22 @@ $ltlcross -F formulas \ "{5} $ltl2tgba --det --lbtt -x sat-states=3 %f >%T" \ "{6} $ltl2tgba --det --lbtt -x sat-minimize %f >%T" \ "{7} $ltl2tgba --det --lbtt -x sat-minimize=2 %f >%T" \ - "{8} $ltl2tgba --det --lbtt -x sat-minimize=3 %f >%T" \ - "{9} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=-1' %f >%T" \ - "{10} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=0' %f >%T" \ - "{11} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=1' %f >%T" \ - "{12} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=2' %f >%T" \ - "{13} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=50' %f >%T" \ - "{14} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=0' %f >%T" \ - "{15} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=1' %f >%T" \ - "{16} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=2' %f >%T" \ - "{17} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=50' %f >%T" \ + "{8} $ltl2tgba --det --lbtt -x 'sat-minimize=2,langmap' %f >%T" \ + "{9} $ltl2tgba --det --lbtt -x sat-minimize=3 %f >%T" \ + "{10} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=-1' %f >%T" \ + "{11} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=0' %f >%T" \ + "{12} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=1' %f >%T" \ + "{13} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=2' %f >%T" \ + "{14} $ltl2tgba --det --lbtt -x 'sat-minimize=3, param=50' %f >%T" \ + "{15} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=0' %f >%T" \ + "{16} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=1' %f >%T" \ + "{17} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=2' %f >%T" \ + "{18} $ltl2tgba --det --lbtt -x 'sat-minimize=4, param=50' %f >%T" \ --csv=det.csv grep -v ',\"5\",' det.csv | cut -d ',' -f '1,2,6' > output -cat > expected <expected <<'EOF' "formula","tool","states" "X(X(p0))","1",4 "X(X(p0))","2",4 @@ -135,6 +136,7 @@ cat > expected < expected < (X(X(X(p1))))))","1",1 "G(F((p0) -> (X(X(X(p1))))))","2",1 "G(F((p0) -> (X(X(X(p1))))))","3",1 @@ -167,6 +170,7 @@ cat > expected < (X(X(X(p1))))))","15",1 "G(F((p0) -> (X(X(X(p1))))))","16",1 "G(F((p0) -> (X(X(X(p1))))))","17",1 +"G(F((p0) -> (X(X(X(p1))))))","18",1 "!(G(F((p0) -> (X(X(X(p1)))))))","1",2 "!(G(F((p0) -> (X(X(X(p1)))))))","2",2 "!(G(F((p0) -> (X(X(X(p1)))))))","3",2 @@ -183,6 +187,7 @@ cat > expected < (X(X(X(p1)))))))","15",2 "!(G(F((p0) -> (X(X(X(p1)))))))","16",2 "!(G(F((p0) -> (X(X(X(p1)))))))","17",2 +"!(G(F((p0) -> (X(X(X(p1)))))))","18",2 "F((p0) & (X(F((p1) & (X(F((p2) & (X(F(p3))))))))))","1",5 "F((p0) & (X(F((p1) & (X(F((p2) & (X(F(p3))))))))))","2",5 "F((p0) & (X(F((p1) & (X(F((p2) & (X(F(p3))))))))))","3",5 @@ -199,6 +204,7 @@ cat > expected < expected < expected < expected < expected < expected < expected < expected < (F(p1)))) & (G((p2) -> (F(p3))))","1",4 "(G((p0) -> (F(p1)))) & (G((p2) -> (F(p3))))","2",4 "(G((p0) -> (F(p1)))) & (G((p2) -> (F(p3))))","3",4 @@ -327,6 +340,7 @@ cat > expected < (F(p1)))) & (G((p2) -> (F(p3))))","15",4 "(G((p0) -> (F(p1)))) & (G((p2) -> (F(p3))))","16",4 "(G((p0) -> (F(p1)))) & (G((p2) -> (F(p3))))","17",4 +"(G((p0) -> (F(p1)))) & (G((p2) -> (F(p3))))","18",4 "!((G((p0) -> (F(p1)))) & (G((p2) -> (F(p3)))))","1",3 "!((G((p0) -> (F(p1)))) & (G((p2) -> (F(p3)))))","2",3 "!((G((p0) -> (F(p1)))) & (G((p2) -> (F(p3)))))","3",3 @@ -343,6 +357,7 @@ cat > expected < (F(p1)))) & (G((p2) -> (F(p3)))))","15",3 "!((G((p0) -> (F(p1)))) & (G((p2) -> (F(p3)))))","16",3 "!((G((p0) -> (F(p1)))) & (G((p2) -> (F(p3)))))","17",3 +"!((G((p0) -> (F(p1)))) & (G((p2) -> (F(p3)))))","18",3 "(G(F(p0))) & (G(F(p1)))","1",1 "(G(F(p0))) & (G(F(p1)))","2",1 "(G(F(p0))) & (G(F(p1)))","3",1 @@ -359,6 +374,7 @@ cat > expected < expected < expected < expected < expected < expected < expected < expected < (F(p1)))) & (G(p2))","1",2 "(G((p0) -> (F(p1)))) & (G(p2))","2",2 "(G((p0) -> (F(p1)))) & (G(p2))","3",2 @@ -487,6 +510,7 @@ cat > expected < (F(p1)))) & (G(p2))","15",2 "(G((p0) -> (F(p1)))) & (G(p2))","16",2 "(G((p0) -> (F(p1)))) & (G(p2))","17",2 +"(G((p0) -> (F(p1)))) & (G(p2))","18",2 "!((G((p0) -> (F(p1)))) & (G(p2)))","1",3 "!((G((p0) -> (F(p1)))) & (G(p2)))","2",3 "!((G((p0) -> (F(p1)))) & (G(p2)))","3",3 @@ -503,6 +527,7 @@ cat > expected < (F(p1)))) & (G(p2)))","15",3 "!((G((p0) -> (F(p1)))) & (G(p2)))","16",3 "!((G((p0) -> (F(p1)))) & (G(p2)))","17",3 +"!((G((p0) -> (F(p1)))) & (G(p2)))","18",3 "((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1))))","1",4 "((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1))))","2",4 "((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1))))","3",4 @@ -519,6 +544,7 @@ cat > expected < (F(p1))) & ((G(!(p0))) -> (F(!(p1))))","15",4 "((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1))))","16",4 "((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1))))","17",4 +"((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1))))","18",4 "!(((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1)))))","1",3 "!(((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1)))))","2",3 "!(((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1)))))","3",3 @@ -535,6 +561,7 @@ cat > expected < (F(p1))) & ((G(!(p0))) -> (F(!(p1)))))","15",3 "!(((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1)))))","16",3 "!(((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1)))))","17",3 +"!(((G(p0)) -> (F(p1))) & ((G(!(p0))) -> (F(!(p1)))))","18",3 "(G((p0) -> (F(p1)))) & (G((p1) -> (F(p2))))","1",4 "(G((p0) -> (F(p1)))) & (G((p1) -> (F(p2))))","2",4 "(G((p0) -> (F(p1)))) & (G((p1) -> (F(p2))))","3",4 @@ -551,6 +578,7 @@ cat > expected < (F(p1)))) & (G((p1) -> (F(p2))))","15",3 "(G((p0) -> (F(p1)))) & (G((p1) -> (F(p2))))","16",3 "(G((p0) -> (F(p1)))) & (G((p1) -> (F(p2))))","17",3 +"(G((p0) -> (F(p1)))) & (G((p1) -> (F(p2))))","18",3 "!((G((p0) -> (F(p1)))) & (G((p1) -> (F(p2)))))","1",3 "!((G((p0) -> (F(p1)))) & (G((p1) -> (F(p2)))))","2",3 "!((G((p0) -> (F(p1)))) & (G((p1) -> (F(p2)))))","3",3 @@ -567,6 +595,7 @@ cat > expected < (F(p1)))) & (G((p1) -> (F(p2)))))","15",3 "!((G((p0) -> (F(p1)))) & (G((p1) -> (F(p2)))))","16",3 "!((G((p0) -> (F(p1)))) & (G((p1) -> (F(p2)))))","17",3 +"!((G((p0) -> (F(p1)))) & (G((p1) -> (F(p2)))))","18",3 "(G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1)))))","1",3 "(G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1)))))","2",3 "(G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1)))))","3",3 @@ -583,6 +612,7 @@ cat > expected < (F(p1)))) & (G((!(p0)) -> (F(!(p1)))))","15",3 "(G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1)))))","16",3 "(G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1)))))","17",3 +"(G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1)))))","18",3 "!((G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1))))))","1",3 "!((G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1))))))","2",3 "!((G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1))))))","3",3 @@ -599,6 +629,7 @@ cat > expected < (F(p1)))) & (G((!(p0)) -> (F(!(p1))))))","15",3 "!((G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1))))))","16",3 "!((G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1))))))","17",3 +"!((G((p0) -> (F(p1)))) & (G((!(p0)) -> (F(!(p1))))))","18",3 "(G(F(p0))) & (G(F(p1))) & (G(F(p2))) & (G(F(p3)))","1",1 "(G(F(p0))) & (G(F(p1))) & (G(F(p2))) & (G(F(p3)))","2",1 "(G(F(p0))) & (G(F(p1))) & (G(F(p2))) & (G(F(p3)))","3",1 @@ -615,6 +646,7 @@ cat > expected < expected < ((p1) U (p2)))","1",2 "G((p0) -> ((p1) U (p2)))","2",2 "G((p0) -> ((p1) U (p2)))","3",2 @@ -647,6 +680,7 @@ cat > expected < ((p1) U (p2)))","15",2 "G((p0) -> ((p1) U (p2)))","16",2 "G((p0) -> ((p1) U (p2)))","17",2 +"G((p0) -> ((p1) U (p2)))","18",2 "!(G((p0) -> ((p1) U (p2))))","1",3 "!(G((p0) -> ((p1) U (p2))))","2",3 "!(G((p0) -> ((p1) U (p2))))","3",3 @@ -663,6 +697,7 @@ cat > expected < ((p1) U (p2))))","15",3 "!(G((p0) -> ((p1) U (p2))))","16",3 "!(G((p0) -> ((p1) U (p2))))","17",3 +"!(G((p0) -> ((p1) U (p2))))","18",3 "G(F((p0) <-> (X(X(p1)))))","1",9 "G(F((p0) <-> (X(X(p1)))))","2",7 "G(F((p0) <-> (X(X(p1)))))","3",4 @@ -679,6 +714,7 @@ cat > expected < (X(X(p1)))))","15",4 "G(F((p0) <-> (X(X(p1)))))","16",4 "G(F((p0) <-> (X(X(p1)))))","17",4 +"G(F((p0) <-> (X(X(p1)))))","18",4 "!(G(F((p0) <-> (X(X(p1))))))","1",7 "!(G(F((p0) <-> (X(X(p1))))))","2",7 "!(G(F((p0) <-> (X(X(p1))))))","3",7 @@ -695,6 +731,7 @@ cat > expected < (X(X(p1))))))","15",7 "!(G(F((p0) <-> (X(X(p1))))))","16",7 "!(G(F((p0) <-> (X(X(p1))))))","17",7 +"!(G(F((p0) <-> (X(X(p1))))))","18",7 "(G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0))))","1",1 "(G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0))))","2",1 "(G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0))))","3",1 @@ -711,6 +748,7 @@ cat > expected < (F(p2)))) & (G((p2) -> (F(p0))))","15",1 "(G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0))))","16",1 "(G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0))))","17",1 +"(G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0))))","18",1 "!((G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0)))))","1",2 "!((G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0)))))","2",2 "!((G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0)))))","3",2 @@ -727,6 +765,7 @@ cat > expected < (F(p2)))) & (G((p2) -> (F(p0)))))","15",2 "!((G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0)))))","16",2 "!((G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0)))))","17",2 +"!((G(!(p0))) & (G((p1) -> (F(p2)))) & (G((p2) -> (F(p0)))))","18",2 "G((p0) -> (X(X(X(p1)))))","1",8 "G((p0) -> (X(X(X(p1)))))","2",8 "G((p0) -> (X(X(X(p1)))))","3",8 @@ -743,6 +782,7 @@ cat > expected < (X(X(X(p1)))))","15",8 "G((p0) -> (X(X(X(p1)))))","16",8 "G((p0) -> (X(X(X(p1)))))","17",8 +"G((p0) -> (X(X(X(p1)))))","18",8 "!(G((p0) -> (X(X(X(p1))))))","1",9 "!(G((p0) -> (X(X(X(p1))))))","2",9 "!(G((p0) -> (X(X(X(p1))))))","3",9 @@ -759,6 +799,7 @@ cat > expected < (X(X(X(p1))))))","15",9 "!(G((p0) -> (X(X(X(p1))))))","16",9 "!(G((p0) -> (X(X(X(p1))))))","17",9 +"!(G((p0) -> (X(X(X(p1))))))","18",9 "G((p0) -> (F(p1)))","1",2 "G((p0) -> (F(p1)))","2",2 "G((p0) -> (F(p1)))","3",2 @@ -775,6 +816,7 @@ cat > expected < (F(p1)))","15",2 "G((p0) -> (F(p1)))","16",2 "G((p0) -> (F(p1)))","17",2 +"G((p0) -> (F(p1)))","18",2 "!(G((p0) -> (F(p1))))","1",2 "!(G((p0) -> (F(p1))))","2",2 "!(G((p0) -> (F(p1))))","3",2 @@ -791,6 +833,7 @@ cat > expected < (F(p1))))","15",2 "!(G((p0) -> (F(p1))))","16",2 "!(G((p0) -> (F(p1))))","17",2 +"!(G((p0) -> (F(p1))))","18",2 "G((p0) U ((p1) U ((!(p0)) U (!(p1)))))","1",1 "G((p0) U ((p1) U ((!(p0)) U (!(p1)))))","2",1 "G((p0) U ((p1) U ((!(p0)) U (!(p1)))))","3",1 @@ -807,6 +850,7 @@ cat > expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < expected < XXb)" -H >out grep 'properties:.*state-acc' out grep 'properties:.*deterministic' out -ltl2tgba -BD -x 'sat-minimize=3,param=0' "GF(a <-> XXb)" -H >out +ltl2tgba -BD -x sat-minimize=2 "GF(a <-> XXb)" -H >out grep 'properties:.*state-acc' out grep 'properties:.*deterministic' out -ltl2tgba -BD -x 'sat-minimize=3,param=1' "GF(a <-> XXb)" -H >out +ltl2tgba -BD -x 'sat-minimize=2,langmap' "GF(a <-> XXb)" -H >out grep 'properties:.*state-acc' out grep 'properties:.*deterministic' out -ltl2tgba -BD -x 'sat-minimize=3,param=2' "GF(a <-> XXb)" -H >out +ltl2tgba -BD -x 'sat-minimize=4,param=0' "GF(a <-> XXb)" -H >out grep 'properties:.*state-acc' out grep 'properties:.*deterministic' out -ltl2tgba -BD -x 'sat-minimize=3,param=50' "GF(a <-> XXb)" -H >out +ltl2tgba -BD -x 'sat-minimize=4,param=1' "GF(a <-> XXb)" -H >out +grep 'properties:.*state-acc' out +grep 'properties:.*deterministic' out +ltl2tgba -BD -x 'sat-minimize=4,param=2' "GF(a <-> XXb)" -H >out +grep 'properties:.*state-acc' out +grep 'properties:.*deterministic' out +ltl2tgba -BD -x 'sat-minimize=4,param=50' "GF(a <-> XXb)" -H >out grep 'properties:.*state-acc' out grep 'properties:.*deterministic' out ltl2tgba -BD -x 'sat-minimize=3,param=-1' "GF(a <-> XXb)" -H >out @@ -128,6 +134,11 @@ EOF # automata. $autfilt --sat-minimize='acc="Fin(0)|Inf(1)"' test.hoa --stats=%s >output test `cat output` = 1 +$autfilt --sat-minimize='dicho,acc="Fin(0)|Inf(1)"' test.hoa --stats=%s >output +test `cat output` = 1 +$autfilt --sat-minimize='dicho,langmap,acc="Fin(0)|Inf(1)"' test.hoa \ + --stats=%s >output +test `cat output` = 1 $autfilt --sat-minimize='acc="Fin(0)|Inf(1)",assume,param=0' test.hoa \ --stats=%s >output test `cat output` = 1 @@ -161,6 +172,12 @@ test `cat output` = 1 $autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)"' test.hoa \ --stats=%s > output test `cat output` = 3 +$autfilt -S --sat-minimize='dicho,acc="Fin(0)|Inf(1)"' test.hoa \ + --stats=%s > output +test `cat output` = 3 +$autfilt -S --sat-minimize='dicho,langmap,acc="Fin(0)|Inf(1)"' test.hoa \ + --stats=%s > output +test `cat output` = 3 $autfilt -S --sat-minimize='acc="Fin(0)|Inf(1)",assume,param=0' test.hoa \ --stats=%s > output test `cat output` = 3 @@ -199,6 +216,22 @@ grep 'States: 3' output grep 'acc-name: parity max even 3' output grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output test 3 = `grep -c 'State: [012] {[012]}' output` +$autfilt -S --sat-minimize='acc="parity max even 3",colored,dicho' -H \ + test.hoa > output +cat output +grep 'properties:.*colored' output +grep 'States: 3' output +grep 'acc-name: parity max even 3' output +grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output +test 3 = `grep -c 'State: [012] {[012]}' output` +$autfilt -S --sat-minimize='acc="parity max even 3",colored,dicho,langmap' -H \ + test.hoa > output +cat output +grep 'properties:.*colored' output +grep 'States: 3' output +grep 'acc-name: parity max even 3' output +grep 'Acceptance: 3 Inf(2) | (Fin(1) & Inf(0))' output +test 3 = `grep -c 'State: [012] {[012]}' output` $autfilt -S --sat-minimize='acc="parity max even 3",colored,assume,param=0' \ -H test.hoa > output cat output @@ -306,6 +339,10 @@ State: 0 EOF $autfilt -H --sat-minimize special.hoa > output diff output expected +$autfilt -H --sat-minimize='dicho' special.hoa > output +diff output expected +$autfilt -H --sat-minimize='dicho,langmap' special.hoa > output +diff output expected $autfilt -H --sat-minimize='assume,param=0' special.hoa > output diff output expected $autfilt -H --sat-minimize='assume,param=1' special.hoa > output @@ -343,6 +380,12 @@ EOF $autfilt --sat-minimize='acc="Streett 1",max-states=2' foo.hoa \ --stats=%s >out test "`cat out`" = 1 +$autfilt --sat-minimize='acc="Streett 1",max-states=2,dicho' foo.hoa \ + --stats=%s >out +test "`cat out`" = 1 +$autfilt --sat-minimize='acc="Streett 1",max-states=2,dicho,langmap' foo.hoa \ + --stats=%s >out +test "`cat out`" = 1 $autfilt --sat-minimize='acc="Streett 1",max-states=2,assume,param=0' foo.hoa \ --stats=%s >out test "`cat out`" = 1 @@ -375,6 +418,12 @@ test "`cat out`" = 1 $autfilt --sat-minimize='acc="Rabin 1",max-states=4' foo.hoa \ --stats=%s >out && exit 1 test -z "`cat out`" +$autfilt --sat-minimize='acc="Rabin 1",max-states=4,dicho' foo.hoa \ + --stats=%s >out && exit 1 +test -z "`cat out`" +$autfilt --sat-minimize='acc="Rabin 1",max-states=4,dicho,langmap' foo.hoa \ + --stats=%s >out && exit 1 +test -z "`cat out`" $autfilt --sat-minimize='acc="Rabin 1",max-states=4,assume,param=0' foo.hoa \ --stats=%s >out && exit 1 test -z "`cat out`" @@ -407,6 +456,12 @@ test -z "`cat out`" $autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1' foo.hoa \ --stats=%s >out test "`cat out`" = 1 +$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,dicho' foo.hoa \ + --stats=%s >out +test "`cat out`" = 1 +$autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,dicho,langmap' \ + foo.hoa --stats=%s >out +test "`cat out`" = 1 $autfilt --sat-minimize='acc="Inf(0)&Fin(1)|Inf(2)",states=1,assume,param=0' \ foo.hoa --stats=%s >out test "`cat out`" = 1 diff --git a/tests/python/satmin.py b/tests/python/satmin.py index ebc3fb0b0..85631fb55 100644 --- a/tests/python/satmin.py +++ b/tests/python/satmin.py @@ -29,6 +29,9 @@ assert aut.is_deterministic() min1 = spot.sat_minimize(aut, acc='Rabin 1') assert min1.num_sets() == 2 assert min1.num_states() == 2 +min1 = spot.sat_minimize(aut, acc='Rabin 1', dicho=True) +assert min1.num_sets() == 2 +assert min1.num_states() == 2 min1 = spot.sat_minimize(aut, acc='Rabin 1', assume=True) assert min1.num_sets() == 2 assert min1.num_states() == 2 @@ -64,6 +67,9 @@ assert min1.num_sets() == 2 assert min1.num_states() == 2 +min2 = spot.sat_minimize(aut, acc='Streett 2', dicho=True) +assert min2.num_sets() == 4 +assert min2.num_states() == 1 min2 = spot.sat_minimize(aut, acc='Streett 2', assume=True) assert min2.num_sets() == 4 assert min2.num_states() == 1 @@ -100,7 +106,7 @@ assert min2.num_states() == 1 min3 = spot.sat_minimize(aut, acc='Rabin 2', - state_based=True, max_states=5, dichotomy=True) + state_based=True, max_states=5, dicho=True) assert min3.num_sets() == 4 assert min3.num_states() == 3 min3 = spot.sat_minimize(aut, acc='Rabin 2', @@ -150,7 +156,7 @@ assert min3.num_states() == 3 min4 = spot.sat_minimize(aut, acc='parity max odd 3', - colored=True, dichotomy=True) + colored=True, dicho=True) assert min4.num_sets() == 3 assert min4.num_states() == 2 min4 = spot.sat_minimize(aut, acc='parity max odd 3',