* iface/gspn/ltlgspn.cc: Use command-line options to

select algorithms, not #defines.
* iface/gspn/Makefile.am (check_PROGRAMS): Remove eltlgspn-srg,
efmgspn-srg, fmgspn-rg, and fmgspn-srg and their associated
source variables.  These are all replaced by
ltlgspn-rg and ltlgspn-srg.
* iface/gspn/dcswavefm.test, iface/gspn/dcswaveltl.test,
iface/gspn/dcswaveeltl.test, iface/gspn/udcsefm.test,
iface/gspn/udcseltl.test, iface/gspn/udcsfm.test,
iface/gspn/udcsltl.test: Adjust calls to ltlgspn-srg.
This commit is contained in:
Alexandre Duret-Lutz 2003-10-08 17:27:20 +00:00
parent b64c41abcf
commit c7bbe60f4c
10 changed files with 142 additions and 80 deletions

View file

@ -8,75 +8,146 @@
#include "tgbaalgos/magic.hh"
#include "tgbaalgos/emptinesscheck.hh"
void
syntax(char* prog)
{
std::cerr << "Usage: "<< prog
<< " [OPTIONS...] model formula props..." << std::endl
<< std::endl
<< " -c compute a counter example" << std::endl
<< " (instead of just checking for emptiness)" << std::endl
<< std::endl
<< " -e use Couvreur's emptiness-check (default)" << std::endl
<< " -m degeneralize and perform a magic-search" << std::endl
<< std::endl
<< " -l use Couvreur's LaCIM algorithm for translation (default)"
<< std::endl
<< " -f use Couvreur's FM algorithm for translation"
<< std::endl;
exit(2);
}
int
main(int argc, char **argv)
try
{
int formula_index = 1;
enum { Couvreur, Magic } check = Couvreur;
enum { Lacim, Fm } trans = Lacim;
bool compute_counter_example = false;
spot::gspn_environment env;
if (argc <= 3)
while (formula_index < argc && *argv[formula_index] == '-')
{
std::cerr << "usage: " << argv[0]
<< " model formula props..." << std::endl;
exit(1);
if (!strcmp(argv[formula_index], "-c"))
{
compute_counter_example = true;
}
else if (!strcmp(argv[formula_index], "-e"))
{
check = Couvreur;
}
else if (!strcmp(argv[formula_index], "-m"))
{
check = Magic;
}
else if (!strcmp(argv[formula_index], "-l"))
{
trans = Lacim;
}
else if (!strcmp(argv[formula_index], "-f"))
{
trans = Fm;
}
else
{
syntax(argv[0]);
}
++formula_index;
}
if (argc < formula_index + 4)
syntax(argv[0]);
while (argc > 3)
while (argc > formula_index + 2)
{
env.declare(argv[argc - 1]);
--argc;
}
spot::ltl::parse_error_list pel;
spot::ltl::formula* f = spot::ltl::parse(argv[2], pel, env);
spot::ltl::formula* f = spot::ltl::parse(argv[formula_index + 1],
pel, env);
if (spot::ltl::format_parse_errors(std::cerr, argv[2], pel))
exit(1);
if (spot::ltl::format_parse_errors(std::cerr,
argv[formula_index + 1], pel))
exit(2);
argv[1] = argv[formula_index];
spot::gspn_interface gspn(2, argv);
spot::bdd_dict* dict = new spot::bdd_dict();
#if FM
spot::tgba* a_f = spot::ltl_to_tgba_fm(f, dict);
#else
spot::tgba* a_f = spot::ltl_to_tgba_lacim(f, dict);
#endif
spot::tgba* a_f = 0;
switch (trans)
{
case Fm:
a_f = spot::ltl_to_tgba_fm(f, dict);
break;
case Lacim:
a_f = spot::ltl_to_tgba_lacim(f, dict);
break;
}
spot::ltl::destroy(f);
spot::tgba* model = new spot::tgba_gspn(dict, env);
spot::tgba_product* prod = new spot::tgba_product(model, a_f);
#if CEC
{
spot::emptiness_check empty_check;
bool res = empty_check.tgba_emptiness_check(prod);
if (!res)
{
empty_check.counter_example(prod);
std::cout << empty_check.print_result(std::cout, prod, model);
exit(1);
}
else
{
std::cout << "not found";
}
}
#else
spot::tgba_tba_proxy* d = new spot::tgba_tba_proxy(prod);
{
spot::magic_search ms(d);
if (ms.check())
switch (check)
{
case Couvreur:
{
ms.print_result (std::cout, model);
exit(1);
spot::emptiness_check ec;
bool res = ec.tgba_emptiness_check(prod);
if (!res)
{
if (compute_counter_example)
{
ec.counter_example(prod);
ec.print_result(std::cout, prod, model);
}
else
{
std::cout << "non empty" << std::endl;
}
exit(1);
}
else
{
std::cout << "empty" << std::endl;
}
}
else
break;
case Magic:
{
std::cout << "not found";
spot::tgba_tba_proxy* d = new spot::tgba_tba_proxy(prod);
spot::magic_search ms(d);
if (ms.check())
{
if (compute_counter_example)
ms.print_result (std::cout, model);
else
std::cout << "non-empty" << std::endl;
exit(1);
}
else
{
std::cout << "empty" << std::endl;
}
delete d;
}
}
delete d;
#endif
}
delete prod;
delete model;
delete a_f;