Constraint Satisfaction Problems

Total Page:16

File Type:pdf, Size:1020Kb

Constraint Satisfaction Problems Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl Constraint Satisfaction Problems Introduction Organization Introduction Bernhard Nebel, Julien Hu´e, and Stefan W¨olfl Albert-Ludwigs-Universit¨atFreiburg April 23, 2012 Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl Introduction Constraint Satisfaction Problems Real World Applications Introduction Solving Constraints Contents of the lecture Organization Constraints Constraint What is a constraint? Satisfaction Problems 1 a: the act of constraining b: the state of being checked, Nebel, Hu´e restricted, or compelled to avoid or perform some action . and W¨olfl c: a constraining condition, agency, or force . Introduction Constraint 2 a: repression of one's own feelings, behavior, or actions Satisfaction Problems b: a sense of being constrained . Real World Applications Solving (from Merriam-Webster's Online Dictionary) Constraints Contents of the lecture Usage Organization In programming languages, constraints are often used to restrict the domains of variables. In databases, constraints can be used to specify integrity conditions. In mathematics, a constraint is a requirement on solutions of optimization problems. Examples Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl Examples: Introduction Constraint Satisfaction Latin squares Problems Real World Applications Eight queens problem Solving Constraints Contents of the Sudoku lecture Map coloring problem Organization Boolean satisfiability Latin Square Constraint Satisfaction Problems Problem: Nebel, Hu´e How can one fill an n × n table with n different symbols and W¨olfl . such that each symbol occurs exactly once in each row Introduction Constraint Satisfaction and and each column? Problems Real World Applications Solving 2 3 Constraints 1 2 4 3 Contents of the 21 2 33 lecture 1 2 2 3 1 4 1 2 3 1 6 7 Organization 2 1 4 5 63 4 2 17 3 1 2 4 5 4 1 3 2 There are essentially 56 different Latin squares of size 5, 9408 squares of size 6, 16.942.080 squares of size 7, 535.281.401.856 squares of size 8, . Latin Square Constraint Satisfaction Problems Problem: Nebel, Hu´e How can one fill an n × n table with n different symbols and W¨olfl . such that each symbol occurs exactly once in each row Introduction Constraint Satisfaction and and each column? Problems Real World Applications Solving 2 3 Constraints 1 2 3 4 Contents of the 21 2 33 lecture 1 2 2 3 4 1 1 2 3 1 6 7 Organization 2 1 4 5 63 4 1 27 3 1 2 4 5 4 1 2 3 There are essentially 56 different Latin squares of size 5, 9408 squares of size 6, 16.942.080 squares of size 7, 535.281.401.856 squares of size 8, . Eight Queens Puzzle Constraint Satisfaction Problem: Problems How can one put 8 queens on a standard chess board Nebel, Hu´e (8 × 8-board) and W¨olfl Introduction . such that no queen can attack any other queen? Constraint Satisfaction Problems Real World Applications Solutions: Solving Constraints Contents of the The puzzle has 12 unique solutions (up to rotations and lecture reflections) Organization Old problem proposed in 1848. Various variants knights (instead of queens) 3D n queens on an n × n-board A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0Z0Z0Z Introduction 7 Constraint Z0Z0Z0Z0 Satisfaction Problems 6 Real World 0Z0Z0Z0Z Applications 5 Solving Z0Z0Z0Z0 Constraints Contents of the 4 0Z0Z0Z0Z lecture Organization 3 Z0Z0Z0Z0 2 qZ0Z0Z0Z 1 Z0Z0Z0Z0 a b c d e f g h Figure: A solution of the 8-queens problem A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0Z0Z0Z Introduction 7 Constraint Z0Z0Z0Z0 Satisfaction Problems 6 Real World 0Z0Z0Z0Z Applications 5 Solving Z0Z0Z0Z0 Constraints Contents of the 4 0l0Z0Z0Z lecture Organization 3 Z0Z0Z0Z0 2 qZ0Z0Z0Z 1 Z0Z0Z0Z0 a b c d e f g h Figure: A solution of the 8-queens problem A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0Z0Z0Z Introduction 7 Constraint Z0Z0Z0Z0 Satisfaction Problems 6 Real World 0ZqZ0Z0Z Applications 5 Solving Z0Z0Z0Z0 Constraints Contents of the 4 0l0Z0Z0Z lecture Organization 3 Z0Z0Z0Z0 2 qZ0Z0Z0Z 1 Z0Z0Z0Z0 a b c d e f g h Figure: A solution of the 8-queens problem A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0l0Z0Z Introduction 7 Constraint Z0Z0Z0Z0 Satisfaction Problems 6 Real World 0ZqZ0Z0Z Applications 5 Solving Z0Z0Z0Z0 Constraints Contents of the 4 0l0Z0Z0Z lecture Organization 3 Z0Z0Z0Z0 2 qZ0Z0Z0Z 1 Z0Z0Z0Z0 a b c d e f g h Figure: A solution of the 8-queens problem A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0l0Z0Z Introduction 7 Constraint Z0Z0Z0Z0 Satisfaction Problems 6 Real World 0ZqZ0Z0Z Applications 5 Solving Z0Z0Z0Z0 Constraints Contents of the 4 0l0Z0Z0Z lecture Organization 3 Z0Z0l0Z0 2 qZ0Z0Z0Z 1 Z0Z0Z0Z0 a b c d e f g h Figure: A solution of the 8-queens problem A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0l0Z0Z Introduction 7 Constraint Z0Z0Z0Z0 Satisfaction Problems 6 Real World 0ZqZ0Z0Z Applications 5 Solving Z0Z0Z0Z0 Constraints Contents of the 4 0l0Z0Z0Z lecture Organization 3 Z0Z0l0Z0 2 qZ0Z0Z0Z 1 Z0Z0ZqZ0 a b c d e f g h Figure: A solution of the 8-queens problem A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0l0Z0Z Introduction 7 Constraint Z0Z0Z0l0 Satisfaction Problems 6 Real World 0ZqZ0Z0Z Applications 5 Solving Z0Z0Z0Z0 Constraints Contents of the 4 0l0Z0Z0Z lecture Organization 3 Z0Z0l0Z0 2 qZ0Z0Z0Z 1 Z0Z0ZqZ0 a b c d e f g h Figure: A solution of the 8-queens problem A Solution . Constraint Satisfaction Problems Nebel, Hu´e and W¨olfl 8 0Z0l0Z0Z Introduction 7 Constraint Z0Z0Z0l0 Satisfaction Problems 6 Real World 0ZqZ0Z0Z Applications 5 Solving Z0Z0Z0Zq Constraints Contents of the 4 0l0Z0Z0Z lecture Organization 3 Z0Z0l0Z0 2 qZ0Z0Z0Z 1 Z0Z0ZqZ0 a b c d e f g h Figure: A solution of the 8-queens problem Sudoku Constraint Problem: Satisfaction Problems Fill a partially completed 9 × 9 grid such that Nebel, Hu´e . each row, each column, and each of the nine 3 × 3 and W¨olfl boxes contains the numbers from 1 to 9. Introduction Constraint Satisfaction Problems 2 5 3 9 1 Real World Applications Solving 1 4 Constraints Contents of the 4 7 2 8 lecture Organization 5 2 9 8 1 4 3 3 6 7 2 7 3 9 3 6 4 Sudoku Constraint Problem: Satisfaction Problems Fill a partially completed 9 × 9 grid such that Nebel, Hu´e . each row, each column, and each of the nine 3 × 3 and W¨olfl boxes contains the numbers from 1 to 9. Introduction Constraint Satisfaction Problems 2 5 8 7 3 6 9 4 1 Real World Applications Solving 6 1 9 8 2 4 3 5 7 Constraints Contents of the 4 3 7 9 1 5 2 6 8 lecture Organization 3 9 5 2 7 1 4 8 6 7 6 2 4 9 8 1 3 5 8 4 1 6 5 3 7 2 9 1 8 4 3 6 9 5 7 2 5 7 6 1 4 2 8 9 3 9 2 3 5 8 7 6 1 4 Constraint Satisfaction Problem Constraint Satisfaction Problems Nebel, Hu´e Definition and W¨olfl A constraint network is defined by: Introduction Constraint a finite set of variables Satisfaction Problems Real World a (finite) domain of values for each variable Applications Solving Constraints a finite set of constraints (i.e., binary, ternary, . relations Contents of the defined between the variables) lecture Organization Problem Is there a solution of the network, i.e., an assignment of values to the variables such that all constraints are satisfied? k-Colorability Constraint Satisfaction Problem: Problems Nebel, Hu´e Can one color the nodes of a given graph with k colors and W¨olfl . such that all nodes connected by an edge have Introduction different colors? Constraint Satisfaction Problems Real World Applications Reformulated as a constraint network: Solving Constraints Contents of the Variables: the nodes of the graph lecture Domains: \colors" f1; : : : ; kg for each variable Organization Constraints: nodes connected by an edge must have different values This constraint network has a particular restricted form: only binary constraints domains are finite k-Colorability Constraint Satisfaction Problem: Problems Nebel, Hu´e Can one color the nodes of a given graph with k colors and W¨olfl . such that all nodes connected by an edge have Introduction different colors? Constraint Satisfaction Problems Real World Applications Reformulated as a constraint network: Solving Constraints Contents of the Variables: the nodes of the graph lecture Domains: \colors" f1; : : : ; kg for each variable Organization Constraints: nodes connected by an edge must have different values This constraint network has a particular restricted form: only binary constraints domains are finite k-Colorability Constraint Satisfaction Problem: Problems Nebel, Hu´e Can one color the nodes of a given graph with k colors and W¨olfl . such that all nodes connected by an edge have Introduction different colors? Constraint Satisfaction Problems Real World Applications Reformulated as a constraint network: Solving Constraints Contents of the Variables: the nodes of the graph lecture Domains: \colors" f1; : : : ; kg for each variable Organization Constraints: nodes connected by an edge must have different values This constraint network has a particular restricted form: only binary constraints domains are finite Crossword Puzzle Constraint Problem instance: Satisfaction Problems Variables: empty squares in a crossword puzzle; Nebel, Hu´e Domains: letters fA; B; C; : : : ; Zg for each variable; and W¨olfl Introduction Constraints: relations defined by a given set of words that Constraint Satisfaction need (or are allowed) to occur in the completed puzzle.
Recommended publications
  • Mathematics in Mind
    Mathematics in Mind Series Editor Marcel Danesi, University of Toronto, Canada Editorial Board Louis Kauffman, University of Illinois at Chicago, USA Dragana Martinovic, University of Windsor, Canada Yair Neuman, Ben-Gurion University of the Negev, Israel Rafael Núñez, University of California, San Diego, USA Anna Sfard, University of Haifa, Israel David Tall, University of Warwick, United Kingdom Kumiko Tanaka-Ishii, Kyushu University, Japan Shlomo Vinner, Hebrew University, Israel The monographs and occasional textbooks published in this series tap directly into the kinds of themes, research findings, and general professional activities of the Fields Cognitive Science Network, which brings together mathematicians, philosophers, and cognitive scientists to explore the question of the nature of mathematics and how it is learned from various interdisciplinary angles. The series will cover the following complementary themes and conceptualizations: Connections between mathematical modeling and artificial intelligence research; math cognition and symbolism, annotation, and other semiotic processes; and mathematical discovery and cultural processes, including technological systems that guide the thrust of cognitive and social evolution Mathematics, cognition, and computer science, focusing on the nature of logic and rules in artificial and mental systems The historical context of any topic that involves how mathematical thinking emerged, focusing on archeological and philological evidence Other thematic areas that have implications for the study
    [Show full text]
  • Kruse-Recursion
    Chapter 5 RECURSION 1. Introduction to Recursion (a) Stack Frames (b) Recursion Trees (c) Examples 2. Principles of Recursion 3. Backtracking: Postponing the Work (a) The Eight-Queens Puzzle (b) Review and Refinement (c) Analysis 4. Tree-Structured Programs: Look-Ahead in Games Outline Data Structures and Program Design In C++ Transp. 1, Chapter 5, Recursion 80 1999 Prentice-Hall, Inc., Upper Saddle River, N.J. 07458 Stacks and Trees D D Stack B C CC DDD space for A AAAAAA DDDDD data M MMMMMMMMMMMMMM Time M Start Finish A D B C D D D THEOREM 3.1 During the traversal of any tree, vertices are added to or deleted from the path back to the root in the fashion of a stack. Given any stack, conversely, a tree can be drawn to portray the life history of the stack, as items are pushed onto or popped from it. Stacks and Trees Data Structures and Program Design In C++ Transp. 2, Sect. 5.1, Introduction to Recursion 81 1999 Prentice-Hall, Inc., Upper Saddle River, N.J. 07458 Tree-Diagram Definitions The circles in a tree diagram are called vertices or nodes. The top of the tree is called its root. The vertices immediately below a given vertex are called the children of that vertex. The (unique) vertex immediately above a given vertex is called its parent. (The root is the only vertex in the tree that has no parent.) The line connecting a vertex with one immediately above or below is called a branch. Siblings are vertices with the same parent.
    [Show full text]
  • 8 Queens Puzzle
    8 Queens Puzzle Anna Clancy December 18, 2014 1 The puzzle The puzzle was first published by chess player Max Bezzel in 1848 and the first solution was completed in 1850 by Franz Nuack. [5] To complete the puzzle you have to place 8 queens on an 8 × 8 chessboard so that none of them can attack any of the others in only one move; so that none of them occupy the same row, column or diagonal line as in Figure 1. I intend to find a solution to this puzzle using sage. To represent the squares on the chess board, I have used (x, y) coordinates. Figure 1: An existing queen (blue) and the possible positions for a new queen (green) 2 Conditions on placing new queens For a new queen to be placed on the board: • It must have a different x coordinate to all the existing queens • It must have a different y coordinate to all the existing queens • The difference of the x coordinates of the new queen and every existing one can't equal the difference of their y coordinates The following code creates a function that returns True if it is possible to place a queen in any given square: def possible(x, y): for [a, b] in solution: if y == b: return False if abs(x - a) == abs(y - b): return False return True This piece of code is a slightly altered version of a piece of code from http://www.prasannatech.net/2012/07/eight-queens-python.html [3] 1 3 Finding a solution A solution can be obtained using the following piece of code and the function above: solution = [] tried = [] def solve(x, y=1): if x < 9 and y < 9: if possible(x, y) and [x, y] not in tried: solution.append([x,
    [Show full text]
  • N-Queens — 342 References
    n-Queens | 342 references This paper currently (November 20, 2018) contains 342 references (originally in BIB- TEX format) to articles dealing with or at least touching upon the well-known n-Queens problem. For many papers an abstract written by the authors (143×), a short note (51×), a doi (134×) or a url (76×) is added. How it all began The literature is not totally clear about the exact article in which the n-Queens prob- lem is first stated, but the majority of the votes seems to go to the 1848 Bezzel article \Proposal of the Eight Queens Problem" (title translated from German) in the Berliner Schachzeitung [Bez1848]. From this article on there have been many papers from many countries dealing with this nice and elegant problem. Starting with examining the original 8 × 8 chessboard, the problem was quickly generalized to the n-Queens Problem. Interesting fields of study are: Permutations, Magic Squares, Genetic Algorithms, Neural Networks, Theory of Graphs and of course \doing bigger boards faster". And even today there are still people submitting interesting n-Queens articles: the most recent papers are from 2018. Just added: [Gri2018, JDD+2018, Lur2017]. One Article To Hold Them All The paper \A Survey of Known Results and Research Areas for n-Queens" [BS2009] is a beautiful, rather complete survey of the problem. We thank the authors for the many references they have included in their article. We used them to make, as we hope, this n-Queens reference bibliography even more interesting. Searchable Online Database Using the JabRef software (http://www.jabref.org/), we publish a searchable online version of the bib-file.
    [Show full text]
  • Functions in C++
    2/21/2017 Functions in C++ Declarations vs Definitions Functions Inline Functions Class Member functions Overloaded Functions For : COP 3330. Pointers to functions Object oriented Programming (Using C++) http://www.compgeom.com/~piyush/teach/3330 Recursive functions Piyush Kumar Gcd Example 1071,1029 What you should know? 1029, 42 Calling a function? 42, 21 21, 0 #include <iostream> using std::cout; Defining a function Non-reference parameter. using std::endl; using std::cin; // return the greatest common divisor int gcd(int v1, int v2) int main() { { while (v2) { // get values from standard input int temp = v2; cout << "Enter two values: \n"; Function body Another scope. v2 = v1 % v2; int i, j; is a scope temp is a local variable v1 = temp; cin >> i >> j; } return v1; // call gcd on arguments i and j } // and print their greatest common divisor cout << "gcd: " << gcd(i, j) << endl; function gcd(a, b) return 0; if b = 0 return a } else return gcd(b, a mod b) Function return types Parameter Type-Checking // missing return type gcd(“hello”, “world”); Test(double v1, double v2){ /* … */ } gcd(24312); gcd(42,10,0); int *foo_bar(void){ /* … */ } gcd(3.14, 6.29); // ok? void process ( void ) { /* … */ } // Statically typed int manip(int v1, v2) { /* … */ } // language error int manip(int v1, int v2) { /* … */ } // ok 1 2/21/2017 Pointer Parameters Const parameters #include <iostream> #include <vector> using std::vector; Fcn(const int i) {}… using std::endl; using std::cout; Fcn can read but not write to i. void reset(int *ip) { *ip
    [Show full text]
  • Magic Square - Wikipedia, the Free Encyclopedia
    Magic square - Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Magic_square You can support Wikipedia by making a tax-deductible donation. Magic square From Wikipedia, the free encyclopedia In recreational mathematics, a magic square of order n is an arrangement of n² numbers, usually distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant.[1] A normal magic square contains the integers from 1 to n². The term "magic square" is also sometimes used to refer to any of various types of word square. Normal magic squares exist for all orders n ≥ 1 except n = 2, although the case n = 1 is trivial—it consists of a single cell containing the number 1. The smallest nontrivial case, shown below, is of order 3. The constant sum in every row, column and diagonal is called the magic constant or magic sum, M. The magic constant of a normal magic square depends only on n and has the value For normal magic squares of order n = 3, 4, 5, …, the magic constants are: 15, 34, 65, 111, 175, 260, … (sequence A006003 in OEIS). Contents 1 History of magic squares 1.1 The Lo Shu square (3×3 magic square) 1.2 Cultural significance of magic squares 1.3 Arabia 1.4 India 1.5 Europe 1.6 Albrecht Dürer's magic square 1.7 The Sagrada Família magic square 2 Types of magic squares and their construction 2.1 A method for constructing a magic square of odd order 2.2 A method of constructing a magic square of doubly even order 2.3 The medjig-method of constructing magic squares of even number
    [Show full text]
  • Eight Queens Puzzle  the Interface  Algorithm  Solution Display  Extensions of Eight Queens Problem  Conclusion  Reference the Eight Queens Puzzle
    Review of eight queens puzzle The interface Algorithm Solution display Extensions of eight queens problem Conclusion Reference The eight queens puzzle Is the problem of putting eight chess queens on an 8×8 chessboard such that none of them is able to capture any other using the standard chess queen's moves. The queens must be placed in such a way that no two queens would be able to attack each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general n queens puzzle of placing n queens on an n×n chessboard, where solutions exist only for n = 1 and n ≥ 4. Java Java methods: main routine and subroutine Find help online about java programming Try to interpret existed java codes about eight queens puzzle Make my own program An interface: a chess board with panels and buttons, which handles the mouse clicks, shows instantaneous result. An algorithm “brain” that calculates each movement and solution. Some supportive parts like counting queens numbers, drawing cells, checking occupation and so on. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 1 1 1 0 0 10 1 1 2 1 1 1 01 0 1 1 1 0 0 0 1 0 1 0 1 0 10 0 0 1 0 0 1 0 0 0 1 0 0 0 01 0 0 1 0 0 0 0 Solutions for N queens: N 1 2 3 4 5 6 7 8 9 10 … U 1 0 0 1 2 1 6 12 46 92 … D 1 0 0 2 10 4 40 92 352 724 … For eight queens, if each row is occupied by one queen only, there are 16,777,216 (8*8) possible combinations.
    [Show full text]
  • Python EDA Documentation Release 0.27.4
    Python EDA Documentation Release 0.27.4 Chris Drake March 29, 2015 Contents 1 Contents 3 1.1 Overview.................................................3 1.2 Installing PyEDA.............................................4 1.3 Boolean Algebra.............................................5 1.4 Binary Decision Diagrams........................................ 15 1.5 Boolean Expressions........................................... 25 1.6 Function Arrays............................................. 39 1.7 Two-level Logic Minimization...................................... 50 1.8 Using PyEDA to Solve Sudoku..................................... 54 1.9 All Solutions To The Eight Queens Puzzle............................... 60 1.10 Release Notes.............................................. 62 1.11 Reference................................................. 75 2 Indices and Tables 103 Python Module Index 105 i ii Python EDA Documentation, Release 0.27.4 Release 0.27.4 Date March 29, 2015 PyEDA is a Python library for electronic design automation. Fork PyEDA: https://github.com/cjdrake/pyeda Features: • Symbolic Boolean algebra with a selection of function representations: – Logic expressions – Truth tables, with three output states (0, 1, “don’t care”) – Reduced, ordered binary decision diagrams (ROBDDs) • SAT solvers: – Backtracking – PicoSAT • Espresso logic minimization • Formal equivalence • Multi-dimensional bit vectors • DIMACS CNF/SAT parsers • Logic expression parser Contents 1 Python EDA Documentation, Release 0.27.4 2 Contents CHAPTER 1 Contents 1.1 Overview 1.1.1 What is Electronic Design Eutomation (EDA)? The Intel 4004, the world’s first commercially available microprocessor, was built from approximately 2300 transistors, and had a clock frequency of 740 kilohertz (thousands of cycles per second) 12 . A modern Intel microprocessor can contain over 1.5 billion transistors, and will typically have a clock frequency ranging from two to four gigahertz (billions of cycles per second). In 1971 it took less than one hundred people to manufacture the 4004.
    [Show full text]
  • The Eight Queens Puzzle As an Exercise in Algorithm Design
    The eight queens puzzle as an exercise in algorithm design (Wikipedia.com, N-Queens Problem) Finding all solutions to the eight queens puzzle is a good example of a simple but nontrivial problem. For this reason, it is often used as an example problem for various programming techniques, including nontraditional approaches such as constraint programming, logic programming or genetic algorithms. Most often, it is used as an example of a problem which can be solved with a recursive algorithm, by phrasing the n queens problem inductively in terms of adding a single queen to any solution to the problem of placing n−1 queens on an n-by-n chessboard. The induction bottoms out with the solution to the 'problem' of placing 0 queens on an n-by-n chessboard, which is the empty chessboard. This technique is much more efficient than the naïve brute-force search algorithm, which considers all 648 = 248 = 281,474,976,710,656 possible blind placements of eight queens, and then filters these to remove all placements that place two queens either on the same square (leaving only 64!/56! = 178,462,987,637,760 possible placements) or in mutually attacking positions. This very poor algorithm will, among other things, produce the same results over and over again in all the different permutations of the assignments of the eight queens, as well as repeating the same computations over and over again for the different sub-sets of each solution. A better brute-force algorithm places a single queen on each row, leading to only 88 = 224 = 16,777,216 blind placements.
    [Show full text]
  • Answer Set Programming (Draft)
    Answer Set Programming (Draft) Vladimir Lifschitz University of Texas at Austin April 5, 2019 2 To the community of computer scientists, mathematicians, and philosophers who invented answer set programming and are working hard to make it better \What constitutes the dignity of a craft is that it creates a fellowship, that it binds men together and fashions for them a common language." | Antoine de Saint-Exup´ery 3 Preface Answer set programming is a programming methodology rooted in research on artificial intelligence and computational logic. It was created at the turn of the century, and it is now used in many areas of science and technology. This book is about the art of programming for clingo|one of the most efficient and widely used answer set programming systems available today, and about the mathematics of answer set programming. It is based on an undergraduate class taught at the University of Texas at Austin. The book is self-contained; the only prerequisite is some familiarity with programming and discrete mathematics. Chapter 1 discusses the main ideas of answer set programming and its place in the world of programming languages. Chapter 2 explains, in an informal way, several constructs available in the input language of clingo, and Chapter 3 shows how they can be used to solve a number of computational problems. Chapters 4 and 5 put the discussion of answer set programming on a firm mathematical foundation. Chapter 6 describes a few more programming constructs and gives examples of their use. In Chapter 7, answer set programming is applied to the problem of representing actions and generating plans.
    [Show full text]
  • Multi-Agent Solution for '8 Queens' Puzzle
    Multi-agent Solution for ‘8 Queens’ Puzzle Ivan Babanin1, Ivan Pustovoj1, Elena Kleimenova2, Sergey Kozhevnikov1, Elena Simonova1, Petr Skobelev1 and Alexander Tsarev1 1Software Engineering Company «Smart Solutions», Ltd., Samara, Russia 2Institution of the Russian Academy of Sciences Institute for the Control of Complex Systems of RAS, Samara, Russia Keywords: 8 Queens Problem, Evolutionary Computing, Multi-agent Technology, Strategy of Conflict’s Resolving, Domain Ontologies, Experimental Data. Abstract: The problem of 8 Queens is one of the most well-known combinatorial problems. In this article multi-agent evolutionary-based solution for ‘8 Queens’ problem is proposed. In the multi-agent solution each Queen (or other chess-man) gets a software agent that uses a 'trial-and-error' method in asynchronous and parallel decision making on selecting new position for queens. As the result the solution is found in distributed manner without main control center that provides a number of benefits, for example, introducing new types of chess-man or changing constraints in real time. Two main strategies of Queen’s decision making process has been considered and compared in experiments: random generation of the next move and conflict-solving negotiations between the agents. Experiments’ results show significant acceleration of the decision making process in case of negotiation-based strategy. This solution was developed for training course for students of Computer Science as a methodical basis for designing swarm-based multi-agent systems for solving such complex problems as resource allocation and scheduling, pattern recognition or text understanding. 1 INTRODUCTION communications. In contrast to traditional centralized, monolithic and sequential solutions Multi-agent technology could be reviewed as a new swarm-based approach requires finding right balance generation of object-oriented programming of many conflicting interests of players involved (AgentLink, 2012).
    [Show full text]
  • Modeling the 8-Queens Problem and Sudoku Using an Algorithm Based on Projections Onto Nonconvex Sets
    Modeling the 8-Queens Problem and Sudoku using an Algorithm based on Projections onto Nonconvex Sets by Jason Schaad B.Sc., The University of British Columbia, 2000 M.A., Gonzaga University, 2006 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE in The College of Graduate Studies (Mathematics) THE UNIVERSITY OF BRITISH COLUMBIA (Okanagan) August 2010 c Jason Schaad 2010 Abstract We begin with some basic definitions and concepts from convex analysis and projection onto convex sets (POCS). We next introduce various algorithms for converging to the intersection of convex sets and review various results (Elser's Difference Map is equivalent to the Douglas-Rachford and Fienup's Hybrid Input-Output algorithms which are both equivalent to the Hybrid Projection-Reflection algorithm). Our main contribution is two-fold. First, we show how to model the 8-queens problem and following Elser, we model Sudoku as well. In both cases we use several very nonconvex sets and while the theory for convex sets does not apply, so far the algorithm finds a so- lution. Second, we show that the operator governing the Douglas-Rachford iteration need not be a proximal map even when the two involved resolvents are; this refines an observation of Eckstein. ii Table of Contents Abstract ................................. ii Table of Contents ............................ iii List of Figures ..............................v Acknowledgements ........................... vi 1 Introduction .............................1 2 Background .............................3 2.1 Vector Space . .3 2.2 Subspaces and Convex Sets . .4 2.3 The Inner Product and Inner Product Spaces . .5 2.4 Cauchy Sequences, Completeness and Hilbert spaces .
    [Show full text]