postproc: Add an option_map parameter

* src/tgbaalgos/postproc.cc: Add an option_map parameter, and use to get
extra options to pass to the degeneralization algorithm.
* src/tgbaalgos/postproc.hh: Adjust prototype, and store Boolean
variables for degeneralize() options.
* src/bin/ltl2tgba.cc: Add a -x option to fill the option map, and pass
it to the postprocessor.
* src/bin/man/ltl2tgba.x: Document the three degeneralization options.
This commit is contained in:
Alexandre Duret-Lutz 2013-02-01 19:00:31 +01:00
parent 1b2f9fe5d8
commit 05e59a9e1a
4 changed files with 74 additions and 13 deletions

View file

@ -24,6 +24,8 @@
#include "degen.hh"
#include "stats.hh"
#include "stripacc.hh"
#include <cstdlib>
#include "misc/optionmap.hh"
namespace spot
{
@ -41,6 +43,18 @@ namespace spot
return st.states;
}
postprocessor::postprocessor(const option_map* opt)
: type_(TGBA), pref_(Small), level_(High),
degen_reset(true), degen_order(false), degen_cache(true)
{
if (opt)
{
degen_order = opt->get("degen-order", 0);
degen_reset = opt->get("degen-reset", 1);
degen_cache = opt->get("degen-lcache", 1);
}
}
const tgba* postprocessor::run(const tgba* a, const ltl::formula* f)
{
if (type_ == TGBA && pref_ == Any && level_ == Low)
@ -100,7 +114,10 @@ namespace spot
{
if (type_ == BA)
{
const tgba* d = degeneralize(a);
const tgba* d = degeneralize(a,
degen_reset,
degen_order,
degen_cache);
delete a;
a = d;
}
@ -133,7 +150,10 @@ namespace spot
// Degeneralize the result of the simulation if needed.
if (type_ == BA)
{
const tgba* d = degeneralize(sim);
const tgba* d = degeneralize(sim,
degen_reset,
degen_order,
degen_cache);
delete sim;
sim = d;
}

View file

@ -24,6 +24,8 @@
namespace spot
{
class option_map;
/// \addtogroup tgba_reduction
/// @{
@ -45,9 +47,9 @@ namespace spot
/// deterministic automata or small automata. If you don't care,
/// less post processing will be done.
///
/// The set_level() method let you set the optimization level.
/// Higher level enable more costly postprocessign. For instance
/// pref=Small,level=High will try two different postprocessings
/// The set_level() method lets you set the optimization level.
/// A higher level enables more costly post-processings. For instance
/// pref=Small,level=High will try two different post-processings
/// (one with minimize_obligation(), and one with
/// iterated_simulations()) an keep the smallest result.
/// pref=Small,level=Medium will only try the iterated_simulations()
@ -57,10 +59,11 @@ namespace spot
class postprocessor
{
public:
postprocessor()
: type_(TGBA), pref_(Small), level_(High)
{
}
/// \brief Construct a postprocessor.
///
/// The \a opt argument can be used to pass extra fine-tuning
/// options used for debugging or benchmarking.
postprocessor(const option_map* opt = 0);
enum output_type { TGBA, BA, Monitor };
void
@ -76,7 +79,6 @@ namespace spot
pref_ = pref;
}
enum optimization_level { Low, Medium, High };
void
set_level(optimization_level level)
@ -91,6 +93,10 @@ namespace spot
output_type type_;
output_pref pref_;
optimization_level level_;
// Fine-tuning degeneralization options.
bool degen_reset;
bool degen_order;
bool degen_cache;
};
/// @}
}