remove algorithms that where only used by dstar's dra2ba conversion

Since we just removed that conversion, those can go as well.  Yay!

* src/tests/kv.test, src/twa/twamask.cc,
src/twa/twamask.hh, src/twa/twaproxy.cc,
src/twa/twaproxy.hh, src/twaalgos/scc.cc,
src/twaalgos/scc.hh: Delete.
* src/twaalgos/Makefile.am, src/twa/Makefile.am,
src/tests/Makefile.am, src/tests/ikwiad.cc: adjust.
This commit is contained in:
Alexandre Duret-Lutz 2015-08-20 21:31:07 +02:00
parent 9b5340b90a
commit 62f5b9769b
11 changed files with 1 additions and 1181 deletions

View file

@ -34,8 +34,6 @@ twa_HEADERS = \
taatgba.hh \
twa.hh \
twagraph.hh \
twamask.hh \
twaproxy.hh \
twaproduct.hh \
twasafracomplement.hh
@ -49,6 +47,4 @@ libtwa_la_SOURCES = \
twa.cc \
twagraph.cc \
twaproduct.cc \
twamask.cc \
twaproxy.cc \
twasafracomplement.cc

View file

@ -1,231 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "twamask.hh"
#include <vector>
namespace spot
{
namespace
{
struct transition
{
const state* dest;
bdd cond;
acc_cond::mark_t acc;
};
typedef std::vector<transition> transitions;
struct succ_iter_filtered: public twa_succ_iterator
{
~succ_iter_filtered()
{
for (auto& t: trans_)
t.dest->destroy();
}
bool first()
{
it_ = trans_.begin();
return it_ != trans_.end();
}
bool next()
{
++it_;
return it_ != trans_.end();
}
bool done() const
{
return it_ == trans_.end();
}
state* current_state() const
{
return it_->dest->clone();
}
bdd current_condition() const
{
return it_->cond;
}
acc_cond::mark_t current_acceptance_conditions() const
{
return it_->acc;
}
transitions trans_;
transitions::const_iterator it_;
};
/// \ingroup twa_on_the_fly_algorithms
/// \brief A masked TGBA (abstract).
///
/// Ignores some states from a TGBA. What state are preserved or
/// ignored is controlled by the wanted() method.
///
/// This is an abstract class. You should inherit from it and
/// supply a wanted() method to specify which states to keep.
class twa_mask: public twa_proxy
{
protected:
/// \brief Constructor.
/// \param masked The automaton to mask
/// \param init Any state to use as initial state. This state will be
/// destroyed by the destructor.
twa_mask(const const_twa_ptr& masked, const state* init = 0):
twa_proxy(masked),
init_(init)
{
if (!init)
init_ = masked->get_init_state();
}
public:
virtual ~twa_mask()
{
init_->destroy();
}
virtual state* get_init_state() const
{
return init_->clone();
}
virtual twa_succ_iterator*
succ_iter(const state* local_state) const
{
succ_iter_filtered* res;
if (iter_cache_)
{
res = down_cast<succ_iter_filtered*>(iter_cache_);
res->trans_.clear();
iter_cache_ = nullptr;
}
else
{
res = new succ_iter_filtered;
}
for (auto it: original_->succ(local_state))
{
const spot::state* s = it->current_state();
auto acc = it->current_acceptance_conditions();
if (!wanted(s, acc))
{
s->destroy();
continue;
}
res->trans_.emplace_back
(transition {s, it->current_condition(), acc});
}
return res;
}
virtual bool wanted(const state* s, acc_cond::mark_t acc) const = 0;
protected:
const state* init_;
};
class twa_mask_keep: public twa_mask
{
const state_set& mask_;
public:
twa_mask_keep(const const_twa_ptr& masked,
const state_set& mask,
const state* init)
: twa_mask(masked, init),
mask_(mask)
{
}
bool wanted(const state* s, const acc_cond::mark_t) const
{
state_set::const_iterator i = mask_.find(s);
return i != mask_.end();
}
};
class twa_mask_ignore: public twa_mask
{
const state_set& mask_;
public:
twa_mask_ignore(const const_twa_ptr& masked,
const state_set& mask,
const state* init)
: twa_mask(masked, init),
mask_(mask)
{
}
bool wanted(const state* s, const acc_cond::mark_t) const
{
state_set::const_iterator i = mask_.find(s);
return i == mask_.end();
}
};
class twa_mask_acc_ignore: public twa_mask
{
unsigned mask_;
public:
twa_mask_acc_ignore(const const_twa_ptr& masked,
unsigned mask,
const state* init)
: twa_mask(masked, init),
mask_(mask)
{
}
bool wanted(const state*, const acc_cond::mark_t acc) const
{
return !acc.has(mask_);
}
};
}
const_twa_ptr
build_twa_mask_keep(const const_twa_ptr& to_mask,
const state_set& to_keep,
const state* init)
{
return std::make_shared<twa_mask_keep>(to_mask, to_keep, init);
}
const_twa_ptr
build_twa_mask_ignore(const const_twa_ptr& to_mask,
const state_set& to_ignore,
const state* init)
{
return std::make_shared<twa_mask_ignore>(to_mask, to_ignore, init);
}
const_twa_ptr
build_twa_mask_acc_ignore(const const_twa_ptr& to_mask,
unsigned to_ignore,
const state* init)
{
return std::make_shared<twa_mask_acc_ignore>(to_mask, to_ignore, init);
}
}

View file

@ -1,66 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <bddx.h>
#include "twaproxy.hh"
namespace spot
{
/// \ingroup twa_on_the_fly_algorithms
/// \brief Mask a TGBA, keeping a given set of states.
///
/// Mask the TGBA \a to_mask, keeping only the
/// states from \a to_keep. The initial state
/// can optionally be reset to \a init.
SPOT_API const_twa_ptr
build_twa_mask_keep(const const_twa_ptr& to_mask,
const state_set& to_keep,
const state* init = 0);
/// \ingroup twa_on_the_fly_algorithms
/// \brief Mask a TGBA, rejecting a given set of states.
///
/// Mask the TGBA \a to_mask, keeping only the states that are not
/// in \a to_ignore. The initial state can optionally be reset to
/// \a init.
SPOT_API const_twa_ptr
build_twa_mask_ignore(const const_twa_ptr& to_mask,
const state_set& to_ignore,
const state* init = 0);
/// \ingroup twa_on_the_fly_algorithms
/// \brief Mask a TGBA, rejecting some acceptance set of transitions.
///
/// This will ignore all transitions that have the TO_IGNORE
/// acceptance mark. The initial state can optionally be reset to
/// \a init.
///
/// Note that the acceptance condition of the automaton (i.e. the
/// set of all acceptance set) is not changed, because so far this
/// function is only needed in graph algorithms that do not call
/// all_acceptance_conditions().
SPOT_API const_twa_ptr
build_twa_mask_acc_ignore(const const_twa_ptr& to_mask,
unsigned to_ignore,
const state* init = 0);
}

View file

@ -1,75 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "twaproxy.hh"
namespace spot
{
twa_proxy::twa_proxy(const const_twa_ptr& original)
: twa(original->get_dict()), original_(original)
{
get_dict()->register_all_variables_of(original, this);
acc_.add_sets(original->num_sets());
}
twa_proxy::~twa_proxy()
{
get_dict()->unregister_all_my_variables(this);
}
state* twa_proxy::get_init_state() const
{
return original_->get_init_state();
}
twa_succ_iterator*
twa_proxy::succ_iter(const state* state) const
{
if (iter_cache_)
{
original_->release_iter(iter_cache_);
iter_cache_ = nullptr;
}
return original_->succ_iter(state);
}
std::string
twa_proxy::format_state(const state* state) const
{
return original_->format_state(state);
}
std::string
twa_proxy::transition_annotation(const twa_succ_iterator* t) const
{
return original_->transition_annotation(t);
}
state*
twa_proxy::project_state(const state* s, const const_twa_ptr& t) const
{
return original_->project_state(s, t);
}
bdd
twa_proxy::compute_support_conditions(const state* state) const
{
return original_->support_conditions(state);
}
}

View file

@ -1,59 +0,0 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "twa.hh"
namespace spot
{
/// \ingroup twa_on_the_fly_algorithms
/// \brief A TGBA proxy.
///
/// This implements a simple proxy to an existing
/// TGBA, forwarding all methods to the original.
/// By itself this class is pointless: better use the
/// original automaton right away. However it is useful
/// to inherit from this class and override some of its
/// methods to implement some on-the-fly algorithm.
class SPOT_API twa_proxy: public twa
{
protected:
twa_proxy(const const_twa_ptr& original);
public:
virtual ~twa_proxy();
virtual state* get_init_state() const;
virtual twa_succ_iterator*
succ_iter(const state* state) const;
virtual std::string format_state(const state* state) const;
virtual std::string
transition_annotation(const twa_succ_iterator* t) const;
virtual state* project_state(const state* s, const const_twa_ptr& t) const;
protected:
virtual bdd compute_support_conditions(const state* state) const;
const_twa_ptr original_;
};
}