10 research outputs found

    The complexity of Solitaire

    Get PDF
    AbstractKlondike is the well-known 52-card Solitaire game available on almost every computer. The problem of determining whether an n-card Klondike initial configuration can lead to a win is shown NP-complete. The problem remains NP-complete when only three suits are allowed instead of the usual four. When only two suits of opposite color are available, the problem is shown NL-hard. When the only two suits have the same color, two restrictions are shown in AC0 and in NL respectively. When a single suit is allowed, the problem drops in complexity down to AC0[3], that is, the problem is solvable by a family of constant-depth unbounded-fan-in {and, or, mod3 }-circuits. Other cases are studied: for example, “no King” variant with an arbitrary number of suits of the same color and with an empty “pile” is NL-complete

    Complexity of n-Queens completion (extended abstract)

    Get PDF
    The n-Queens problem is to place n chess queens on an n by n chessboard so that no two queens are on the same row, column or diagonal. The n-Queens Completion problem is a variant, dating to 1850, in which some queens are already placed and the solver is asked to place the rest, if possible. We show that n-Queens Completion is both NP-Complete and #P-Complete. A corollary is that any non-attacking arrangement of queens can be included as a part of a solution to a larger n-Queens problem. We introduce generators of random instances for n-Queens Completion and the closely related Blocked n-Queens and Excluded Diagonals Problem. We describe three solvers for these problems, and empirically analyse the hardness of randomly generated instances. For Blocked n-Queens and the Excluded Diagonals Problem, we show the existence of a phase transition associated with hard instances as has been seen in other NP-Complete problems, but a natural generator for n-Queens Completion did not generate consistently hard instances. The significance of this work is that the n-Queens problem has been very widely used as a benchmark in Artificial Intelligence, but conclusions on it are often disputable because of the simple complexity of the decision problem. Our results give alternative benchmarks which are hard theoretically and empirically, but for which solving techniques designed for n-Queens need minimal or no change

    Complexity of n-Queens Completion

    Get PDF
    The n-Queens problem is to place n chess queens on an n by n chessboard so that no two queens are on the same row, column or diagonal. The n-Queens Completion problem is a variant, dating to 1850, in which some queens are already placed and the solver is asked to place the rest, if possible. We show that n-Queens Completion is both NP-Complete and #P-Complete. A corollary is that any non-attacking arrangement of queens can be included as a part of a solution to a larger n-Queens problem. We introduce generators of random instances for n-Queens Completion and the closely related Blocked n-Queens and Excluded Diagonals Problem. We describe three solvers for these problems, and empirically analyse the hardness of randomly generated instances. For Blocked n-Queens and the Excluded Diagonals Problem, we show the existence of a phase transition associated with hard instances as has been seen in other NP-Complete problems, but a natural generator for n-Queens Completion did not generate consistently hard instances. The significance of this work is that the n-Queens problem has been very widely used as a benchmark in Artificial Intelligence, but conclusions on it are often disputable because of the simple complexity of the decision problem. Our results give alternative benchmarks which are hard theoretically and empirically, but for which solving techniques designed for n-Queens need minimal or no change

    Framework for Composition of Domain Specific Languages and the Effect of Composition on Re-use of Translation Rules

    Get PDF
    DSLs are programming languages that have been designed to be used to solve problems in a specific domain. They provide constructs that are high-level and domain-specific to make it easier to implement solutions in the given domain. They frequently also limit the language to the domain, avoiding general purpose constructs. One of the main reasons for using a DSL is to reduce the amount of work required for implementing new programs. To make the use of DSLs feasible, the cost of developing a new DSL for a domain has to be less than the total amount of cost saved by having the DSL. Thus, reducing the cost of developing new DSLs means that introducing DSLs becomes feasible in more situations. One way of reducing costs is to use composition techniques, where new languages are created from existing ones. This includes defining new language constructs in terms of existing ones, combining the constructs from one or more existing languages, and redefining existing constructs. We present a framework for composing languages on the abstract level and discuss to which degree one can ensure that languages produced by the composition language are valid. In particular, we look at how translation rules for translating from a composed language to a GPL are affected by the composition. That is, to which degree can a language composed from other languages reuse the translation rules of the languages it is composed from. We use a patience game suite as a case-study to show how our composition techniques can be used and demonstrate the short-comings of the techniques. We also show how a tool for composing languages can be created using DSLs produced by composition. The implementations are all in Java
    corecore