sat: generalize the code for reading the solution

* src/misc/satsolver.cc, src/misc/satsolver.hh (satsolver_get_solution):
New function, that accepts a solution split on multiple 'v ' lines.
* src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc (get_solution):
Remove, and adjust existing code to use satsolver_get_solution().
* src/tgbatest/readsat.cc, src/tgbatest/readsat.test: New files.
* src/tgbatest/Makefile.am: Add them.
* src/bin/man/spot-x.x: Mention the SAT competition rules for
the expected input/output format.
This commit is contained in:
Alexandre Duret-Lutz 2013-08-28 15:24:16 +02:00
parent 1ab46b0864
commit 90c106f8a8
8 changed files with 147 additions and 65 deletions

View file

@ -43,6 +43,7 @@ check_PROGRAMS = \
ltlprod \
mixprod \
powerset \
readsat \
taatgba \
tgbaread \
tripprod
@ -65,6 +66,7 @@ ltlprod_SOURCES = ltlprod.cc
mixprod_SOURCES = mixprod.cc
powerset_SOURCES = powerset.cc
randtgba_SOURCES = randtgba.cc
readsat_SOURCES = readsat.cc
taatgba_SOURCES = taatgba.cc
tgbaread_SOURCES = tgbaread.cc
tripprod_SOURCES = tripprod.cc

29
src/tgbatest/readsat.cc Normal file
View file

@ -0,0 +1,29 @@
// Copyright (C) 2013 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 "misc/satsolver.hh"
int main()
{
spot::sat_solution sol = spot::satsolver_get_solution("-");
for (spot::sat_solution::const_iterator i = sol.begin();
i != sol.end(); ++i)
std::cout << ' ' << *i;
std::cout << '\n';
}

52
src/tgbatest/readsat.test Executable file
View file

@ -0,0 +1,52 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013 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/>.
# Do some quick translations to make sure the neverclaims produced by
# spot actually look correct! We do that by parsing them via ltlcross.
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
. ./defs
set -e
cat > foo <<EOF
c some comment
c more comment
v 12 13
cignore
vignore
v 14 -15
signore
v
EOF
test ' 12 13 14 -15' = "`../readsat < foo`"
cat > foo <<EOF
c some comment
c more comment
v12 13
cignore
vignore
v 14 0 -15
signore
v
EOF
test ' 14' = "`../readsat < foo`"