spot/tests/core/mcs.test
Alexandre Duret-Lutz 7b0e15a7fb implement maximum cardinality search
* spot/twaalgos/mcs.cc, spot/twaalgos/mcs.hh: New files.
* spot/twaalgos/Makefile.am: Add them.
* python/spot/impl.i: Include mcs.hh.
* bin/autfilt.cc: Add --mcs option.
* NEWS: Mention it.
* doc/spot.bib: Add reference.
* tests/core/mcs.test: New file.
* tests/Makefile.am: Add it.
2024-09-19 18:45:34 +02:00

180 lines
3 KiB
Bash
Executable file

#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) by the Spot authors, see the AUTHORS file for details.
#
# 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/>.
. ./defs
set -e
cat >in.hoa <<EOF
HOA: v1
name: "G(FGb & F((c & Xd) | (!c & X!d))) | X(Ga & Fd)"
States: 6
Start: 3
AP: 4 "b" "c" "a" "d"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
--BODY--
State: 0
[!0&1&2&!3] 0 {0}
[1&!2] 1
[0&1&2&!3] 0
[!1&!2] 2
[2&3] 5
[0&!1&2&!3] 4
[!0&!1&2&!3] 4 {0}
State: 1
[!0&1] 1 {0}
[0&1&3] 1 {1}
[0&1&!3] 1
[0&!1&!3] 2
[0&!1&3] 2 {1}
[!0&!1] 2 {0}
State: 2
[!0&1] 1 {0}
[0&!1&3] 2
[0&!1&!3] 2 {1}
[0&1&!3] 1 {1}
[0&1&3] 1
[!0&!1] 2 {0}
State: 3
[1] 0
[!1] 4
State: 4
[1&!2] 1
[!1&!2] 2
[!0&!1&2&!3] 4 {0}
[!0&1&2&!3] 0 {0}
[0&!1&2&!3] 4 {1}
[0&1&2&!3] 0 {1}
[2&3] 5
State: 5
[1&!2] 1
[!1&!2] 2
[2] 5 {1}
--END--
EOF
autfilt --mcs in.hoa > out1.hoa
autfilt --mcs=scc in.hoa > out2.hoa
cat >expected1.hoa <<EOF
HOA: v1
name: "G(FGb & F((c & Xd) | (!c & X!d))) | X(Ga & Fd)"
States: 6
Start: 0
AP: 4 "b" "c" "a" "d"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
--BODY--
State: 0
[1] 1
[!1] 2
State: 1
[!0&1&2&!3] 1 {0}
[1&!2] 3
[0&1&2&!3] 1
[!1&!2] 4
[2&3] 5
[0&!1&2&!3] 2
[!0&!1&2&!3] 2 {0}
State: 2
[1&!2] 3
[!1&!2] 4
[!0&!1&2&!3] 2 {0}
[!0&1&2&!3] 1 {0}
[0&!1&2&!3] 2 {1}
[0&1&2&!3] 1 {1}
[2&3] 5
State: 3
[!0&1] 3 {0}
[0&1&3] 3 {1}
[0&1&!3] 3
[0&!1&!3] 4
[0&!1&3] 4 {1}
[!0&!1] 4 {0}
State: 4
[!0&1] 3 {0}
[0&!1&3] 4
[0&!1&!3] 4 {1}
[0&1&!3] 3 {1}
[0&1&3] 3
[!0&!1] 4 {0}
State: 5
[1&!2] 3
[!1&!2] 4
[2] 5 {1}
--END--
EOF
cat >expected2.hoa <<EOF
HOA: v1
name: "G(FGb & F((c & Xd) | (!c & X!d))) | X(Ga & Fd)"
States: 6
Start: 0
AP: 4 "b" "c" "a" "d"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
--BODY--
State: 0
[1] 1
[!1] 2
State: 1
[!0&1&2&!3] 1 {0}
[1&!2] 4
[0&1&2&!3] 1
[!1&!2] 5
[2&3] 3
[0&!1&2&!3] 2
[!0&!1&2&!3] 2 {0}
State: 2
[1&!2] 4
[!1&!2] 5
[!0&!1&2&!3] 2 {0}
[!0&1&2&!3] 1 {0}
[0&!1&2&!3] 2 {1}
[0&1&2&!3] 1 {1}
[2&3] 3
State: 3
[1&!2] 4
[!1&!2] 5
[2] 3 {1}
State: 4
[!0&1] 4 {0}
[0&1&3] 4 {1}
[0&1&!3] 4
[0&!1&!3] 5
[0&!1&3] 5 {1}
[!0&!1] 5 {0}
State: 5
[!0&1] 4 {0}
[0&!1&3] 5
[0&!1&!3] 5 {1}
[0&1&!3] 4 {1}
[0&1&3] 4
[!0&!1] 5 {0}
--END--
EOF
diff expected1.hoa out1.hoa
diff expected2.hoa out2.hoa