stats: allow counting complete SCCs
* bin/common_aoutput.cc, NEWS: Update documentation. * spot/twaalgos/stats.cc: Honor c and C. * tests/core/alternating.test: Test it.
This commit is contained in:
parent
223b0c6a9e
commit
1cf5778faa
4 changed files with 74 additions and 6 deletions
3
NEWS
3
NEWS
|
|
@ -30,6 +30,9 @@ New in spot 2.3.5.dev (not yet released)
|
||||||
because it can now extract the subautomaton leading to an SCC
|
because it can now extract the subautomaton leading to an SCC
|
||||||
specified by number. (The old name is still kept as an alias.)
|
specified by number. (The old name is still kept as an alias.)
|
||||||
|
|
||||||
|
- The --stats=%c option of tools producing automata can now be
|
||||||
|
restricted to count complete SCCs, using %[c]c.
|
||||||
|
|
||||||
Library:
|
Library:
|
||||||
|
|
||||||
- A new library, libspotgen, gathers all functions used to generate
|
- A new library, libspotgen, gathers all functions used to generate
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ static const argp_option io_options[] =
|
||||||
OPTION_DOC | OPTION_NO_USAGE,
|
OPTION_DOC | OPTION_NO_USAGE,
|
||||||
"number of SCCs; you may filter the SCCs to count "
|
"number of SCCs; you may filter the SCCs to count "
|
||||||
"using the following LETTERS, possibly concatenated: (a) accepting, "
|
"using the following LETTERS, possibly concatenated: (a) accepting, "
|
||||||
"(r) rejecting, (v) trivial, (t) terminal, (w) weak, "
|
"(r) rejecting, (c) complete, (v) trivial, (t) terminal, (w) weak, "
|
||||||
"(iw) inherently weak. Use uppercase letters to negate them.", 0 },
|
"(iw) inherently weak. Use uppercase letters to negate them.", 0 },
|
||||||
{ "%R, %[LETTERS]R", 0, nullptr,
|
{ "%R, %[LETTERS]R", 0, nullptr,
|
||||||
OPTION_DOC | OPTION_NO_USAGE,
|
OPTION_DOC | OPTION_NO_USAGE,
|
||||||
|
|
@ -244,7 +244,7 @@ static const argp_option o_options[] =
|
||||||
{ "%c, %[LETTERS]c", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
|
{ "%c, %[LETTERS]c", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
|
||||||
"number of SCCs; you may filter the SCCs to count "
|
"number of SCCs; you may filter the SCCs to count "
|
||||||
"using the following LETTERS, possibly concatenated: (a) accepting, "
|
"using the following LETTERS, possibly concatenated: (a) accepting, "
|
||||||
"(r) rejecting, (v) trivial, (t) terminal, (w) weak, "
|
"(r) rejecting, (c) complete, (v) trivial, (t) terminal, (w) weak, "
|
||||||
"(iw) inherently weak. Use uppercase letters to negate them.", 0 },
|
"(iw) inherently weak. Use uppercase letters to negate them.", 0 },
|
||||||
{ "%R, %[LETTERS]R", 0, nullptr,
|
{ "%R, %[LETTERS]R", 0, nullptr,
|
||||||
OPTION_DOC | OPTION_NO_USAGE,
|
OPTION_DOC | OPTION_NO_USAGE,
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,8 @@ namespace spot
|
||||||
bool non_weak = false;
|
bool non_weak = false;
|
||||||
bool inherently_weak = false;
|
bool inherently_weak = false;
|
||||||
bool non_inherently_weak = false;
|
bool non_inherently_weak = false;
|
||||||
|
bool complete = false;
|
||||||
|
bool non_complete = false;
|
||||||
|
|
||||||
const char* beg = pos;
|
const char* beg = pos;
|
||||||
auto error = [&](std::string str)
|
auto error = [&](std::string str)
|
||||||
|
|
@ -236,11 +238,11 @@ namespace spot
|
||||||
case 'r':
|
case 'r':
|
||||||
rejecting = true;
|
rejecting = true;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'c':
|
||||||
trivial = true;
|
complete = true;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'C':
|
||||||
non_trivial = true;
|
non_complete = true;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
terminal = true;
|
terminal = true;
|
||||||
|
|
@ -248,6 +250,12 @@ namespace spot
|
||||||
case 'T':
|
case 'T':
|
||||||
non_terminal = true;
|
non_terminal = true;
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
trivial = true;
|
||||||
|
break;
|
||||||
|
case 'V':
|
||||||
|
non_trivial = true;
|
||||||
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
weak = true;
|
weak = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -301,6 +309,10 @@ namespace spot
|
||||||
continue;
|
continue;
|
||||||
if (non_trivial && val_->is_trivial(i))
|
if (non_trivial && val_->is_trivial(i))
|
||||||
continue;
|
continue;
|
||||||
|
if (complete && !is_complete_scc(*val_, i))
|
||||||
|
continue;
|
||||||
|
if (non_complete && is_complete_scc(*val_, i))
|
||||||
|
continue;
|
||||||
if (terminal && !is_terminal_scc(*val_, i))
|
if (terminal && !is_terminal_scc(*val_, i))
|
||||||
continue;
|
continue;
|
||||||
if (non_terminal && is_terminal_scc(*val_, i))
|
if (non_terminal && is_terminal_scc(*val_, i))
|
||||||
|
|
|
||||||
|
|
@ -1862,3 +1862,56 @@ EOF
|
||||||
autfilt --tgba in 2>out && exit 1
|
autfilt --tgba in 2>out && exit 1
|
||||||
grep 'autfilt.*weak.*alternating' out
|
grep 'autfilt.*weak.*alternating' out
|
||||||
test '2 0 2 2' = "`autfilt --stats='%[Wiw]c %[w]c %[iw]c %[W]c' in`"
|
test '2 0 2 2' = "`autfilt --stats='%[Wiw]c %[w]c %[iw]c %[W]c' in`"
|
||||||
|
|
||||||
|
|
||||||
|
cat >in <<EOF
|
||||||
|
HOA: v1
|
||||||
|
States: 2
|
||||||
|
AP: 1 "a"
|
||||||
|
Start: 0
|
||||||
|
Acceptance: 1 Inf(0)
|
||||||
|
--BODY--
|
||||||
|
State: 0
|
||||||
|
[0] 1&0 {0}
|
||||||
|
[!0] 0
|
||||||
|
State: 1
|
||||||
|
[t] 0&1
|
||||||
|
--END--
|
||||||
|
EOF
|
||||||
|
test '0 1 1 0 0' = "`autfilt --stats='%[iw]c %[W]c %[c]c %[C]c %[t]c' in`"
|
||||||
|
|
||||||
|
cat >in <<EOF
|
||||||
|
HOA: v1
|
||||||
|
States: 3
|
||||||
|
AP: 1 "a"
|
||||||
|
Start: 0
|
||||||
|
Acceptance: 1 Inf(0)
|
||||||
|
--BODY--
|
||||||
|
State: 0
|
||||||
|
[t] 0&1
|
||||||
|
State: 1
|
||||||
|
[0] 1&2 {0}
|
||||||
|
[!0] 1
|
||||||
|
State: 2
|
||||||
|
[t] 2&1
|
||||||
|
--END--
|
||||||
|
EOF
|
||||||
|
test '1 1 1 1 0' = "`autfilt --stats='%[iw]c %[W]c %[c]c %[C]c %[t]c' in`"
|
||||||
|
|
||||||
|
cat >in <<EOF
|
||||||
|
HOA: v1
|
||||||
|
States: 3
|
||||||
|
AP: 1 "a"
|
||||||
|
Start: 0
|
||||||
|
Acceptance: 1 Inf(0)
|
||||||
|
--BODY--
|
||||||
|
State: 0
|
||||||
|
[t] 0&1
|
||||||
|
State: 1 {0}
|
||||||
|
[0] 1&2
|
||||||
|
[!0] 1
|
||||||
|
State: 2 {0}
|
||||||
|
[t] 2&1
|
||||||
|
--END--
|
||||||
|
EOF
|
||||||
|
test '2 0 1 1 1' = "`autfilt --stats='%[iw]c %[W]c %[c]c %[C]c %[t]c' in`"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue