Replace prune_scc() by scc_filter().

prune_scc() leaked memory and failed to remove chains of useless SCCs.

* src/tgbaalgos/reductgba_sim.cc (reduc_tgba_sim): Call
scc_filter() instead of prune_scc(), and do it before running
any simulation-based reduction.
* src/tgbaalgos/reductgba_sim.hh (reduc_tgba_sim): Return a const
tgba*.
* src/tgbatest/ltl2tgba.cc: Call scc_filter() instead of
prune_scc().
* src/tgbatest/scc.test: Add two more tests that failed with
prune_scc().
This commit is contained in:
Alexandre Duret-Lutz 2009-11-18 15:40:37 +01:00
parent 74f620d192
commit 7ea51cc65f
6 changed files with 122 additions and 66 deletions

View file

@ -1,6 +1,6 @@
// Copyright (C) 2004, 2005, 2007 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
// Copyright (C) 2004, 2005, 2007, 2009 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -21,6 +21,7 @@
#include "reductgba_sim.hh"
#include "tgba/bddprint.hh"
#include "sccfilter.hh"
namespace spot
{
@ -663,11 +664,24 @@ namespace spot
return false;
}
tgba*
const tgba*
reduc_tgba_sim(const tgba* f, int opt)
{
if (opt & Reduce_Scc)
{
f = scc_filter(f);
// No more reduction requested? Return the automaton as-is.
if (opt == Reduce_Scc)
return f;
}
spot::tgba_reduc* automatareduc = new spot::tgba_reduc(f);
// Destroy the automaton created by scc_filter.
if (opt & Reduce_Scc)
delete f;
if (opt & (Reduce_quotient_Dir_Sim | Reduce_transition_Dir_Sim))
{
direct_simulation_relation* rel
@ -696,11 +710,6 @@ namespace spot
free_relation_simulation(rel);
}
if (opt & Reduce_Scc)
{
automatareduc->prune_scc();
}
return automatareduc;
}

View file

@ -1,4 +1,4 @@
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2004, 2005, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
@ -61,7 +61,7 @@ namespace spot
/// \param opt a conjonction of spot::reduce_tgba_options specifying
/// which optimizations to apply.
/// \return the reduced automata.
tgba* reduc_tgba_sim(const tgba* a, int opt = Reduce_All);
const tgba* reduc_tgba_sim(const tgba* a, int opt = Reduce_All);
/// \brief Compute a direct simulation relation on state of tgba \a f.
direct_simulation_relation* get_direct_relation_simulation(const tgba* a,