* wrap/python/spot.i: Wrap spot::emptiness_check_instantiator.
* wrap/python/cgi/ltl2tgba.in: Offers all 6 emptiness check algorithms, and a text box for options.
This commit is contained in:
parent
396894f7a7
commit
851ca0d807
3 changed files with 72 additions and 49 deletions
|
|
@ -1,3 +1,9 @@
|
||||||
|
2006-01-10 Alexandre Duret-Lutz <adl@gnu.org>
|
||||||
|
|
||||||
|
* wrap/python/spot.i: Wrap spot::emptiness_check_instantiator.
|
||||||
|
* wrap/python/cgi/ltl2tgba.in: Offers all 6 emptiness
|
||||||
|
check algorithms, and a text box for options.
|
||||||
|
|
||||||
2006-01-05 Alexandre Duret-Lutz <adl@gnu.org>
|
2006-01-05 Alexandre Duret-Lutz <adl@gnu.org>
|
||||||
|
|
||||||
* src/tgbaalgos/ndfs_result.hxx (ndfs_result::construct_cycle):
|
* src/tgbaalgos/ndfs_result.hxx (ndfs_result::construct_cycle):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!@PYTHON@
|
#!@PYTHON@
|
||||||
# -*- mode: python; coding: iso-8859-1 -*-
|
# -*- mode: python; coding: iso-8859-1 -*-
|
||||||
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
# Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
# et Marie Curie.
|
# et Marie Curie.
|
||||||
#
|
#
|
||||||
|
|
@ -241,10 +241,15 @@ options_accepting_run = [
|
||||||
('draw_acc_run', 'draw an accepting run...', 0),
|
('draw_acc_run', 'draw an accepting run...', 0),
|
||||||
('emptiness_check',
|
('emptiness_check',
|
||||||
['... found using this algorithm: ',
|
['... found using this algorithm: ',
|
||||||
'couvreur99',
|
'Cou99',
|
||||||
'couvreur99_shy',
|
'CVWY90',
|
||||||
'explicit_magic_search',
|
'GV04',
|
||||||
'explicit_se05'], 'no')
|
'SE05',
|
||||||
|
'Tau03',
|
||||||
|
'Tau03_opt'], 'no'),
|
||||||
|
('emptiness_check_options',
|
||||||
|
'...with these <a href="http://spot.lip6.fr/wiki/EmptinessCheckOptions">'
|
||||||
|
+ 'options</a>:', ''),
|
||||||
]
|
]
|
||||||
|
|
||||||
print ("""<FORM action="%s" method="post"><P>
|
print ("""<FORM action="%s" method="post"><P>
|
||||||
|
|
@ -328,10 +333,11 @@ def add_options(opt_group, opt_column, opt_color, opt_list):
|
||||||
else:
|
else:
|
||||||
prefix = ' '
|
prefix = ' '
|
||||||
for opt, desc, arg, in opt_list:
|
for opt, desc, arg, in opt_list:
|
||||||
if formula:
|
if not isinstance(arg, str):
|
||||||
val = int(form.getfirst(opt, 0))
|
if formula:
|
||||||
else:
|
val = int(form.getfirst(opt, 0))
|
||||||
val = arg
|
else:
|
||||||
|
val = arg
|
||||||
|
|
||||||
s = '<TD%s>%s' % (opt_color, prefix);
|
s = '<TD%s>%s' % (opt_color, prefix);
|
||||||
if isinstance(desc, list):
|
if isinstance(desc, list):
|
||||||
|
|
@ -341,19 +347,24 @@ def add_options(opt_group, opt_column, opt_color, opt_list):
|
||||||
val = n
|
val = n
|
||||||
for i in desc[1:]:
|
for i in desc[1:]:
|
||||||
if n == val:
|
if n == val:
|
||||||
str = ' selected'
|
chk = ' selected'
|
||||||
else:
|
else:
|
||||||
str = ''
|
chk = ''
|
||||||
s += '<option value="%s"%s>%s' % (n, str, i);
|
s += '<option value="%s"%s>%s' % (n, chk, i);
|
||||||
n += 1
|
n += 1
|
||||||
s += '</select>'
|
s += '</select>'
|
||||||
val = desc[val]
|
val = desc[val]
|
||||||
|
elif isinstance(arg, str):
|
||||||
|
val = form.getfirst(opt, arg)
|
||||||
|
s += (('%s <INPUT type="text" maxlength="40" '
|
||||||
|
+ 'name="%s" value="%s">') %
|
||||||
|
(desc, opt, cgi.escape(val, True)))
|
||||||
else:
|
else:
|
||||||
if val:
|
if val:
|
||||||
str = ' checked'
|
chk = ' checked'
|
||||||
else:
|
else:
|
||||||
str = ''
|
chk = ''
|
||||||
s += '<INPUT type="checkbox" name="%s" value="1"%s>%s' % (opt, str,
|
s += '<INPUT type="checkbox" name="%s" value="1"%s>%s' % (opt, chk,
|
||||||
desc)
|
desc)
|
||||||
|
|
||||||
column[opt_column].append((s + '</TD>'))
|
column[opt_column].append((s + '</TD>'))
|
||||||
|
|
@ -364,13 +375,13 @@ column[0].append("<TH>Algorithm</TH>")
|
||||||
trans = form.getfirst("trans", default_translator)
|
trans = form.getfirst("trans", default_translator)
|
||||||
for opt, desc, color in translators:
|
for opt, desc, color in translators:
|
||||||
if trans == opt:
|
if trans == opt:
|
||||||
str = "checked"
|
chk = "checked"
|
||||||
else:
|
else:
|
||||||
str = ""
|
chk = ""
|
||||||
globals()[opt] = str
|
globals()[opt] = chk
|
||||||
s = \
|
s = \
|
||||||
'<TD bgcolor="%s"><INPUT type="radio" name="trans" value="%s" %s>%s</TD>'
|
'<TD bgcolor="%s"><INPUT type="radio" name="trans" value="%s" %s>%s</TD>'
|
||||||
column[0].append(s % (color, opt, str, desc))
|
column[0].append(s % (color, opt, chk, desc))
|
||||||
add_options('', 0, color, globals()['options_' + opt])
|
add_options('', 0, color, globals()['options_' + opt])
|
||||||
|
|
||||||
add_options("Search accepting run?", 0, '', options_accepting_run)
|
add_options("Search accepting run?", 0, '', options_accepting_run)
|
||||||
|
|
@ -555,41 +566,36 @@ if show_lbtt:
|
||||||
|
|
||||||
if draw_acc_run or print_acc_run:
|
if draw_acc_run or print_acc_run:
|
||||||
print '<H3>Accepting run</H3>'
|
print '<H3>Accepting run</H3>'
|
||||||
ec_msg = "Running " + emptiness_check
|
err = ""
|
||||||
ec_a = automaton
|
opt = emptiness_check + "(" + emptiness_check_options + ")"
|
||||||
if emptiness_check == 'couvreur99':
|
eci, err = spot.emptiness_check_instantiator.construct(opt)
|
||||||
ec = spot.couvreur99_check(automaton)
|
|
||||||
elif emptiness_check == 'couvreur99_shy':
|
ec_msg = "Running " + opt
|
||||||
ec = spot.couvreur99_check_shy(automaton)
|
|
||||||
elif (emptiness_check == 'explicit_magic_search'
|
if not eci:
|
||||||
or emptiness_check == 'explicit_se05'):
|
print ('<font color="red">Cannot parse "' + opt + '" near "' + err
|
||||||
|
+ '".</font>')
|
||||||
|
else:
|
||||||
ec_a = 0
|
ec_a = 0
|
||||||
if degen:
|
n_acc = automaton.number_of_acceptance_conditions()
|
||||||
ec_a = degen
|
n_max = eci.max_acceptance_conditions()
|
||||||
ec_msg += ' <b>on degeneralized automaton</b>'
|
if (n_acc <= n_max):
|
||||||
|
ec_a = automaton
|
||||||
else:
|
else:
|
||||||
count = automaton.number_of_acceptance_conditions()
|
if degen:
|
||||||
if (count <= 1):
|
ec_a = degen
|
||||||
ec_a = automaton
|
ec_msg += ' <b>on degeneralized automaton</b>'
|
||||||
else:
|
else:
|
||||||
ec_a = 0
|
|
||||||
print ('<font color="red">Cannot run ' + emptiness_check
|
print ('<font color="red">Cannot run ' + emptiness_check
|
||||||
+ ' on automata with more than 1 acceptance '
|
+ ' on automata with more than ' + n_max + ' acceptance '
|
||||||
+ 'condition. Please select "draw degeneralized '
|
+ 'conditions. Please select "draw degeneralized '
|
||||||
+ 'Büchi automaton" if you want to try this'
|
+ 'Büchi automaton" if you want to try this'
|
||||||
+ ' algorithm on the degeneralized version of the'
|
+ ' algorithm on the degeneralized version of the'
|
||||||
+ ' automaton.</font>')
|
+ ' automaton.</font>')
|
||||||
|
|
||||||
if ec_a:
|
if ec_a:
|
||||||
if emptiness_check == 'explicit_magic_search':
|
ec = eci.instantiate(ec_a)
|
||||||
ec = spot.explicit_magic_search(ec_a)
|
|
||||||
elif emptiness_check == 'explicit_se05':
|
|
||||||
ec = spot.explicit_se05_search(ec_a)
|
|
||||||
else:
|
|
||||||
ec = 0
|
|
||||||
else:
|
|
||||||
print emptiness_check, "unsupported"
|
|
||||||
sys.stdout.flush()
|
|
||||||
assert 0
|
|
||||||
if ec:
|
if ec:
|
||||||
print '%s: ' % ec_msg
|
print '%s: ' % ec_msg
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// de Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||||
// et Marie Curie.
|
// Université Pierre et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -94,6 +94,14 @@ using namespace spot::ltl;
|
||||||
using namespace spot;
|
using namespace spot;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// For spot::emptiness_check_instantiator::construct and any other
|
||||||
|
// function that return errors via a "char **err" argument.
|
||||||
|
%typemap(in, numinputs=0) char** OUTPUT (char* temp)
|
||||||
|
"$1 = &temp;";
|
||||||
|
%typemap(argout, fragment="t_output_helper") char** OUTPUT
|
||||||
|
"$result = t_output_helper($result, SWIG_FromCharPtr(*$1));";
|
||||||
|
%apply char** OUTPUT { char** err };
|
||||||
|
|
||||||
%include "misc/version.hh"
|
%include "misc/version.hh"
|
||||||
%include "misc/bddalloc.hh"
|
%include "misc/bddalloc.hh"
|
||||||
%include "misc/minato.hh"
|
%include "misc/minato.hh"
|
||||||
|
|
@ -139,6 +147,9 @@ using namespace spot;
|
||||||
%feature("new") spot::explicit_magic_search;
|
%feature("new") spot::explicit_magic_search;
|
||||||
%feature("new") spot::explicit_se05_search;
|
%feature("new") spot::explicit_se05_search;
|
||||||
|
|
||||||
|
%feature("new") spot::emptiness_check_instantiator::construct;
|
||||||
|
%feature("new") spot::emptiness_check_instantiator::instanciate;
|
||||||
|
|
||||||
// Help SWIG with namespace lookups.
|
// Help SWIG with namespace lookups.
|
||||||
#define ltl spot::ltl
|
#define ltl spot::ltl
|
||||||
%include "tgba/bdddict.hh"
|
%include "tgba/bdddict.hh"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue