zlktree: implement ACD and its transform

A quick and dirty implementation of the Alternating Cycle
Decomposition of the casares.21.icalp paper.

* spot/twaalgos/genem.cc, spot/twaalgos/genem.hh
(maximal_accepting_loops_for_scc): New function.
* spot/twaalgos/sccinfo.cc,
spot/twaalgos/sccinfo.hh (scc_and_mark_filter): Add a possibility to
specify a mask of transition to filter.
* spot/twaalgos/zlktree.hh, spot/twaalgos/zlktree.cc (acd): New class.
(acd_transform): New function.
* python/spot/__init__.py: Add SVG rendering for acd.
* tests/python/_zlktree.ipynb: Play with acd and acd_transform.
* tests/python/toparity.py: Add more tests to compare the
sizes of acd_transform and to_parity.
* NEWS: Mention this new feature.
This commit is contained in:
Alexandre Duret-Lutz 2021-08-09 15:22:17 +02:00
parent 8c5bb6c2eb
commit 26f2179805
10 changed files with 4657 additions and 144 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2017-2020 Laboratoire de Recherche et Developpement
// Copyright (C) 2017-2021 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -62,6 +62,27 @@ namespace spot
generic_emptiness_check_for_scc(const scc_info& si, unsigned scc,
const acc_cond& forced_acc);
#ifndef SWIG
/// \ingroup emptiness_check_algorithms
/// \brief Compute set of maximal accepting loops in one SCC,
/// for any acceptance condition.
///
/// This computes all maximal subsets of the edges of an SCC
/// that form accepting (sub) SCCs. For each such subset, the
/// \a callback function is called with `(si, num)`, such that
/// `si->inner_edges_of(num)` lists the relevant edges.
///
/// The search is restricted to a set of edges of the given SCC
/// for which \a keep (an array indexed by edge numbers) is true.
///
/// Returns false iff no accepting loop where found.
SPOT_API bool
maximal_accepting_loops_for_scc(const scc_info& si, unsigned scc,
const acc_cond& forced_acc,
const std::vector<bool>& keep,
std::function<void(const scc_info&,
unsigned)> callback);
#endif
/// \ingroup emptiness_check_algorithms
///