792 research outputs found
Efficient Pattern Matching in Python
Pattern matching is a powerful tool for symbolic computations. Applications
include term rewriting systems, as well as the manipulation of symbolic
expressions, abstract syntax trees, and XML and JSON data. It also allows for
an intuitive description of algorithms in the form of rewrite rules. We present
the open source Python module MatchPy, which offers functionality and
expressiveness similar to the pattern matching in Mathematica. In particular,
it includes syntactic pattern matching, as well as matching for commutative
and/or associative functions, sequence variables, and matching with
constraints. MatchPy uses new and improved algorithms to efficiently find
matches for large pattern sets by exploiting similarities between patterns. The
performance of MatchPy is investigated on several real-world problems
2D object reconstruction with ASP
Damages to cultural heritage due to human malicious actions or to natural disasters (e.g., earthquakes, tornadoes) are nowadays more and more frequent. Huge work is needed by professional restores to reproduce, as best as possible, the original artwork or architecture opera starting from the potsherds. The tool we are presenting in this paper is devised for being a digital support for this kind of work. As soon as the fragments of the opera are cataloged, a user (possibly young students, and even children, using a tablet or a smartphone as playing with a video game) can propose a partial reconstruction. The final part of the job is left to an ASP program that first computes a pre-processing task to find coherence between (sides of) fragments, and then tries to reconstruct the original object. Experiments are made here focusing on 2D reconstruction (frescoes, reliefs, etc)
Approximating the Permanent with Fractional Belief Propagation
We discuss schemes for exact and approximate computations of permanents, and
compare them with each other. Specifically, we analyze the Belief Propagation
(BP) approach and its Fractional Belief Propagation (FBP) generalization for
computing the permanent of a non-negative matrix. Known bounds and conjectures
are verified in experiments, and some new theoretical relations, bounds and
conjectures are proposed. The Fractional Free Energy (FFE) functional is
parameterized by a scalar parameter , where
corresponds to the BP limit and corresponds to the exclusion
principle (but ignoring perfect matching constraints) Mean-Field (MF) limit.
FFE shows monotonicity and continuity with respect to . For every
non-negative matrix, we define its special value to be the
for which the minimum of the -parameterized FFE functional is
equal to the permanent of the matrix, where the lower and upper bounds of the
-interval corresponds to respective bounds for the permanent. Our
experimental analysis suggests that the distribution of varies for
different ensembles but always lies within the interval.
Moreover, for all ensembles considered the behavior of is highly
distinctive, offering an emprirical practical guidance for estimating
permanents of non-negative matrices via the FFE approach.Comment: 42 pages, 14 figure
Finding Diverse Trees, Paths, and More
Mathematical modeling is a standard approach to solve many real-world
problems and {\em diversity} of solutions is an important issue, emerging in
applying solutions obtained from mathematical models to real-world problems.
Many studies have been devoted to finding diverse solutions. Baste et al.
(Algorithms 2019, IJCAI 2020) recently initiated the study of computing diverse
solutions of combinatorial problems from the perspective of fixed-parameter
tractability. They considered problems of finding solutions that maximize
some diversity measures (the minimum or sum of the pairwise Hamming distances
among them) and gave some fixed-parameter tractable algorithms for the diverse
version of several well-known problems, such as {\sc Vertex Cover}, {\sc
Feedback Vertex Set}, {\sc -Hitting Set}, and problems on bounded-treewidth
graphs. In this work, we investigate the (fixed-parameter) tractability of
problems of finding diverse spanning trees, paths, and several subgraphs. In
particular, we show that, given a graph and an integer , the problem of
computing spanning trees of maximizing the sum of the pairwise Hamming
distances among them can be solved in polynomial time. To the best of the
authors' knowledge, this is the first polynomial-time solvable case for finding
diverse solutions of unbounded size.Comment: 15 page
- …