* src/misc/optionmap.cc, src/misc/optionmap.hh (option_map::get,

option_map::set): Handle default values.
(anonymous::to_int): Do not print anything.
* src/tgbaalgos/gv04.cc, src/tgbaalgos/gv04.hh,
src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03.hh,
src/tgbaalgos/tau03opt.cc, src/tgbaalgos/tau03opt.hh,
src/tgbaalgos/ce.cc, src/tgbaalgos/ce.hh: Take an option_map in
the constructor.
* src/tgbaalgos/gtec.cc, src/tgbaalgos/gtec.hh: Likewise.  Handle
the "poprem", "group", and "shy" options via the option_map.
Supply a couvreur99() wrapper to the shy/non-shy variant.
* src/tgbatest/ltl2tgba.cc, src/tgbatest/randtgba.cc,
iface/gspn/ssp.cc: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2005-02-16 18:53:18 +00:00
parent 77888e9293
commit f3effb9da0
20 changed files with 274 additions and 203 deletions

View file

@ -1,3 +1,19 @@
2005-02-16 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/misc/optionmap.cc, src/misc/optionmap.hh (option_map::get,
option_map::set): Handle default values.
(anonymous::to_int): Do not print anything.
* src/tgbaalgos/gv04.cc, src/tgbaalgos/gv04.hh,
src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03.hh,
src/tgbaalgos/tau03opt.cc, src/tgbaalgos/tau03opt.hh,
src/tgbaalgos/ce.cc, src/tgbaalgos/ce.hh: Take an option_map in
the constructor.
* src/tgbaalgos/gtec.cc, src/tgbaalgos/gtec.hh: Likewise. Handle
the "poprem", "group", and "shy" options via the option_map.
Supply a couvreur99() wrapper to the shy/non-shy variant.
* src/tgbatest/ltl2tgba.cc, src/tgbatest/randtgba.cc,
iface/gspn/ssp.cc: Adjust.
2005-02-08 Alexandre Duret-Lutz <adl@src.lip6.fr> 2005-02-08 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/tgbatest/randtgba.cc: Factorize more code using the * src/tgbatest/randtgba.cc: Factorize more code using the

61
INSTALL
View file

@ -1,13 +1,16 @@
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Installation Instructions
Foundation, Inc. *************************
This file is free documentation; the Free Software Foundation gives Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it. unlimited permission to copy, distribute and modify it.
Basic Installation Basic Installation
================== ==================
These are generic installation instructions. These are generic installation instructions.
The `configure' shell script attempts to guess correct values for The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses various system-dependent variables used during compilation. It uses
@ -67,9 +70,9 @@ The simplest way to compile this package is:
Compilers and Options Compilers and Options
===================== =====================
Some systems require unusual options for compilation or linking that Some systems require unusual options for compilation or linking that the
the `configure' script does not know about. Run `./configure --help' `configure' script does not know about. Run `./configure --help' for
for details on some of the pertinent environment variables. details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here by setting variables in the command line or in the environment. Here
@ -82,7 +85,7 @@ is an example:
Compiling For Multiple Architectures Compiling For Multiple Architectures
==================================== ====================================
You can compile the package for more than one kind of computer at the You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the supports the `VPATH' variable, such as GNU `make'. `cd' to the
@ -99,19 +102,19 @@ for another architecture.
Installation Names Installation Names
================== ==================
By default, `make install' will install the package's files in By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an `/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'. option `--prefix=PREFIX'.
You can specify separate installation prefixes for You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use give `configure' the option `--exec-prefix=PREFIX', the package will
PATH as the prefix for installing programs and libraries. use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix. Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. you can set and what kinds of files go in them.
@ -122,7 +125,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features Optional Features
================= =================
Some packages pay attention to `--enable-FEATURE' options to Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package. `configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The is something like `gnu-as' or `x' (for the X Window System). The
@ -137,11 +140,11 @@ you can use the `configure' options `--x-includes=DIR' and
Specifying the System Type Specifying the System Type
========================== ==========================
There may be some features `configure' cannot figure out There may be some features `configure' cannot figure out automatically,
automatically, but needs to determine by the type of machine the package but needs to determine by the type of machine the package will run on.
will run on. Usually, assuming the package is built to be run on the Usually, assuming the package is built to be run on the _same_
_same_ architectures, `configure' can figure that out, but if it prints architectures, `configure' can figure that out, but if it prints a
a message saying it cannot guess the machine type, give it the message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system `--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form: type, such as `sun4', or a canonical name which has the form:
@ -167,9 +170,9 @@ eventually be run) with `--host=TYPE'.
Sharing Defaults Sharing Defaults
================ ================
If you want to set default values for `configure' scripts to share, If you want to set default values for `configure' scripts to share, you
you can create a site shell script called `config.site' that gives can create a site shell script called `config.site' that gives default
default values for variables like `CC', `cache_file', and `prefix'. values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then `configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the `PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script. `CONFIG_SITE' environment variable to the location of the site script.
@ -178,7 +181,7 @@ A warning: not all `configure' scripts look for a site script.
Defining Variables Defining Variables
================== ==================
Variables not defined in a site shell script can be set in the Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set variables may be lost. In order to avoid this problem, you should set
@ -186,14 +189,18 @@ them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc ./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation `configure' Invocation
====================== ======================
`configure' recognizes the following options to control how it `configure' recognizes the following options to control how it operates.
operates.
`--help' `--help'
`-h' `-h'

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004, 2005 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.
// //
@ -913,9 +913,9 @@ namespace spot
public: public:
couvreur99_check_shy_ssp(const tgba* a) couvreur99_check_shy_ssp(const tgba* a)
: couvreur99_check_shy(a, : couvreur99_check_shy(a,
true, option_map(),
numbered_state_heap_ssp_factory_semi::instance()) numbered_state_heap_ssp_factory_semi::instance())
{ {
} }
protected: protected:
@ -995,6 +995,7 @@ namespace spot
assert(dynamic_cast<const tgba_gspn_ssp*>(ssp_automata)); assert(dynamic_cast<const tgba_gspn_ssp*>(ssp_automata));
return return
new couvreur99_check(ssp_automata, new couvreur99_check(ssp_automata,
option_map(),
numbered_state_heap_ssp_factory_semi::instance()); numbered_state_heap_ssp_factory_semi::instance());
} }
@ -1005,7 +1006,7 @@ namespace spot
return return
new couvreur99_check_shy new couvreur99_check_shy
(ssp_automata, (ssp_automata,
true, option_map(),
numbered_state_heap_ssp_factory_semi::instance()); numbered_state_heap_ssp_factory_semi::instance());
} }

View file

@ -1,13 +1,16 @@
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Installation Instructions
Foundation, Inc. *************************
This file is free documentation; the Free Software Foundation gives Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it. unlimited permission to copy, distribute and modify it.
Basic Installation Basic Installation
================== ==================
These are generic installation instructions. These are generic installation instructions.
The `configure' shell script attempts to guess correct values for The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses various system-dependent variables used during compilation. It uses
@ -67,9 +70,9 @@ The simplest way to compile this package is:
Compilers and Options Compilers and Options
===================== =====================
Some systems require unusual options for compilation or linking that Some systems require unusual options for compilation or linking that the
the `configure' script does not know about. Run `./configure --help' `configure' script does not know about. Run `./configure --help' for
for details on some of the pertinent environment variables. details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here by setting variables in the command line or in the environment. Here
@ -82,7 +85,7 @@ is an example:
Compiling For Multiple Architectures Compiling For Multiple Architectures
==================================== ====================================
You can compile the package for more than one kind of computer at the You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the supports the `VPATH' variable, such as GNU `make'. `cd' to the
@ -99,19 +102,19 @@ for another architecture.
Installation Names Installation Names
================== ==================
By default, `make install' will install the package's files in By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an `/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'. option `--prefix=PREFIX'.
You can specify separate installation prefixes for You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use give `configure' the option `--exec-prefix=PREFIX', the package will
PATH as the prefix for installing programs and libraries. use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix. Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. you can set and what kinds of files go in them.
@ -122,7 +125,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features Optional Features
================= =================
Some packages pay attention to `--enable-FEATURE' options to Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package. `configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The is something like `gnu-as' or `x' (for the X Window System). The
@ -137,11 +140,11 @@ you can use the `configure' options `--x-includes=DIR' and
Specifying the System Type Specifying the System Type
========================== ==========================
There may be some features `configure' cannot figure out There may be some features `configure' cannot figure out automatically,
automatically, but needs to determine by the type of machine the package but needs to determine by the type of machine the package will run on.
will run on. Usually, assuming the package is built to be run on the Usually, assuming the package is built to be run on the _same_
_same_ architectures, `configure' can figure that out, but if it prints architectures, `configure' can figure that out, but if it prints a
a message saying it cannot guess the machine type, give it the message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system `--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form: type, such as `sun4', or a canonical name which has the form:
@ -167,9 +170,9 @@ eventually be run) with `--host=TYPE'.
Sharing Defaults Sharing Defaults
================ ================
If you want to set default values for `configure' scripts to share, If you want to set default values for `configure' scripts to share, you
you can create a site shell script called `config.site' that gives can create a site shell script called `config.site' that gives default
default values for variables like `CC', `cache_file', and `prefix'. values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then `configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the `PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script. `CONFIG_SITE' environment variable to the location of the site script.
@ -178,7 +181,7 @@ A warning: not all `configure' scripts look for a site script.
Defining Variables Defining Variables
================== ==================
Variables not defined in a site shell script can be set in the Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set variables may be lost. In order to avoid this problem, you should set
@ -186,14 +189,18 @@ them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc ./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation `configure' Invocation
====================== ======================
`configure' recognizes the following options to control how it `configure' recognizes the following options to control how it operates.
operates.
`--help' `--help'
`-h' `-h'

View file

@ -19,7 +19,6 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA. // 02111-1307, USA.
#include <cassert>
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include "optionmap.hh" #include "optionmap.hh"
@ -34,44 +33,43 @@ namespace spot
char* endptr; char* endptr;
int res = strtol(s, &endptr, 10); int res = strtol(s, &endptr, 10);
if (*endptr) if (*endptr)
{ return false;
std::cerr << "Failed to parse `" << s << "' as an integer."
<< std::endl;
return false;
}
i = res; i = res;
return true; return true;
} }
}; };
const char* option_map::parse_options(char* options) const char*
option_map::parse_options(char* options)
{ {
char* opt = strtok(options, ", \t;"); char* opt = strtok(options, ", \t;");
while (opt) while (opt)
{ {
char* equal; char* equal = strchr(opt, '=');
if ((equal = strchr(opt, '=')) != 0) if (equal)
{ {
*equal = 0; *equal = 0;
int val; int val;
if (!to_int(equal+1, val)) if (!to_int(equal + 1, val))
return opt; return opt;
options_[opt] = val; options_[opt] = val;
} }
else else
// default value if declared {
options_[opt] = 1; options_[opt] = 1;
opt = strtok(0, ", \t;"); }
} opt = strtok(0, ", \t;");
return 0; }
return 0;
} }
int option_map::get(const char* option) const int
option_map::get(const char* option, int def) const
{ {
std::map<std::string, int>::const_iterator it = options_.find(option); std::map<std::string, int>::const_iterator it = options_.find(option);
if (it == options_.end()) if (it == options_.end())
// default value if not declared // default value if not declared
return 0; return def;
else else
return it->second; return it->second;
} }
@ -81,22 +79,25 @@ namespace spot
return get(option); return get(option);
} }
int option_map::set(const char* option, int val) int
option_map::set(const char* option, int val, int def)
{ {
int old = get(option); int old = get(option, def);
options_[option] = val; options_[option] = val;
return old; return old;
} }
int& option_map::operator[](const char* option) int&
option_map::operator[](const char* option)
{ {
return options_[option]; return options_[option];
} }
std::ostream& operator<<(std::ostream& os, const option_map& m) std::ostream&
operator<<(std::ostream& os, const option_map& m)
{ {
for (std::map<std::string, int>::const_iterator it = m.options_.begin(); for (std::map<std::string, int>::const_iterator it = m.options_.begin();
it != m.options_.end(); ++it) it != m.options_.end(); ++it)
os << "\"" << it->first << "\" = " << it->second << std::endl; os << "\"" << it->first << "\" = " << it->second << std::endl;
return os; return os;
} }

View file

@ -46,19 +46,22 @@ namespace spot
/// \brief Get the value of \a option. /// \brief Get the value of \a option.
/// ///
/// \return The value associated to \a option if it exists, 0 otherwise. /// \return The value associated to \a option if it exists,
int get(const char* option) const; /// \a def otherwise.
/// \see operator[]()
int get(const char* option, int def = 0) const;
/// \brief Get the value of \a option. /// \brief Get the value of \a option.
/// ///
/// \return The value associated to \a option if it exists, 0 otherwise. /// \return The value associated to \a option if it exists, 0 otherwise.
/// \see get()
int operator[](const char* option) const; int operator[](const char* option) const;
/// \brief Set the value of \a option to \a val. /// \brief Set the value of \a option to \a val.
/// ///
/// \return The current value associated to \a option if declared, /// \return The previous value associated to \a option if declared,
/// 0 otherwise. /// or \a def otherwise.
int set(const char* option, int val); int set(const char* option, int val, int def = 0);
/// \brief Get a reference to the current value of \a option. /// \brief Get a reference to the current value of \a option.
int& operator[](const char* option); int& operator[](const char* option);

View file

@ -129,7 +129,8 @@ namespace spot
protected: protected:
/// React when options are modified. /// React when options are modified.
virtual void options_updated(const option_map& old) virtual void
options_updated(const option_map& old)
{ {
(void)old; (void)old;
} }

View file

@ -77,8 +77,8 @@ namespace spot
} }
couvreur99_check_result::couvreur99_check_result couvreur99_check_result::couvreur99_check_result
(const couvreur99_check_status* ecs) (const couvreur99_check_status* ecs, option_map o)
: emptiness_check_result(ecs->aut), ecs_(ecs) : emptiness_check_result(ecs->aut, o), ecs_(ecs)
{ {
} }

View file

@ -34,7 +34,8 @@ namespace spot
public acss_statistics public acss_statistics
{ {
public: public:
couvreur99_check_result(const couvreur99_check_status* ecs); couvreur99_check_result(const couvreur99_check_status* ecs,
option_map o = option_map());
virtual tgba_run* accepting_run(); virtual tgba_run* accepting_run();

View file

@ -30,10 +30,11 @@ namespace spot
} }
couvreur99_check::couvreur99_check(const tgba* a, couvreur99_check::couvreur99_check(const tgba* a,
bool poprem, option_map o,
const numbered_state_heap_factory* nshf) const numbered_state_heap_factory* nshf)
: emptiness_check(a), poprem_(poprem) : emptiness_check(a, o)
{ {
poprem_ = o.get("poprem", 1);
ecs_ = new couvreur99_check_status(a, nshf); ecs_ = new couvreur99_check_status(a, nshf);
} }
@ -262,7 +263,7 @@ namespace spot
// cycle. // cycle.
ecs_->cycle_seed = spi.first; ecs_->cycle_seed = spi.first;
set_states(ecs_->states()); set_states(ecs_->states());
return new couvreur99_check_result(ecs_); return new couvreur99_check_result(ecs_, options());
} }
} }
// This automaton recognizes no word. // This automaton recognizes no word.
@ -288,12 +289,13 @@ namespace spot
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
couvreur99_check_shy::couvreur99_check_shy(const tgba* a, couvreur99_check_shy::couvreur99_check_shy(const tgba* a,
bool poprem, option_map o,
bool group,
const numbered_state_heap_factory* const numbered_state_heap_factory*
nshf) nshf)
: couvreur99_check(a, poprem, nshf), num(1), group_(group) : couvreur99_check(a, o, nshf), num(1)
{ {
group_ = o.get("group", 1);
// Setup depth-first search from the initial state. // Setup depth-first search from the initial state.
todo.push_back(todo_item(0, 0)); todo.push_back(todo_item(0, 0));
todo.back().q.push_front(successor(bddtrue, ecs_->aut->get_init_state())); todo.back().q.push_front(successor(bddtrue, ecs_->aut->get_init_state()));
@ -409,7 +411,7 @@ namespace spot
// We have found an accepting SCC. Clean up TODO. // We have found an accepting SCC. Clean up TODO.
clear_todo(); clear_todo();
set_states(ecs_->states()); set_states(ecs_->states());
return new couvreur99_check_result(ecs_); return new couvreur99_check_result(ecs_, options());
} }
continue; continue;
@ -491,7 +493,7 @@ namespace spot
clear_todo(); clear_todo();
set_states(ecs_->states()); set_states(ecs_->states());
delete iter; delete iter;
return new couvreur99_check_result(ecs_); return new couvreur99_check_result(ecs_, options());
} }
// Group the pending successors of formed SCC if requested. // Group the pending successors of formed SCC if requested.
if (group_) if (group_)
@ -560,7 +562,7 @@ namespace spot
// We have found an accepting SCC. Clean up TODO. // We have found an accepting SCC. Clean up TODO.
clear_todo(); clear_todo();
set_states(ecs_->states()); set_states(ecs_->states());
return new couvreur99_check_result(ecs_); return new couvreur99_check_result(ecs_, options());
} }
} }
} }
@ -573,4 +575,14 @@ namespace spot
return ecs_->h->find(s).second; return ecs_->h->find(s).second;
} }
emptiness_check*
couvreur99(const tgba* a,
option_map o,
const numbered_state_heap_factory* nshf)
{
if (o.get("shy"))
return new couvreur99_check_shy(a, o, nshf);
return new couvreur99_check(a, o, nshf);
}
} }

