792 research outputs found

    Efficient Pattern Matching in Python

    Full text link
    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

    Acta Cybernetica : Volume 18. Number 4.

    Get PDF

    2D object reconstruction with ASP

    Get PDF
    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

    Get PDF
    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 γ∈[−1;1]\gamma\in[-1;1], where γ=−1\gamma=-1 corresponds to the BP limit and γ=1\gamma=1 corresponds to the exclusion principle (but ignoring perfect matching constraints) Mean-Field (MF) limit. FFE shows monotonicity and continuity with respect to γ\gamma. For every non-negative matrix, we define its special value γ∗∈[−1;0]\gamma_*\in[-1;0] to be the γ\gamma for which the minimum of the γ\gamma-parameterized FFE functional is equal to the permanent of the matrix, where the lower and upper bounds of the γ\gamma-interval corresponds to respective bounds for the permanent. Our experimental analysis suggests that the distribution of γ∗\gamma_* varies for different ensembles but γ∗\gamma_* always lies within the [−1;−1/2][-1;-1/2] interval. Moreover, for all ensembles considered the behavior of γ∗\gamma_* 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

    Full text link
    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 rr 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 dd-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 GG and an integer rr, the problem of computing rr spanning trees of GG 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
    • …
    corecore