Producing state-based acceptance is now part of the postprocessing routines. That means we can more easily simplify automata with state-based acceptance (using autfilt -S --small --high, for instance) and as as side-effect, ltl2tgba can produce GBA. However the result of ltl2tgba -S is often larger than that of ltl2tgba -B. * src/twaalgos/postproc.cc, src/twaalgos/postproc.hh: Implement the SBAcc option. * src/bin/common_post.cc, src/bin/common_post.hh: Implement -S. * src/bin/autfilt.cc, src/bin/dstar2tgba.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltldo.cc: Adjust. * src/tests/sim3.test: Augment test case. * NEWS, doc/org/ltl2tgba.org, doc/org/autfilt.org: Document it -S.
123 lines
4.2 KiB
C++
123 lines
4.2 KiB
C++
// -*- coding: utf-8 -*-
|
|
// Copyright (C) 2012, 2013, 2014, 2015 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 "common_post.hh"
|
|
#include "common_r.hh"
|
|
#include "error.h"
|
|
|
|
spot::postprocessor::output_type type = spot::postprocessor::TGBA;
|
|
spot::postprocessor::output_pref pref = spot::postprocessor::Small;
|
|
spot::postprocessor::output_pref comp = spot::postprocessor::Any;
|
|
spot::postprocessor::output_pref sbacc = spot::postprocessor::Any;
|
|
spot::postprocessor::optimization_level level = spot::postprocessor::High;
|
|
|
|
enum {
|
|
OPT_HIGH = 1,
|
|
OPT_LOW,
|
|
OPT_MEDIUM,
|
|
OPT_SMALL,
|
|
};
|
|
|
|
static const argp_option options[] =
|
|
{
|
|
/**************************************************/
|
|
{ 0, 0, 0, 0, "Translation intent:", 20 },
|
|
{ "small", OPT_SMALL, 0, 0, "prefer small automata (default)", 0 },
|
|
{ "deterministic", 'D', 0, 0, "prefer deterministic automata", 0 },
|
|
{ "any", 'a', 0, 0, "no preference, do not bother making it small "
|
|
"or deterministic", 0 },
|
|
{ "complete", 'C', 0, 0, "output a complete automaton (combine "
|
|
"with other intents)", 0 },
|
|
{ "state-based-acceptance", 'S', 0, 0,
|
|
"define the acceptance using states", 0 },
|
|
{ "sbacc", 0, 0, OPTION_ALIAS, 0, 0 },
|
|
/**************************************************/
|
|
{ 0, 0, 0, 0, "Optimization level:", 21 },
|
|
{ "low", OPT_LOW, 0, 0, "minimal optimizations (fast)", 0 },
|
|
{ "medium", OPT_MEDIUM, 0, 0, "moderate optimizations", 0 },
|
|
{ "high", OPT_HIGH, 0, 0,
|
|
"all available optimizations (slow, default)", 0 },
|
|
{ 0, 0, 0, 0, 0, 0 }
|
|
};
|
|
|
|
static const argp_option options_disabled[] =
|
|
{
|
|
/**************************************************/
|
|
{ 0, 0, 0, 0, "Translation intent:", 20 },
|
|
{ "small", OPT_SMALL, 0, 0, "prefer small automata", 0 },
|
|
{ "deterministic", 'D', 0, 0, "prefer deterministic automata", 0 },
|
|
{ "any", 'a', 0, 0, "no preference, do not bother making it small "
|
|
"or deterministic (default)", 0 },
|
|
{ "complete", 'C', 0, 0, "output a complete automaton (combine "
|
|
"with other intents)", 0 },
|
|
{ "state-based-acceptance", 'S', 0, 0,
|
|
"define the acceptance using states", 0 },
|
|
{ "sbacc", 0, 0, OPTION_ALIAS, 0, 0 },
|
|
/**************************************************/
|
|
{ 0, 0, 0, 0, "Optimization level:", 21 },
|
|
{ "low", OPT_LOW, 0, 0, "minimal optimizations (fast, default)", 0 },
|
|
{ "medium", OPT_MEDIUM, 0, 0, "moderate optimizations", 0 },
|
|
{ "high", OPT_HIGH, 0, 0,
|
|
"all available optimizations (slow)", 0 },
|
|
{ 0, 0, 0, 0, 0, 0 }
|
|
};
|
|
|
|
static int
|
|
parse_opt_post(int key, char*, struct argp_state*)
|
|
{
|
|
// This switch is alphabetically-ordered.
|
|
switch (key)
|
|
{
|
|
case 'a':
|
|
pref = spot::postprocessor::Any;
|
|
break;
|
|
case 'C':
|
|
comp = spot::postprocessor::Complete;
|
|
break;
|
|
case 'D':
|
|
pref = spot::postprocessor::Deterministic;
|
|
break;
|
|
case 'S':
|
|
sbacc = spot::postprocessor::SBAcc;
|
|
break;
|
|
case OPT_HIGH:
|
|
level = spot::postprocessor::High;
|
|
simplification_level = 3;
|
|
break;
|
|
case OPT_LOW:
|
|
level = spot::postprocessor::Low;
|
|
simplification_level = 1;
|
|
break;
|
|
case OPT_MEDIUM:
|
|
level = spot::postprocessor::Medium;
|
|
simplification_level = 2;
|
|
break;
|
|
case OPT_SMALL:
|
|
pref = spot::postprocessor::Small;
|
|
break;
|
|
default:
|
|
return ARGP_ERR_UNKNOWN;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
const struct argp post_argp =
|
|
{ options, parse_opt_post, 0, 0, 0, 0, 0 };
|
|
const struct argp post_argp_disabled =
|
|
{ options_disabled, parse_opt_post, 0, 0, 0, 0, 0 };
|