View file

@ -113,19 +113,43 @@ namespace spot
/// at once in order to decide which to explore first, and must keep /// at once in order to decide which to explore first, and must keep
/// a list of all unexplored successors in its DFS stack. /// a list of all unexplored successors in its DFS stack.
/// ///
/// The \c poprem parameter specifies how the algorithm should /// The couvreur99() function is a wrapper around these two flavors
/// handle the destruction of non-accepting maximal strongly /// of the algorithm. \a options is an option map that specifies
/// connected components. If \c poprem is true, the algorithm will /// which algorithms should be used, and how.
/// keep a list of all states of a SCC that are fully processed and ///
/// should be removed once the MSCC is popped. If \c poprem is /// The following options are available.
/// false, the MSCC will be traversed again (i.e. generating the /// \li \c "shy" : if non zero, then spot::couvreur99_check_shy is used,
/// successors of the root recursively) for deletion. This is /// otherwise (and by default) spot::couvreur99_check is used.
/// a choice between memory and speed. ///
/// \li \c "poprem" : specifies how the algorithm should handle the
/// destruction of non-accepting maximal strongly connected
/// components. If \c poprem is non null, the algorithm will keep a
/// list of all states of a SCC that are fully processed and should
/// be removed once the MSCC is popped. If \c poprem is null (the
/// default), the MSCC will be traversed again (i.e. generating the
/// successors of the root recursively) for deletion. This is a
/// choice between memory and speed.
///
/// \li \c "group" : this options is used only by spot::couvreur99_check_shy.
/// If non null (the default), the successors of all the
/// states that belong to the same SCC will be considered when
/// choosing a successor. Otherwise, only the successor of the
/// topmost state on the DFS stack are considered.
emptiness_check*
couvreur99(const tgba* a,
option_map options = option_map(),
const numbered_state_heap_factory* nshf
= numbered_state_heap_hash_map_factory::instance());
/// \brief An implementation of the Couvreur99 emptiness-check algorithm.
///
/// See the documentation for spot::couvreur99.
class couvreur99_check: public emptiness_check, public ec_statistics class couvreur99_check: public emptiness_check, public ec_statistics
{ {
public: public:
couvreur99_check(const tgba* a, couvreur99_check(const tgba* a,
bool poprem = true, option_map o = option_map(),
const numbered_state_heap_factory* nshf const numbered_state_heap_factory* nshf
= numbered_state_heap_hash_map_factory::instance()); = numbered_state_heap_hash_map_factory::instance());
virtual ~couvreur99_check(); virtual ~couvreur99_check();
@ -161,18 +185,12 @@ namespace spot
/// \brief A version of spot::couvreur99_check that tries to visit /// \brief A version of spot::couvreur99_check that tries to visit
/// known states first. /// known states first.
/// ///
/// If \a group is true (the default), the successors of all the /// See the documentation for spot::couvreur99.
/// states that belong to the same SCC will be considered when
/// choosing a successor. Otherwise, only the successor of the
/// topmost state on the DFS stack are considered.
///
/// See the documentation for spot::couvreur99_check
class couvreur99_check_shy : public couvreur99_check class couvreur99_check_shy : public couvreur99_check
{ {
public: public:
couvreur99_check_shy(const tgba* a, couvreur99_check_shy(const tgba* a,
bool poprem = true, option_map o = option_map(),
bool group = true,
const numbered_state_heap_factory* nshf const numbered_state_heap_factory* nshf
= numbered_state_heap_hash_map_factory::instance()); = numbered_state_heap_hash_map_factory::instance());
virtual ~couvreur99_check_shy(); virtual ~couvreur99_check_shy();
@ -231,6 +249,7 @@ namespace spot
virtual int* find_state(const state* s); virtual int* find_state(const state* s);
}; };
/// @} /// @}
} }

View file

@ -69,8 +69,8 @@ namespace spot
int dftop; // Top of DFS stack. int dftop; // Top of DFS stack.
bool violation; // Whether an accepting run was found. bool violation; // Whether an accepting run was found.
gv04(const tgba *a) gv04(const tgba *a, option_map o)
: emptiness_check(a), accepting(a->all_acceptance_conditions()) : emptiness_check(a, o), accepting(a->all_acceptance_conditions())
{ {
assert(a->number_of_acceptance_conditions() <= 1); assert(a->number_of_acceptance_conditions() <= 1);
} }
@ -243,7 +243,8 @@ namespace spot
gv04& data; gv04& data;
result(gv04& data) result(gv04& data)
: emptiness_check_result(data.automaton()), data(data) : emptiness_check_result(data.automaton(), data.options()),
data(data)
{ {
} }
@ -405,8 +406,8 @@ namespace spot
} // anonymous } // anonymous
emptiness_check* emptiness_check*
explicit_gv04_check(const tgba* a) explicit_gv04_check(const tgba* a, option_map o)
{ {
return new gv04(a); return new gv04(a, o);
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004, 2005 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.
// //
@ -22,6 +22,8 @@
#ifndef SPOT_TGBAALGOS_GV04_HH #ifndef SPOT_TGBAALGOS_GV04_HH
# define SPOT_TGBAALGOS_GV04_HH # define SPOT_TGBAALGOS_GV04_HH
#include "misc/optionmap.hh"
namespace spot namespace spot
{ {
class tgba; class tgba;
@ -51,7 +53,8 @@ namespace spot
/// isbn = {3-540-21299-X} /// isbn = {3-540-21299-X}
/// } /// }
/// \endverbatim /// \endverbatim
emptiness_check* explicit_gv04_check(const tgba* a); emptiness_check* explicit_gv04_check(const tgba* a,
option_map o = option_map());
} }
#endif // SPOT_TGBAALGOS_GV04_HH #endif // SPOT_TGBAALGOS_GV04_HH

View file

@ -131,7 +131,7 @@ namespace spot
/// \sa spot::explicit_se05_search /// \sa spot::explicit_se05_search
/// ///
emptiness_check* bit_state_hashing_se05_search(const tgba *a, size_t size, emptiness_check* bit_state_hashing_se05_search(const tgba *a, size_t size,
option_map o = option_map()); option_map o = option_map());
/// @} /// @}
} }

View file

@ -53,8 +53,8 @@ namespace spot
{ {
public: public:
/// \brief Initialize the search algorithm on the automaton \a a /// \brief Initialize the search algorithm on the automaton \a a
tau03_search(const tgba *a, size_t size) tau03_search(const tgba *a, size_t size, option_map o)
: emptiness_check(a), : emptiness_check(a, o),
h(size), h(size),
all_cond(a->all_acceptance_conditions()) all_cond(a->all_acceptance_conditions())
{ {
@ -375,9 +375,9 @@ namespace spot
} // anonymous } // anonymous
emptiness_check* explicit_tau03_search(const tgba *a) emptiness_check* explicit_tau03_search(const tgba *a, option_map o)
{ {
return new tau03_search<explicit_tau03_search_heap>(a, 0); return new tau03_search<explicit_tau03_search_heap>(a, 0, o);
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004, 2005 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.
// //
@ -93,7 +93,8 @@ namespace spot
/// } /// }
/// \endverbatim /// \endverbatim
/// ///
emptiness_check* explicit_tau03_search(const tgba *a); emptiness_check* explicit_tau03_search(const tgba *a,
option_map o = option_map());
/// @} /// @}
} }

View file

@ -62,8 +62,8 @@ namespace spot
{ {
public: public:
/// \brief Initialize the search algorithm on the automaton \a a /// \brief Initialize the search algorithm on the automaton \a a
tau03_opt_search(const tgba *a, size_t size) tau03_opt_search(const tgba *a, size_t size, option_map o)
: emptiness_check(a), : emptiness_check(a, o),
current_weight(a->neg_acceptance_conditions()), current_weight(a->neg_acceptance_conditions()),
h(size), h(size),
all_acc(a->all_acceptance_conditions()) all_acc(a->all_acceptance_conditions())
@ -497,9 +497,9 @@ namespace spot
} // anonymous } // anonymous
emptiness_check* explicit_tau03_opt_search(const tgba *a) emptiness_check* explicit_tau03_opt_search(const tgba *a, option_map o)
{ {
return new tau03_opt_search<explicit_tau03_opt_search_heap>(a, 0); return new tau03_opt_search<explicit_tau03_opt_search_heap>(a, 0, o);
} }
} }

View file

@ -95,7 +95,8 @@ namespace spot
/// the path stored in the blue stack. Such a vector is associated to each /// the path stored in the blue stack. Such a vector is associated to each
/// state of this stack. /// state of this stack.
/// ///
emptiness_check* explicit_tau03_opt_search(const tgba *a); emptiness_check* explicit_tau03_opt_search(const tgba *a,
option_map o = option_map());
/// @} /// @}
} }

View file

@ -744,6 +744,10 @@ main(int argc, char** argv)
assert(!"unknown output option"); assert(!"unknown output option");
} }
spot::option_map o;
o.set("poprem", poprem);
o.set("group", couv_group);
spot::emptiness_check* ec = 0; spot::emptiness_check* ec = 0;
switch (echeck) switch (echeck)
{ {
@ -751,11 +755,11 @@ main(int argc, char** argv)
break; break;
case Couvreur: case Couvreur:
ec = new spot::couvreur99_check(a, poprem); ec = new spot::couvreur99_check(a, o);
break; break;
case Couvreur2: case Couvreur2:
ec = new spot::couvreur99_check_shy(a, poprem, couv_group); ec = new spot::couvreur99_check_shy(a, o);
break; break;
case MagicSearch: case MagicSearch:

View file

@ -62,72 +62,41 @@
#include "tgbaalgos/tau03opt.hh" #include "tgbaalgos/tau03opt.hh"
#include "tgbaalgos/replayrun.hh" #include "tgbaalgos/replayrun.hh"
spot::option_map options;
spot::emptiness_check* spot::emptiness_check*
couvreur99_cons(const spot::tgba* a) couvreur99_cons(const spot::tgba* a, spot::option_map o)
{ {
return new spot::couvreur99_check(a, false); return spot::couvreur99(a, o);
} }
spot::emptiness_check* spot::emptiness_check*
couvreur99_shy_cons(const spot::tgba* a) ms_cons(const spot::tgba* a, spot::option_map o)
{ {
return new spot::couvreur99_check_shy(a, false); return spot::explicit_magic_search(a, o);
} }
spot::emptiness_check* spot::emptiness_check*
couvreur99_shy_minus_cons(const spot::tgba* a) se05_cons(const spot::tgba* a, spot::option_map o)
{ {
return new spot::couvreur99_check_shy(a, false, false); return spot::explicit_se05_search(a, o);
} }
spot::emptiness_check* spot::emptiness_check*
couvreur99_rem_cons(const spot::tgba* a) bsh_ms_cons(const spot::tgba* a, spot::option_map o)
{ {
return new spot::couvreur99_check(a, true); return spot::bit_state_hashing_magic_search(a, 4096, o);
} }
spot::emptiness_check* spot::emptiness_check*
couvreur99_rem_shy_cons(const spot::tgba* a) bsh_se05_cons(const spot::tgba* a, spot::option_map o)
{ {
return new spot::couvreur99_check_shy(a, true); return spot::bit_state_hashing_se05_search(a, 4096, o);
}
spot::emptiness_check*
couvreur99_rem_shy_minus_cons(const spot::tgba* a)
{
return new spot::couvreur99_check_shy(a, true, false);
}
spot::emptiness_check*
ms_cons(const spot::tgba* a)
{
return spot::explicit_magic_search(a, options);
}
spot::emptiness_check*
se05_cons(const spot::tgba* a)
{
return spot::explicit_se05_search(a, options);
}
spot::emptiness_check*
bsh_ms_cons(const spot::tgba* a)
{
return spot::bit_state_hashing_magic_search(a, 4096, options);
}
spot::emptiness_check*
bsh_se05_cons(const spot::tgba* a)
{
return spot::bit_state_hashing_se05_search(a, 4096, options);
} }
struct ec_algo struct ec_algo
{ {
const char* name; const char* name;
spot::emptiness_check* (*construct)(const spot::tgba*); const char* options;
spot::emptiness_check* (*construct)(const spot::tgba*, spot::option_map o);
unsigned int min_acc; unsigned int min_acc;
unsigned int max_acc; unsigned int max_acc;
bool safe; bool safe;
@ -135,29 +104,53 @@ struct ec_algo
ec_algo ec_algos[] = ec_algo ec_algos[] =
{ {
{ "Cou99", couvreur99_cons, 0, -1U, true }, { "Cou99", "poprem=0",
{ "Cou99_shy-", couvreur99_shy_minus_cons, 0, -1U, true }, couvreur99_cons, 0, -1U, true },
{ "Cou99_shy", couvreur99_shy_cons, 0, -1U, true }, { "Cou99_shy-", "poprem=0,shy=1,group=0",
{ "Cou99_rem", couvreur99_rem_cons, 0, -1U, true }, couvreur99_cons, 0, -1U, true },
{ "Cou99_rem_shy-", couvreur99_rem_shy_minus_cons, 0, -1U, true }, { "Cou99_shy", "poprem=0,shy=1,group=1",
{ "Cou99_rem_shy", couvreur99_rem_shy_cons, 0, -1U, true }, couvreur99_cons, 0, -1U, true },
{ "CVWY90", ms_cons, 0, 1, true }, { "Cou99_rem", "poprem=1",
{ "CVWY90_bsh", bsh_ms_cons, 0, 1, false }, couvreur99_cons, 0, -1U, true },
{ "GV04", spot::explicit_gv04_check, 0, 1, true }, { "Cou99_rem_shy-", "poprem=1,shy=1,group=0",
{ "SE05", se05_cons, 0, 1, true }, couvreur99_cons, 0, -1U, true },
{ "SE05_bsh", bsh_se05_cons, 0, 1, false }, { "Cou99_rem_shy", "poprem=1,shy=1,group=1",
{ "Tau03", spot::explicit_tau03_search, 1, -1U, true }, couvreur99_cons, 0, -1U, true },
{ "Tau03_opt", spot::explicit_tau03_opt_search, 0, -1U, true }, { "CVWY90", 0,
ms_cons, 0, 1, true },
{ "CVWY90_bsh", 0,
bsh_ms_cons, 0, 1, false },
{ "GV04", 0,
spot::explicit_gv04_check, 0, 1, true },
{ "SE05", 0,
se05_cons, 0, 1, true },
{ "SE05_bsh", 0,
bsh_se05_cons, 0, 1, false },
{ "Tau03", 0,
spot::explicit_tau03_search, 1, -1U, true },
{ "Tau03_opt", 0,
spot::explicit_tau03_opt_search, 0, -1U, true },
}; };
spot::option_map options;
spot::emptiness_check* spot::emptiness_check*
cons_emptiness_check(int num, const spot::tgba* a, cons_emptiness_check(int num, const spot::tgba* a,
const spot::tgba* degen, unsigned int n_acc) const spot::tgba* degen, unsigned int n_acc)
{ {
spot::option_map o = options;
if (ec_algos[num].options)
{
char* x = strdup(ec_algos[num].options);
const char* err = o.parse_options(x);
assert(!err);
(void)err;
free(x);
}
if (n_acc < ec_algos[num].min_acc || n_acc > ec_algos[num].max_acc) if (n_acc < ec_algos[num].min_acc || n_acc > ec_algos[num].max_acc)
a = degen; a = degen;
if (a) if (a)
return ec_algos[num].construct(a); return ec_algos[num].construct(a, o);
return 0; return 0;
} }