maskacc: Add a tgba_digraph version
* src/tgbaalgos/mask.cc, src/tgbaalgos/mask.hh: New files. * src/tgbaalgos/Makefile.am: Adjust. * src/tgba/acc.hh (mark_t::set): New method. * src/bin/autfilt.cc: Add option --mask-acc. * src/tgbatest/maskacc.test: Rewrite. * src/tgbatest/maskacc.cc: Delete. * src/tgbatest/Makefile.am: Adjust.
This commit is contained in:
parent
a0a035e0e1
commit
d0f0be234d
8 changed files with 264 additions and 90 deletions
|
|
@ -40,7 +40,6 @@ check_PROGRAMS = \
|
|||
intvcomp \
|
||||
intvcmp2 \
|
||||
ltlprod \
|
||||
maskacc \
|
||||
readsat \
|
||||
taatgba
|
||||
|
||||
|
|
@ -55,7 +54,6 @@ intvcomp_SOURCES = intvcomp.cc
|
|||
intvcmp2_SOURCES = intvcmp2.cc
|
||||
ltl2tgba_SOURCES = ltl2tgba.cc
|
||||
ltlprod_SOURCES = ltlprod.cc
|
||||
maskacc_SOURCES = maskacc.cc
|
||||
randtgba_SOURCES = randtgba.cc
|
||||
readsat_SOURCES = readsat.cc
|
||||
taatgba_SOURCES = taatgba.cc
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
// Spot is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include "tgbaparse/public.hh"
|
||||
#include "tgbaalgos/save.hh"
|
||||
#include "tgba/tgbamask.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " file" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int exit_code = 0;
|
||||
|
||||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
|
||||
{
|
||||
auto dict = spot::make_bdd_dict();
|
||||
|
||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||
spot::tgba_parse_error_list pel;
|
||||
auto aut = spot::tgba_parse(argv[1], pel, dict, env);
|
||||
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel))
|
||||
return 2;
|
||||
|
||||
unsigned nsets = aut->acc().num_sets();
|
||||
|
||||
for (unsigned n = 0; n < nsets; ++n)
|
||||
{
|
||||
auto masked = spot::build_tgba_mask_acc_ignore(aut, n);
|
||||
spot::tgba_save_reachable(std::cout, masked);
|
||||
}
|
||||
}
|
||||
|
||||
assert(spot::ltl::unop::instance_count() == 0);
|
||||
assert(spot::ltl::binop::instance_count() == 0);
|
||||
assert(spot::ltl::multop::instance_count() == 0);
|
||||
assert(spot::ltl::bunop::instance_count() == 0);
|
||||
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||
return exit_code;
|
||||
}
|
||||
|
|
@ -24,28 +24,94 @@
|
|||
set -e
|
||||
|
||||
cat >input1 <<EOF
|
||||
acc = A B;
|
||||
s1, s2, "a", A;
|
||||
s1, s3, "b", B;
|
||||
s2, s3, "a",;
|
||||
s3, s2, "b",;
|
||||
s2, s4, "a", B;
|
||||
s3, s4, "b", A;
|
||||
s4, s4, "a", A B;
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: generalized-Buchi 2
|
||||
Acceptance: 2 Inf(0)&Inf(1)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
[1] 2 {1}
|
||||
State: 1
|
||||
[0] 2
|
||||
[0] 3 {1}
|
||||
State: 2
|
||||
[1] 1
|
||||
[1] 3 {0}
|
||||
State: 3
|
||||
[0] 3 {0 1}
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >expect1 <<EOF
|
||||
acc = "0" "1";
|
||||
"0", "2", "b", "1";
|
||||
"2", "1", "b",;
|
||||
"1", "2", "a",;
|
||||
"1", "3", "a", "1";
|
||||
acc = "0" "1";
|
||||
"0", "1", "a", "0";
|
||||
"1", "2", "a",;
|
||||
"2", "1", "b",;
|
||||
"2", "3", "b", "0";
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[1] 1 {0}
|
||||
State: 1
|
||||
[1] 2
|
||||
State: 2
|
||||
[0] 1
|
||||
[0] 3 {0}
|
||||
State: 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../maskacc input1 | tee stdout
|
||||
diff stdout expect1
|
||||
run 0 ../../bin/autfilt --mask-acc=0 input1 -H >output
|
||||
diff output expect1
|
||||
|
||||
cat >expect2 <<EOF
|
||||
HOA: v1
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 2 "a" "b"
|
||||
acc-name: Buchi
|
||||
Acceptance: 1 Inf(0)
|
||||
properties: trans-labels explicit-labels trans-acc
|
||||
--BODY--
|
||||
State: 0
|
||||
[0] 1 {0}
|
||||
State: 1
|
||||
[0] 2
|
||||
State: 2
|
||||
[1] 1
|
||||
[1] 3 {0}
|
||||
State: 3
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=1 input1 -H >output
|
||||
diff output expect2
|
||||
|
||||
cat >expect3 <<EOF
|
||||
HOA: v1
|
||||
States: 1
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc deterministic
|
||||
--BODY--
|
||||
State: 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=0,1,2 input1 -H >output
|
||||
diff output expect3
|
||||
|
||||
run 0 ../../bin/autfilt --mask-acc=0 --mask-acc=1 input1 -H >output
|
||||
diff output expect3
|
||||
|
||||
# Errors
|
||||
run 2 ../../bin/autfilt --mask-acc=a3 input1
|
||||
run 2 ../../bin/autfilt --mask-acc=3-2 input1
|
||||
run 2 ../../bin/autfilt --mask-acc=0,9999,1 input1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue