SOLVING LOGIC GRID PUZZLE USING RECURSIVE CONSTRAINT SATISFACTION ALGORITHM

Size: px
Start display at page:

Download "SOLVING LOGIC GRID PUZZLE USING RECURSIVE CONSTRAINT SATISFACTION ALGORITHM"

Transcription

1 47 SOLVING LOGIC GRID PUZZLE USING RECURSIVE CONSTRAINT SATISFACTION ALGORITHM Samuel Lukas*, Arnold Aribowo**, Aristianto* * Informatics Engineering, Computer Science Faculty, Universitas Pelita Harapan ** Computer Engineering, Computer Science Faculty, Universitas Pelita Harapan UPH Tower, Lippo Karawaci, Tangerang, slukas@uph.edu, arnold@uph.edu, dewasoft@dewasoft.com ABSTRACT Logic puzzle is a kind of problem that gives us a set of premises and then we are asked to draw a conclusion using logical deduction or reasoning. Some types of logic puzzles include Knights and Knaves, Sudoku, Nonogram, and logic grid puzzle. If the puzzle is simple and contains only a small number of premises, it can be solved manually in a short time. But if the puzzle is complex and contains many premises we will need a systematic approach. This paper proposes a systematic approach to solve logic grid puzzles. This approach can be used to solve all logic grid puzzles. The puzzle is translated into a specification language which will be processed by the software to generate a solution. To convert the specification into a solution we will use backtracking and recursive function calling. How we specify the puzzle will affect the performance of the program. The aim of this paper is to create a specification language that is easy to understand and flexible enough to accommodate all logic grid puzzles. It does not deal with any optimization issues, complicated syntax checking, etc. More features can be added to the language in the future should the need arise. The name of the specification language is FasyLogic. Keywords : logic puzzle, constraint satisfaction 1 INTRODUCTION Nowadays, the use of computers can be found in all fields. Computers help us to accomplish many things. The technology is developing rapidly, both in hardware and software. This paper will focus on the software. In order to be useful for humans, computers must have a certain level of intelligence ; that is, computers must be able to think like humans. Since their intelligence is created by humans, it is called artificial intelligence. One topic in artificial intelligence is Constraint Satisfaction Problems (CSP). In a CSP, there are variables and constraints, for which each variable has some possible values [1]. The solution to a CSP is the combination of values for each variable where all constraints are satisfied. Some examples of CSP are map coloring problem, linear programming, and logic puzzle. This paper focuses on the latter, because there is a high correlation between logic puzzle and logical deduction, which is very important in computer programming. Logical deduction is very important because computers are machines; they cannot understand human languages. Instructions to computers must be translated to a machine language. This translation requires systematic and logical thinking. To master the art of logical thinking, one must practice a lot. This practice will be more interesting if it is in the form of a game, such as logic puzzle and Sudoku. This paper proposes a specification language, FasyLogic (Fast and Easy Logic), to translate a logic grid puzzle into a program which is then processed by the interpreter to find a solution. By doing this, one can hone his skill in formulating a problem. The solution that is found by the interpreter can be compared to the real solution to verify the correctness of the FasyLogic program. It is assumed that the input program is always valid; that is, it conforms to the grammar of FasyLogic and all elements in the program are unique. Elements are possible values for each variable in the problem. This input program will then be processed by the interpreter to find the solution.

2 48 4 th International Conference Information & Communication Technology and System 2 BASIC THEORIES 2.1 Constraint Satisfaction Algorithm In the field of artificial intelligence, a CSP is defined by a set or variables, X 1, X 2,..., X n, and a set of constraints, C 1, C 2,..., C m. Each variable X i has some possible values for that particular variable. Each constraint C i involves one or more variables and all constraints must be satisfied by the solution [1]. A problem can be solved by enumerating each possible state and testing it against the constraints. A state is a combination of values for each variable in the system, {X i = v i, X j = v j,...}. In other words, each value is assigned to one variable. If this assignment does not contradict the constraints, it is called consistent assignment or legal assignment. When all variables already have values assigned to them and there exists no contradiction, a solution is found. A common strategy to do this enumeration is Depth-First Search (DFS). In DFS, each node in one level will always be expanded first before expanding the next node in the same level. In other words, the process goes for the depth, not the breadth, of the tree. reasoning [2]. One example of logic puzzle is as follows: There are many types of logic puzzle, for example: Knights and Knaves, Sudoku, Nonogram, logic mazes, and logic grid puzzle. This paper will deal with the latter. One example for logic grid puzzle is known as Zebra Puzzle or Einstein s Puzzle [3]. There are some variations of this puzzle, one of which is given below: The Brit lives in the red house. The Swede keeps dogs as pets. The Dane drinks tea. The green house is on the left of the white house. The green house owner drinks coffee. The person who smokes Pall Mall rears birds. The owner of the yellow house smokes Dunhill. The man living in the house right in the center drinks milk. The Norwegian lives in the first house. The man who smokes Blend lives next to the one who keeps cats. The man who keeps horses lives next to the man who smokes Dunhill. The owner who smokes Blue Master drinks beer. The German smokes Prince. The Norwegian lives next to the blue house. The man who smokes Blend has a neighbor who drinks water. It is known that there are five different houses with different colors. The houses are inhabited by five different persons with different drinks, pets, and cigarettes. From the facts, the reader is asked to find out who has fish as his/her pet. Figure 1. Depth-first Search Diagram For the arrangement of nodes in Figure 1, the search will go in this order: A-B-D-F-C-G-E. It means the first possible state is A-B-D, but this is not the solution, so the process backtracks to the previous node. Now the state is A-B-F-, but this is not the solution either, so the process backtracks again. The whole process continues until a solution is found. 2.2 Logic Puzzle Logic puzzle is a kind of problem that gives the reader a set of premises and then he is asked to draw a conclusion using logical deduction or 3 PROBLEM FORMULATION In a logic grid puzzle, there are always m types and each type has n unique elements. Usually there are some statements (constraints) which connect the elements together. It is assumed that all elements are unique. The solution can be formulated using a matrix K = [k ij ] with the order of m x n; for each k pq = k rs then p=r and q=s: k ij where i = 1, 2,, m and j = 1, 2,, n for each k pq = k rs then p=r and q=s All elements must satisfy the given constraints. This concept can be better explained through an example [4]:

3 008 Solving Logic Grid Puzzle Using Recursive Constraint Satisfaction Algorithm Samuel Lukas 49 Last Saturday, all six of the horses in Johnson Stables were rented to children for the day, all of them regulars. Each of the horses (whose names are Boris, Hunter, Lady, Ranger, Santa Fe, and Topper) lives in one of the six stalls, numbered one to six from west to east. The children included three boys (Brian, Curtis, and Roy) and three girls (Lily, Michelle, and Theresa), each a different age (15, 14, 12, 10, 9, 7 years old). Some facts about the horses and the children who rode them that day: 1. Topper lives two or more stalls to the east of Theresa's horse. 2. The nine-year-old's horse lives somewhere to the west of Brian's horse. 3. Three horses in consecutive stalls, from west to east, are Boris, Brian's horse, and the 12-year-old's horse. 4. The child who rode Topper is three years older than the one who rode the horse in stall 4, while Roy is three years older than Michelle. (These are 4 different children). 5. Ranger's rider is three years older than Lily, who in turn is two years older than the girl who rode Lady. 6. Santa Fe lives somewhere to the west of Curtis's horse. 7. Brian is just one year older than Theresa. 8. Roy didn't ride the horse in stall 6. Can you determine each horse's stall number, and the name and age of the child who rode him or her that day? From the above problem, we know there are four types: Index, Kids, Age, and Horse and each type has six unique elements. The solution is a matrix K with the order of 4 x 6: Index k 11 k 12 k 13 k 14 k 15 k 16 Kids k 21 k 22 k 23 k 24 k 25 k 26 Age k 31 k 32 k 33 k 34 k 35 k 36 Horse k 41 k 42 k 43 k 44 k 45 k 46 k 1j is an element of type Index, which values are 1, 2, 3, 4, 5, 6. k 2j is an element of type Kids, which values are brian, curtis, roy, lily, michelle, theresa. k 3j is an element of type Age, which values are 15, 14, 12, 10, 9, 7. K 4j is an element of type Horse, which values are boris, hunter, lady, ranger, santa_fe, topper. The arrangement of all these elements must satisfy all given constraints. There are two kinds of constraints: fixed constraints (Facts) and flexible constraints (Conditions). Fixed constraints define the relation between two elements that are located in the same column and the values of both elements are fixed. Flexible constraints define the relation between elements, either in the same column or not, and the values of these elements may change. In the example above, the fixed constraints are not obvious. There are six different ages: 15, 14, 12, 10, 9, 7. It is known that brian is one year older than theresa (this statement is a flexible constraint, because the exact values are not known). From this, a conclusion can be made that brian is 15 or 10 years old (this statement is a fixed constraint, because the exact values are known). 4 THE FASYLOGIC LANGUAGE A logic grid puzzle can be specified in FasyLogic using three kinds of components: type definition, fixed constraints, and flexible constraints. Each consists of one or more lines in arbitrary order. A line that begins with # is treated as a comment and will not be processed by the interpreter. 4.1 Type Definition This component defines the types and elements that are involved in the program. A type [name] is used to reference an element based on another element [or itself] which is located in the same column. The syntax definition of this component: TYPELINES LINETYPE TYPELINES NEWLINE TYPELINES NEWLINE \n LINETYPE TYPENAME COLON ELEMENTS TYPENAME BIGLETTER BIGLETTER STRINGBIG STRINGBIG STRINGBIGPART STRINGBIG STRINGBIGPART STRINGBIGPART BIGLETTER LETTER DIGIT SPECIAL COLON : ELEMENTS ELEMENT ELEMENTS COMMA ELEMENTS ELEMENT STRING DIGITS MIN DIGITS STRING STRINGPART STRING STRINGPART STRINGPART LETTER DIGIT SPECIAL BIGLETTER A B... Z LETTER a b... z DIGITS DIGIT DIGITS DIGIT DIGIT COMMA, MIN - SPECIAL _ It can be seen from the syntax definition that TYPELINES consists of one or more LINETYPE in arbitrary order, separated by a newline character. For the example stated in section 3, the type definition is: Index: 1, 2, 3, 4, 5, 6 Kids: brian, curtis, roy, lily, michelle,theresa Age: 15, 14, 12, 10, 9, 7 Horse: boris, hunter, lady, ranger, santa_fe, topper It means there are four types: Index, Kids, Age, and Horse. Each has six unique elements (the elements are separated by a comma).

4 50 4 th International Conference Information & Communication Technology and System The type name must begin with an uppercase character and consists of alphanumeric characters and/or underscores. There is a reserved word, Index, which is used to assign values to the partial solution matrix before the interpreter starts finding a solution. All elements with type Index will be inserted into the matrix in the order of their definition. 4.2 Fixed Constraints This component specifies which elements are located in the same column. The syntax definition of this component: FACTLINES LINEFACT FACTLINES NEWLINE FACTLINES NEWLINE \n LINEFACT KNOWNFACT LINEFACT B LINEFACT B KNOWNFACT ELEMENT A ELEMENT A ^ ELEMENT STRING DIGITS MIN DIGITS STRING STRINGPART STRING STRINGPART STRINGPART LETTER DIGIT SPECIAL LETTER a b... z DIGITS DIGIT DIGITS DIGIT DIGIT SPECIAL _ MIN - It can be seen from the syntax definition that FACTLINES consists of one or more LINEFACT in arbitrary order, separated by a newline character. LINEFACT consists of one or more KNOWNFACT that are separated by the OR operator ( ). This concept will be made clear by looking at the following fixed constraints definition for the example in section 3: brian ^ 15 brian ^ 10 theresa ^ 14 theresa ^ 9 topper ^ 15 topper ^ 12 topper ^ 10 ranger ^ 15 ranger ^ 12 4 ^ 12 4 ^ 9 4 ^ 7 lily ^ 12 lily ^ 9 roy ^ 15 roy ^ 12 roy ^ 10 michelle ^ 12 michelle ^ 9 michelle ^ 7 lady ^ 12 lady ^ 10 lady ^ 7 For the first line, it can be said that brian is 15 or 10 years old. The ^ operator is used to combine two elements that are known to be in the same column, while the operator is used to branch the possibility. Likewise, for the last line, there are three possibilities for the age of lady: 12, 10, and Flexible Constraints This component defines the conditions that must be satisfied by the solution. In other words, it specifies all relations that exist between two elements, but the exact elements are not known yet. This relation is defined using a comparison operator and the involved elements are defined using the format ElementName.TypeName. For instance, it is known that roy is three years older than michelle. In this case the older relation can be defined using the type Age. It means roy s age is written as roy.age and michelle s as michelle.age. So the whole statement becomes roy.age == michelle.age + 3. The syntax definition of this component: CONDITIONLINES LINECONDITION CONDITIONLINES NEWLINE CONDITIONLINES NEWLINE \n LINECONDITION CONDITION LINECONDITION C CONDITION CONDITION E O E ( CONDITION ) C & O == < <= > >= E F F A F F ELEMENT ELEMENTTYPE A + - * / % ELEMENT STRING DIGITS MIN DIGITS STRING STRINGPART STRING STRINGPART STRINGPART LETTER DIGIT SPECIAL LETTER a b... z DIGIT DIGITS DIGIT DIGITS DIGIT SPECIAL _ MIN - ELEMENTTYPE ELEMENT DOT TYPENAME TYPENAME BIGLETTER BIGLETTER STRINGBIG STRINGBIG STRINGBIGPART STRINGBIG STRINGBIGPART STRINGBIGPART BIGLETTER LETTER DIGIT SPECIAL BIGLETTER A B... Z DOT. CONDITIONLINES consists of one or more LINECONDITION in arbitrary order, separated by a newline character. LINECONDITION consists of one or more CONDITION that are separated by logical operators (AND and OR). Each CONDITION consists of the left-handside, a comparison operator, and the right-handside. The example in section 3 gives more insight: brian.age == theresa.age + 1 curtis.index > 1 brian.index > 1 topper.index > 2 12.Index > 2 roy.index <> 6 boris.index < 6 topper.index >= theresa.index Index < brian.index & 9.Index < 4 santa_fe.index < curtis.index boris.index == brian.index - 1 & brian.index == 12.Index - 1 topper.age == 4.Age + 3 roy.age == michelle.age + 3 ranger.age == lily.age + 3 & lily.age == lady.age + 2 topper.kids <> roy.kids & 4.Kids <> roy.kids & topper.kids <> michelle.kids & 4.Kids <> michelle.kids lady.kids == lily.kids lady.kids == michelle.kids

5 008 Solving Logic Grid Puzzle Using Recursive Constraint Satisfaction Algorithm Samuel Lukas 51 lady.kids == theresa.kids The first line means brian is one year older than theresa. The second line means curtis horse does not live in the first stall. In all cases, the & is used as an AND operator and the as an OR operator. 5 FINDING THE SOLUTION When processing a FasyLogic program, it is assumed that the input program is always correct (conforms to the language specification and is a representation of the actual problem). If the interpreter encounters an error due to incorrect input, it will display an error message and the user is expected to correct the program. The algorithm to find the solution is rather complex but it can be outlined in the pseudocode below: In line 1, two variables with Stack data type are defined. colfacts is used to hold all fixed constraints and colconditions the flexible constraints. One line in the input program will become one element in colfacts or colconditions. In line 2, two variables with Matrix data type are defined. The Matrix data type is similar to a two-dimensional array. In this case, the size is the same as the size of the solution (number of rows = number of types, number of columns = number of elements for each type). K will be used as the partial solution matrix. E is an array to hold the enumeration of possible values for the empty elements in K values for the empty elements in K i = 1 WHILE(i <= count(e)) insert E[i] into K IF K contradicts with colconditions THEN undo E[i] insertion i = i + 1 ELSE output K end program END-IF END-WHILE n = n + 1 END-WHILE In line 3, two variables with Integer data type are defined. n will be used to count how many combinations of colfacts have been processed ( tried ). i will be used to loop through the enumeration in E. In line 4-5, the fixed and flexible constraints are inserted into colfacts and colconditions, respectively. How the interpreters parses the input program is not shown in the pseudocode because it is not directly related to the process of finding a solution. In line 6, n is initialized to 1 because it is assumed that the index of array starts at 1. n will be used to access the n-th combination of colfacts. Line 7 is the beginning of a WHILE block (line 8-25), which will loop as long as n=1 or there exists any untried combination of colfacts colfacts: Stack, colconditions: Stack K: Matrix, E: array of Matrix i: Integer, n: Integer colfacts = list of fixed constraints colconditions = list of flexible constraints n = 1 WHILE(n == 1 there exists untried colfacts combination) IF colfacts is empty THEN K = empty matrix ELSE K = the n-th valid combination of colfacts END-IF E = enumeration of possible In line 8-12, the value of K is determined based on whether there is a combination of colfacts or not. If colfacts is empty (does not have any elements), K will be initialized with an empty matrix. But, if there exists one or more elements in colfacts (fixed constraints), the n-th combination of colfacts will be assigned to K. What a combination of colfacts means is the possible arrangement of fixed constraints in the matrix. Suppose one fixed constraint is brian ^ 15. There are some possible arrangement for this constraint; it can be placed in the first column, second column, and so on. Combine this with the second constraint, third constraint... There will be some possible combinations of colfacts that must be tried. All elements must be placed as such so there exists no

6 52 4 th International Conference Information & Communication Technology and System duplicates or contradictions with any of the constraints. In line 13, the enumeration of possible values for the empty elements in K are assigned to E. Suppose there are three elements that have not been inserted to the matrix: a, b, and c. In this case, E will have six elements that are the combinations of arrangements for these three elements: [a b c], [a c b], [b a c], [b c a], [c a b], [c b a]. In line 14, i is initialized to 1 because it is assumed that the index of array starts at 1. i will be used to access the i-th element of E. Line 15 is the beginning of a WHILE block (line 16-23), which will loop as long as there exists an element of E that has not been inserted to K In line 16-23, the i-th element of E is inserted into K. If this insertion causes a contradiction with any of the constraints, undo the insertion and try the next element. Otherwise, a solution has been found display K and stop the process. In line 25, n is incremented by one (n = n + 1) to try the next combination of colfacts (if a solution has not been found yet). 6 PERFORMANCE ANALYSIS Some logic grid puzzles are tested and the system can give a correct solution if the user inputs all constrains correctly. In addition, some tests were conducted to measure the performance of the FusyLogic interpreter when finding a solution. First, the order of elements in the type definition is changed. For example: Index: 1, 2, 3, 4, 5, 6 is changed to Index: 6, 5, 4, 3, 2, 1 This kind of change results in arbitrary numbers of matrix duplications required to find the solution. Next, the order of the fixed constraint is changed, for example: michelle ^ 12 michelle ^ 9 michelle ^ 7 is changed to michelle ^ 7 michelle ^ 9 michelle ^ 12 This kind of change also results in arbitrary numbers of matrix duplications. Lastly, two lines in the whole program are switched one at a time. This also results in arbitrary numbers of matrix duplications. It seems there is no way to tell which arrangement will bring optimal performance without knowing the solution beforehand. The more similar the arrangement is to the solution, the better the performance will be. By similar, it means the order of elements in the program matches those in the solution. 7 CONCLUSION A FasyLogic program consists of three kinds of components: type definition, fixed constraints, and flexible constraints. The order of elements and/or lines will affect the performance of the interpreter when finding a solution. When writing a FasyLogic program, one has to specify as many fixed constraints as possible, because this will eliminate needless enumeration of values to fill in the blank elements of the matrix. Albeit simple, the FasyLogic language is sufficient to specify many variants of logic grid puzzles. In the future it should be possible for the elements to be non-unique. REFERENCE [1] S. Russel, P. Norvig, Artificial Intelligence: A Modern Approach, Second Edition, United States of America: Prentice Hall, [2] Logic puzzle 20 November 2006 [3] Zebra Puzzle 20 November 2006 [4] Stablemates Clues tesclues.html 20 November 2006

Material. Thought Question. Outline For Today. Example: Map-Coloring EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Material. Thought Question. Outline For Today. Example: Map-Coloring EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 6, 4/20/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Material Read all of chapter

More information

The Einstein Puzzle. Hints to Einstein Puzzle. Hints to Einstein Puzzle (cont) Specify Einstein Puzzle in SAT. Specify Einstein Puzzle in SAT

The Einstein Puzzle. Hints to Einstein Puzzle. Hints to Einstein Puzzle (cont) Specify Einstein Puzzle in SAT. Specify Einstein Puzzle in SAT The Einstein Puzzle SAT: Propositional Satisfiability 22c:145 Artificial Intelligence Russell & Norvig, Ch. 7.6 Supposedly, Albert Einstein wrote this riddle, and said 98% of the world could not solve

More information

Solving Constraint Satisfaction Problems Using Equivalence Relations. Author: Carl Devore

Solving Constraint Satisfaction Problems Using Equivalence Relations. Author: Carl Devore LogicProblem.mws 31 March 2001 Solving Constraint Satisfaction Problems Using Equivalence Relations Author: Carl Devore If you use this program, please send me email at ,

More information

Constraint Satisfaction Problems (CSP)

Constraint Satisfaction Problems (CSP) Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. 5 1 What we will try to do... Search techniques make choices in an often

More information

Constraint Satisfaction Problems (CSP) (Where we postpone making difficult

Constraint Satisfaction Problems (CSP) (Where we postpone making difficult Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. What we will try to do... Search techniques make choices in an often arbitrary

More information

(Refer Slide Time: 02.06)

(Refer Slide Time: 02.06) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 27 Depth First Search (DFS) Today we are going to be talking

More information

Lecture 1. Introduction

Lecture 1. Introduction Lecture 1 1 Constraint Programming Alternative approach to programming Combination of reasoning and computing Constraint on a sequence of variables: a relation on their domains Constraint Satisfaction

More information

Binary Trees, Constraint Satisfaction Problems, and Depth First Search with Backtracking

Binary Trees, Constraint Satisfaction Problems, and Depth First Search with Backtracking Binary Trees, Constraint Satisfaction Problems, and Depth First Search with Backtracking 1. Binary Trees and Depth-First Search I hope you remember from CSE205 what a basic tree data structure is. There

More information

Constraint Satisfaction Problems: A Deeper Look

Constraint Satisfaction Problems: A Deeper Look Constraint Satisfaction Problems: A Deeper Look The last problem set covered the topic of constraint satisfaction problems. CSP search and solution algorithms are directly applicable to a number of AI

More information

1. (15 points) Consider the crossword puzzle

1. (15 points) Consider the crossword puzzle ICS 271 Fall 2017 Instructor : Kalev Kask Homework Assignment 4 Due Tuesday 11/7 1. (15 points) Consider the crossword puzzle We represent the problem as a CSP where there is a variable for each of the

More information

Objectives. Principles of Constraint Programming Krzysztof R. Apt. Chapter 2 Constraint Satisfaction Problems: Examples. Example: SEND + MORE = MONEY

Objectives. Principles of Constraint Programming Krzysztof R. Apt. Chapter 2 Constraint Satisfaction Problems: Examples. Example: SEND + MORE = MONEY Objectives Principles of Constraint Programming Krzysztof R. pt Chapter 2 Constraint Satisfaction Problems: xamples Define formally Constraint Satisfaction Problems (CSP), Modeling: representation of a

More information

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018 DIT411/TIN175, Artificial Intelligence Chapter 3: Classical search algorithms CHAPTER 3: CLASSICAL SEARCH ALGORITHMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 19 January, 2018 1 DEADLINE FOR

More information

Grade 7 & 8 Math Circles October 6, 2010 Graphs and Transformations

Grade 7 & 8 Math Circles October 6, 2010 Graphs and Transformations Universit of Waterloo Facult of Mathematics entre for Education in Mathematics and omputing Grade 7 & 8 Math ircles October, 00 Graphs and Transformations efinition Transformation: a transformation is

More information

Logic-Oriented Programming (5/11/2004)

Logic-Oriented Programming (5/11/2004) 1 Logic-Oriented Programming (5/11/2004) Daniel P. Friedman, David W. Mack, William E. Byrd Computer Science Department, Indiana University Bloomington, IN 47405, USA Oleg Kiselyov Fleet Numerical Meteorology

More information

Tutorial 2: Validating Documents with DTDs

Tutorial 2: Validating Documents with DTDs 1. One way to create a valid document is to design a document type definition, or DTD, for the document. 2. As shown in the accompanying figure, the external subset would define some basic rules for all

More information

CS W4701 Artificial Intelligence

CS W4701 Artificial Intelligence CS W4701 Artificial Intelligence Fall 2013 Chapter 6: Constraint Satisfaction Problems Jonathan Voris (based on slides by Sal Stolfo) Assignment 3 Go Encircling Game Ancient Chinese game Dates back At

More information

Seach algorithms The travelling salesman problem The Towers of Hanoi Playing games. Comp24412: Symbolic AI. Lecture 4: Search. Ian Pratt-Hartmann

Seach algorithms The travelling salesman problem The Towers of Hanoi Playing games. Comp24412: Symbolic AI. Lecture 4: Search. Ian Pratt-Hartmann Comp24412: Symbolic AI Lecture 4: Search Ian Pratt-Hartmann Room KB2.38: email: ipratt@cs.man.ac.uk 2016 17 Outline Seach algorithms The travelling salesman problem The Towers of Hanoi Playing games Typical

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2013 Soleymani Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition,

More information

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe Constraint Satisfaction Problems slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe Standard search problems: State is a black box : arbitrary data structure Goal test

More information

Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon)

Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon) CS121 Introduction to Artificial Intelligence Winter 2011 Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon) How to complete

More information

An Appropriate Search Algorithm for Finding Grid Resources

An Appropriate Search Algorithm for Finding Grid Resources An Appropriate Search Algorithm for Finding Grid Resources Olusegun O. A. 1, Babatunde A. N. 2, Omotehinwa T. O. 3,Aremu D. R. 4, Balogun B. F. 5 1,4 Department of Computer Science University of Ilorin,

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

Spring 2007 Midterm Exam

Spring 2007 Midterm Exam 15-381 Spring 2007 Midterm Exam Spring 2007 March 8 Name: Andrew ID: This is an open-book, open-notes examination. You have 80 minutes to complete this examination. Unless explicitly requested, we do not

More information

CS 188: Artificial Intelligence Fall 2011

CS 188: Artificial Intelligence Fall 2011 Announcements Project 1: Search is due next week Written 1: Search and CSPs out soon Piazza: check it out if you haven t CS 188: Artificial Intelligence Fall 2011 Lecture 4: Constraint Satisfaction 9/6/2011

More information

UNIT 10 Logic and Venn Diagrams Data Sheets

UNIT 10 Logic and Venn Diagrams Data Sheets NIT 10 Logic and Venn Diagrams Data Sheets Data Sheets 10.1 3 3 Logic Puzzle 10.2 3 3 Logic Puzzle 10.3 4 4 Logic Puzzle 10.4 Two Way Tables 1 10.5 Two Way Tables 2 10.6 Constructing Two Way Tables 10.7

More information

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems What is Search For? Assumptions about the world: a single agent, deterministic actions, fully observed state, discrete state space Planning:

More information

Problem A - EPIC. Line Width of Letters (# characters) EEEEEEEEEE EEEEEEEEEE EE EE EEEEEEEEEE EEEEEEEEEE EE EE EEEEEEEEEE EEEEEEEEEE

Problem A - EPIC. Line Width of Letters (# characters) EEEEEEEEEE EEEEEEEEEE EE EE EEEEEEEEEE EEEEEEEEEE EE EE EEEEEEEEEE EEEEEEEEEE Problem A - EPIC Professor Plum likes the idea of visiting EPIC for MICS 4. He wants you to write a program to generate ASC art printing EPIC vertically for a sign to tape to the back of the van on the

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing search Genetic algorithms Constraint Satisfaction Problems

More information

Announcements. CS 188: Artificial Intelligence Fall 2010

Announcements. CS 188: Artificial Intelligence Fall 2010 Announcements Project 1: Search is due Monday Looking for partners? After class or newsgroup Written 1: Search and CSPs out soon Newsgroup: check it out CS 188: Artificial Intelligence Fall 2010 Lecture

More information

CS 520: Introduction to Artificial Intelligence. Review

CS 520: Introduction to Artificial Intelligence. Review CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 2: state spaces uninformed search 1 What is AI? A set of goals Review build an artificial intelligence useful subgoals A class

More information

Chapter 9: Dealing with Errors

Chapter 9: Dealing with Errors Chapter 9: Dealing with Errors What we will learn: How to identify errors Categorising different types of error How to fix different errors Example of errors What you need to know before: Writing simple

More information

Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017

Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017 Due: Wednesday, October 18, 11:59 pm Collaboration Policy: Level 1 Group Policy: Pair-Optional Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017 In this week s lab, you will write a program that can solve

More information

MIT Programming Contest Team Contest 1 Problems 2008

MIT Programming Contest Team Contest 1 Problems 2008 MIT Programming Contest Team Contest 1 Problems 2008 October 5, 2008 1 Edit distance Given a string, an edit script is a set of instructions to turn it into another string. There are four kinds of instructions

More information

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm Announcements Homework 4 Due tonight at 11:59pm Project 3 Due 3/8 at 4:00pm CS 188: Artificial Intelligence Constraint Satisfaction Problems Instructor: Stuart Russell & Sergey Levine, University of California,

More information

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems. Chapter 6 Constraint Satisfaction Problems Chapter 6 Constraint Satisfaction Problems A constraint satisfaction problem consists of three components, X, D, and C: X is a set of variables, {X 1,..., X n }. D is a

More information

Theory and Compiling COMP360

Theory and Compiling COMP360 Theory and Compiling COMP360 It has been said that man is a rational animal. All my life I have been searching for evidence which could support this. Bertrand Russell Reading Read sections 2.1 3.2 in the

More information

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1 Lecture 18 Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1 Outline Chapter 6 - Constraint Satisfaction Problems Path Consistency & Global Constraints Sudoku Example Backtracking

More information

CSE 473: Artificial Intelligence

CSE 473: Artificial Intelligence CSE 473: Artificial Intelligence Constraint Satisfaction Luke Zettlemoyer Multiple slides adapted from Dan Klein, Stuart Russell or Andrew Moore What is Search For? Models of the world: single agent, deterministic

More information

Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we

Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we have to talk about the way in which we represent the

More information

Today. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 5. Constraint Satisfaction Problems (CSP) CSP Definition

Today. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 5. Constraint Satisfaction Problems (CSP) CSP Definition Today COMP 3501 / COMP 4704-4 Lecture 5 Finish up 2-player games Discuss homework Constraint Satisfaction Problems Prof. JGH 318 Constraint Satisfaction Problems (CSP) CSP s are our first work on factored

More information

Artificial Intelligence (Heuristic Search)

Artificial Intelligence (Heuristic Search) Artificial Intelligence (Heuristic Search) KR Chowdhary, Professor & Head Email: kr.chowdhary@acm.org Department of Computer Science and Engineering MBM Engineering College, Jodhpur kr chowdhary heuristic

More information

Artificial Intelligence Constraint Satisfaction Problems

Artificial Intelligence Constraint Satisfaction Problems Artificial Intelligence Constraint Satisfaction Problems Recall Search problems: Find the sequence of actions that leads to the goal. Sequence of actions means a path in the search space. Paths come with

More information

Search Slide 1/28. Search. Fall Semester. Artificial Intelligence

Search Slide 1/28. Search. Fall Semester. Artificial Intelligence Search Slide 1/28 Search Fall Semester Search Slide 2/28 Topic Outline Statement of the Problem Input Output Examples Graph Traversals Depth-first Recursion Breadth-first FIFO queue Tracing Step-by-Step

More information

CS 4700: Foundations of Artificial Intelligence. Bart Selman. Search Techniques R&N: Chapter 3

CS 4700: Foundations of Artificial Intelligence. Bart Selman. Search Techniques R&N: Chapter 3 CS 4700: Foundations of Artificial Intelligence Bart Selman Search Techniques R&N: Chapter 3 Outline Search: tree search and graph search Uninformed search: very briefly (covered before in other prerequisite

More information

Answer Key Lesson 11: Workshop: Shapes and Properties

Answer Key Lesson 11: Workshop: Shapes and Properties Answer Key esson 11: Use the nine Power Polygons below for Questions 1 and 2. 1. A. Sort the shapes with four sides into ox A. Sort the Shapes with one or more right angles into ox. Some shapes will go

More information

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search This lecture topic (two lectures) Chapter 6.1 6.4, except 6.3.3 Next lecture topic (two lectures) Chapter 7.1 7.5 (Please read

More information

Project activity sheet 3

Project activity sheet 3 1 Macmillan English Project activity sheet 3 Project: Food bar chart Units 13 18 Learning outcomes By the end of the project, children will have: practised language from Units 13 18 through a group project

More information

Patterns, Equations, and Graphs. Two Kites 10 Ribbons. One Kite 5 Ribbons

Patterns, Equations, and Graphs. Two Kites 10 Ribbons. One Kite 5 Ribbons -9 Patterns, Equations, and Graphs Common Core State Standards A-REI.D. Understand that the graph of an equation in two variables is the set of all its solutions plotted in the coordinate plane, often

More information

(Refer Slide Time: 06:01)

(Refer Slide Time: 06:01) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 28 Applications of DFS Today we are going to be talking about

More information

Appendix A: Syntax Diagrams

Appendix A: Syntax Diagrams A. Syntax Diagrams A-1 Appendix A: Syntax Diagrams References: Kathleen Jensen/Niklaus Wirth: PASCAL User Manual and Report, 4th Edition. Springer, 1991. Niklaus Wirth: Compilerbau (in German). Teubner,

More information

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions Dr. Amotz Bar-Noy s Compendium of Algorithms Problems Problems, Hints, and Solutions Chapter 1 Searching and Sorting Problems 1 1.1 Array with One Missing 1.1.1 Problem Let A = A[1],..., A[n] be an array

More information

Chapter 11: Graphs and Trees. March 23, 2008

Chapter 11: Graphs and Trees. March 23, 2008 Chapter 11: Graphs and Trees March 23, 2008 Outline 1 11.1 Graphs: An Introduction 2 11.2 Paths and Circuits 3 11.3 Matrix Representations of Graphs 4 11.5 Trees Graphs: Basic Definitions Informally, a

More information

Parallel Programming. Parallel algorithms Combinatorial Search

Parallel Programming. Parallel algorithms Combinatorial Search Parallel Programming Parallel algorithms Combinatorial Search Some Combinatorial Search Methods Divide and conquer Backtrack search Branch and bound Game tree search (minimax, alpha-beta) 2010@FEUP Parallel

More information

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3)

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3) Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.) Some slides adapted from Richard Lathrop, USC/ISI, CS 7 Review: The Minimax Rule Idea: Make the best move for MAX assuming that MIN always replies

More information

Sudoku-4: Logical Structure

Sudoku-4: Logical Structure Sudoku-4: Logical Structure CSCI 4526 / 6626 Fall 2016 1 Goals To use an STL vector. To use an enumerated type. To learn about tightly coupled classes. To learn about circular dependencies. To use the

More information

Week 8: Constraint Satisfaction Problems

Week 8: Constraint Satisfaction Problems COMP3411/ 9414/ 9814: Artificial Intelligence Week 8: Constraint Satisfaction Problems [Russell & Norvig: 6.1,6.2,6.3,6.4,4.1] COMP3411/9414/9814 18s1 Constraint Satisfaction Problems 1 Outline Constraint

More information

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems Constraint Satisfaction Problems N variables domain D constraints x 1 x 2 Instructor: Marco Alvarez University of Rhode Island (These slides

More information

Bar Graphs and Dot Plots

Bar Graphs and Dot Plots CONDENSED LESSON 1.1 Bar Graphs and Dot Plots In this lesson you will interpret and create a variety of graphs find some summary values for a data set draw conclusions about a data set based on graphs

More information

UNINFORMED SEARCH. Announcements Reading Section 3.4, especially 3.4.1, 3.4.2, 3.4.3, 3.4.5

UNINFORMED SEARCH. Announcements Reading Section 3.4, especially 3.4.1, 3.4.2, 3.4.3, 3.4.5 UNINFORMED SEARCH Announcements Reading Section 3.4, especially 3.4.1, 3.4.2, 3.4.3, 3.4.5 Robbie has no idea where room X is, and may have little choice but to try going down this corridor and that. On

More information

N N Sudoku Solver. Sequential and Parallel Computing

N N Sudoku Solver. Sequential and Parallel Computing N N Sudoku Solver Sequential and Parallel Computing Abdulaziz Aljohani Computer Science. Rochester Institute of Technology, RIT Rochester, United States aaa4020@rit.edu Abstract 'Sudoku' is a logic-based

More information

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic.

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic. CS 188: Artificial Intelligence Spring 2010 Lecture 5: CSPs II 2/2/2010 Pieter Abbeel UC Berkeley Many slides from Dan Klein Announcements Project 1 due Thursday Lecture videos reminder: don t count on

More information

SYSTEM 2000 Essentials

SYSTEM 2000 Essentials 7 CHAPTER 2 SYSTEM 2000 Essentials Introduction 7 SYSTEM 2000 Software 8 SYSTEM 2000 Databases 8 Database Name 9 Labeling Data 9 Grouping Data 10 Establishing Relationships between Schema Records 10 Logical

More information

such a manner that we are able to understand, grasp and grapple with the problem at hand in a more organized fashion.

such a manner that we are able to understand, grasp and grapple with the problem at hand in a more organized fashion. Programming and Data Structure Dr.P.P.Chakraborty Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 32 Conclusions Hello everybody. Today, we come to the

More information

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH Slide 3.1 3 STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH 3.0 Introduction 3.1 Graph Theory 3.2 Strategies for State Space Search 3.3 Using the State Space to Represent Reasoning with the Predicate

More information

Examples of Tasks from Course 1, Unit 4

Examples of Tasks from Course 1, Unit 4 Examples of Tasks from Course 1, Unit 4 What Solutions are Available? Lesson 1: page 258, Modeling Task 1; page 260, Modeling Task 4; page 261, Organizing Task 1; page 271, Modeling Task 2; page 272, Modeling

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Admissible Heuristics Graph Search Consistent Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing

More information

Introduction to Fall 2008 Artificial Intelligence Midterm Exam

Introduction to Fall 2008 Artificial Intelligence Midterm Exam CS 188 Introduction to Fall 2008 Artificial Intelligence Midterm Exam INSTRUCTIONS You have 80 minutes. 70 points total. Don t panic! The exam is closed book, closed notes except a one-page crib sheet,

More information

: Principles of Automated Reasoning and Decision Making Midterm

: Principles of Automated Reasoning and Decision Making Midterm 16.410-13: Principles of Automated Reasoning and Decision Making Midterm October 20 th, 2003 Name E-mail Note: Budget your time wisely. Some parts of this quiz could take you much longer than others. Move

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems In which we see how treating states as more than just little black boxes leads to the invention of a range of powerful new search methods and a deeper understanding of

More information

Compiling Regular Expressions COMP360

Compiling Regular Expressions COMP360 Compiling Regular Expressions COMP360 Logic is the beginning of wisdom, not the end. Leonard Nimoy Compiler s Purpose The compiler converts the program source code into a form that can be executed by the

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. S. Russell and P. Norvig. Artificial Intelligence:

More information

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH Slide 3.1 3 STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH 3.0 Introduction 3.1 Graph Theory 3.2 Strategies for State Space Search 3.3 Using the State Space to Represent Reasoning with the Predicate

More information

Lexical Scanning COMP360

Lexical Scanning COMP360 Lexical Scanning COMP360 Captain, we re being scanned. Spock Reading Read sections 2.1 3.2 in the textbook Regular Expression and FSA Assignment A new assignment has been posted on Blackboard It is due

More information

CS 4100/5100: Foundations of AI

CS 4100/5100: Foundations of AI CS 4100/5100: Foundations of AI Constraint satisfaction problems 1 Instructor: Rob Platt r.platt@neu.edu College of Computer and information Science Northeastern University September 5, 2013 1 These notes

More information

Shuli s Math Problem Solving Column

Shuli s Math Problem Solving Column huli s Math Problem olving Column Volume, Issue March, 009 Edited and uthored by huli ong Colorado prings, Colorado shuli_song@yahoo.com Content. Math Trick: Mental Calculation: aa bc. Math Competition

More information

Graph Theory II. Po-Shen Loh. June edges each. Solution: Spread the n vertices around a circle. Take parallel classes.

Graph Theory II. Po-Shen Loh. June edges each. Solution: Spread the n vertices around a circle. Take parallel classes. Graph Theory II Po-Shen Loh June 009 1 Warm-up 1. Let n be odd. Partition the edge set of K n into n matchings with n 1 edges each. Solution: Spread the n vertices around a circle. Take parallel classes..

More information

Module 4. Constraint satisfaction problems. Version 2 CSE IIT, Kharagpur

Module 4. Constraint satisfaction problems. Version 2 CSE IIT, Kharagpur Module 4 Constraint satisfaction problems Lesson 10 Constraint satisfaction problems - II 4.5 Variable and Value Ordering A search algorithm for constraint satisfaction requires the order in which variables

More information

CS 4100 // artificial intelligence

CS 4100 // artificial intelligence CS 4100 // artificial intelligence instructor: byron wallace Constraint Satisfaction Problems Attribution: many of these slides are modified versions of those distributed with the UC Berkeley CS188 materials

More information

CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2017

CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2017 CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2017 YOUR NAME: YOUR ID: ID TO RIGHT: ROW: SEAT: Please turn off all cell phones now. The exam will begin on the next page. Please, do not turn the page

More information

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set:

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set: Announcements Homework 1: Search Has been released! Due Monday, 2/1, at 11:59pm. On edx online, instant grading, submit as often as you like. Project 1: Search Has been released! Due Friday 2/5 at 5pm.

More information

CS 343: Artificial Intelligence

CS 343: Artificial Intelligence CS 343: Artificial Intelligence Constraint Satisfaction Problems Prof. Scott Niekum The University of Texas at Austin [These slides are based on those of Dan Klein and Pieter Abbeel for CS188 Intro to

More information

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018 DIT411/TIN175, Artificial Intelligence Chapter 7: Constraint satisfaction problems CHAPTER 7: CONSTRAINT SATISFACTION PROBLEMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 30 January, 2018 1 TABLE

More information

Problem solving as Search (summary)

Problem solving as Search (summary) Problem solving as Search (summary) References Russell and Norvig, Artificial Intelligence: A modern approach, 2nd ed. Prentice Hall, 2003 (chapter 3) Nilsson, Artificial intelligence: A New synthesis.

More information

Algorithms: Lecture 10. Chalmers University of Technology

Algorithms: Lecture 10. Chalmers University of Technology Algorithms: Lecture 10 Chalmers University of Technology Today s Topics Basic Definitions Path, Cycle, Tree, Connectivity, etc. Graph Traversal Depth First Search Breadth First Search Testing Bipartatiness

More information

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17 CSE 473: Artificial Intelligence Constraint Satisfaction Dieter Fox What is Search For? Models of the world: single agent, deterministic actions, fully observed state, discrete state space Planning: sequences

More information

flex is not a bad tool to use for doing modest text transformations and for programs that collect statistics on input.

flex is not a bad tool to use for doing modest text transformations and for programs that collect statistics on input. flex is not a bad tool to use for doing modest text transformations and for programs that collect statistics on input. More often than not, though, you ll want to use flex to generate a scanner that divides

More information

Performance Assessment Spring 2001

Performance Assessment Spring 2001 Cover Page of Exam Mathematics Assessment Collaborative Course Grade Two 3 Performance Assessment Spring 2001 District's Student Id # District's Student Id # District's Student Id # (Option: District District's

More information

BORDER PATTERNS, TESSELLATIONS & PROBLEM SOLVING WITH TRANSFORMATIONS

BORDER PATTERNS, TESSELLATIONS & PROBLEM SOLVING WITH TRANSFORMATIONS BORDER PATTERNS, TESSELLATIONS & PROBLEM SOLVING WITH TRANSFORMATIONS Michael de Villiers University of KwaZulu-Natal (On sabbatical Kennesaw State University, USA) This paper will firstly explore some

More information

Problem Solving, Search and Control Strategies

Problem Solving, Search and Control Strategies Problem Solving, Search & Control Strategies : AI Course Lecture 7 14, notes, slides www.myreaders.info/, RC Chakraborty, e-mail rcchak@gmail.com, June 01, 2010 www.myreaders.info/html/artificial_intelligence.html

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #44. Multidimensional Array and pointers

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #44. Multidimensional Array and pointers Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #44 Multidimensional Array and pointers In this video, we will look at the relation between Multi-dimensional

More information

CMPSCI 250: Introduction to Computation. Lecture #24: General Search, DFS, and BFS David Mix Barrington 24 March 2014

CMPSCI 250: Introduction to Computation. Lecture #24: General Search, DFS, and BFS David Mix Barrington 24 March 2014 CMPSCI 250: Introduction to Computation Lecture #24: General Search, DFS, and BFS David Mix Barrington 24 March 2014 General Search, DFS, and BFS Four Examples of Search Problems State Spaces, Search,

More information

State-Space Search. Computer Science E-22 Harvard Extension School David G. Sullivan, Ph.D. Solving Problems by Searching

State-Space Search. Computer Science E-22 Harvard Extension School David G. Sullivan, Ph.D. Solving Problems by Searching State-Space Search Computer Science E- Harvard Extension School David G. Sullivan, Ph.D. Solving Problems by Searching A wide range of problems can be formulated as searches. more precisely, as the process

More information

Artificial Intelligence

Artificial Intelligence Torralba and Wahlster Artificial Intelligence Chapter 8: Constraint Satisfaction Problems, Part I 1/48 Artificial Intelligence 8. CSP, Part I: Basics, and Naïve Search What to Do When Your Problem is to

More information

9c goes Berlinale. Post-Viewing. Viewing Comprehension. Bettan starts to loose interest in wrestling. Fill in the gaps by using these words:

9c goes Berlinale. Post-Viewing. Viewing Comprehension. Bettan starts to loose interest in wrestling. Fill in the gaps by using these words: Viewing Comprehension Tick the correct answers. 1: Tweener The girls Jaana and Bettan (brown hair) seem to be best friends. Bettan starts to loose interest in wrestling. Bettan tries very hard and even

More information

B-Trees. Introduction. Definitions

B-Trees. Introduction. Definitions 1 of 10 B-Trees Introduction A B-tree is a specialized multiway tree designed especially for use on disk. In a B-tree each node may contain a large number of keys. The number of subtrees of each node,

More information

Algorithms and Complexity

Algorithms and Complexity Algorithms and Complexity What is the course about? How to solve problems in an algorithmic way. Three examples: 1. Sorting of numbers Can be solved easily. But it can be solved more efficiently. 2. Shortest

More information

CS 771 Artificial Intelligence. Constraint Satisfaction Problem

CS 771 Artificial Intelligence. Constraint Satisfaction Problem CS 771 Artificial Intelligence Constraint Satisfaction Problem Constraint Satisfaction Problems So far we have seen a problem can be solved by searching in space of states These states can be evaluated

More information

zebra puzzle continued recap Prolog concepts family relations

zebra puzzle continued recap Prolog concepts family relations zebra puzzle continued recap Prolog concepts family relations 1 recapping the Zebra puzzle 2 ****** the facts ****** There are 5 houses, occupied by politicallyincorrect gentlemen of 5 different nationalities,

More information

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid: 1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,

More information

Mathematics Mathematics Applied mathematics Mathematics

Mathematics Mathematics Applied mathematics Mathematics Mathematics Mathematics is the mother of science. It applies the principles of physics and natural sciences for analysis, design, manufacturing and maintenance of systems. Mathematicians seek out patterns

More information