N-queens problem Original problem: How to place 8 queens on an 8x8 chessboard so that no two queens attack each other N-queen problem: Generalization for.

Slides:



Advertisements
Similar presentations
Examples for Discrete Constraint Programming
Advertisements

Symmetry Definitions for Constraint Satisfaction Problems Dave Cohen, Peter Jeavons, Chris Jefferson, Karen Petrie and Barbara Smith.
Constraint Satisfaction Problems Russell and Norvig: Parts of Chapter 5 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
8 Queens. Problem: Placing 8 queens on a chessboard such that they don’t attack each other Three different Prolog programs are suggessted as solutions.
PROLOG 8 QUEENS PROBLEM.
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Exploiting Symmetry in Planning Maria Fox Durham Planning Group University of Durham, UK.
G53CLP Constraint Logic Programming Modeling CSPs – Case Study I Dr Rong Qu.
Section 3 CS182 Intelligent Machines: Reasoning, Actions and Plans.
The N-Queens Problem lab01.
Objectives  Represent systems of equations with matrices  Find dimensions of matrices  Identify square matrices  Identify an identity matrix  Form.
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) February, 3, 2010.
Constraint Satisfaction Problems
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) February, 4, 2009.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
CS420 lecture ten BACKTRACK. Solution vectors In optimization problems, or more general in search problems, a set of choices are to be made to arrive.
Constraint Satisfaction Problems
Benn Fox Hannah Weber Going vertically is called the column. The column is listed first. Going horizontally is called the row. The row is listed.
Determinants. Determinant - a square array of numbers or variables enclosed between parallel vertical bars. **To find a determinant you must have a SQUARE.
Constraint Reasoning Florida Institute of Technology Computer Science.
Lecture 17: Spanning Trees Minimum Spanning Trees.
Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Jim Little UBC CS 322 – CSP 1 September 27, 2014 Textbook §
Lecture 2: General Problem-Solving Methods. Greedy Method Divide-and-Conquer Backtracking Dynamic Programming Graph Traversal Linear Programming Reduction.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Back Tracking Project Due August 11, 1999 N-queens: –A classic puzzle for chess buffs is the N- Queens problem. Simply stated: is it possible to place.
HISTORY The problem was originally proposed in 1848 by the chess player Max Bezzel, and over the years, many mathematicians, including Gauss have worked.
© J. Christopher Beck Lecture 13: Modeling in Constraint Programming.
N Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language.
Contents of Chapter 7 Chapter 7 Backtracking 7.1 The General method
1 N -Queens via Relaxation Labeling Ilana Koreh ( ) Luba Rashkovsky ( )
Data Structures Using C++ 2E1 Recursion and Backtracking: DFS Depth first search (a way to traverse a tree or graph) Backtracking can be regarded as a.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
Please snarf the code for today’s class. Then think about the famous 8-Queen’s Puzzle. The question is: is there a way to arrange 8 queens on a (8x8) chessboard.
Algorithmics - Lecture 131 LECTURE 13: Backtracking.
CSPs Tamara Berg CS Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew.
Nurse scheduling problem 25 nurses ( Team A:13, B:12 ) Experienced nurses and new nurses 3 shifts ( day, evening, night ), meetings, days off Time span.
Hard Problems Some problems are hard to solve.  No polynomial time algorithm is known.  E.g., NP-hard problems such as machine scheduling, bin packing,
1 Constraint Symmetry and Solution Symmetry Presented by Beau M. Christ Symmetry in CSP’s Spring 2010 Presented by Beau M. Christ Symmetry in CSP’s Spring.
Hard Problems Sanghyun Park Fall 2002 CSE, POSTECH.
CP Summer School Modelling for Constraint Programming Barbara Smith 3. Symmetry, Viewpoints.
Unit 3 Vocabulary Amelia N.. Algebraic Expression An expression that contains a variable. Examples: 10/p=2 p+11=20.
Solving BCSP using GA and PBIL Constraint Satisfaction Problem Group Sana Benhamida Andrea Roli Belgasem Ali Problem leader J.V.Hemert Jorge Tavares Group.
© 2006 Pearson Addison-Wesley. All rights reserved 6-1 Chapter 6 Recursion as a Problem- Solving Technique.
N- Queens Solution with Genetic Algorithm By Mohammad A. Ismael.
Chapter 13 Backtracking Introduction The 3-coloring problem
1 Constraint Satisfaction Problems: Formulation, Arc Consistency & Propagation 1 Brian C. Williams October 13 th, 2004 Slides adapted from:
Contents 1 Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem Hyoung rae Kim Debasis Mitra Ph.D Florida Institute.
Fahiem Bacchus, University of Toronto CSC384: Intro to Artificial Intelligence  Backtracking Search (CSPs)  Chapter 5  5.3 talks about local search.
Constraint Propagation Artificial Intelligence CMSC January 22, 2002.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
Two dimensional arrays A two dimensional m x n array A is a collection of m. n elements such that each element is specified by a pair of integers (such.
An Analysis of the n- Queens problem Saleem Karamali.
1 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Backtracking Search I ● Announcements.
Unit – 5: Backtracking For detail discussion, students are advised to refer the class discussion.
Hard Problems Some problems are hard to solve.  No polynomial time algorithm is known.  E.g., NP-hard problems such as machine scheduling, bin packing,
Game Search & Constrained Search CMSC Artificial Intelligence January 18, 2005.
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problem
CS 188: Artificial Intelligence
Eight-QueenS Problem: Fuzzy Constraint Satisfaction Problem Using Soar
פחת ורווח הון סוגיות מיוחדות תהילה ששון עו"ד (רו"ח) ספטמבר 2015
Determinants.
Chapter 3: Finite Constraint Domains
CS Software Studio Assignment 1
© T Madas.
7.4 Slope Objectives: To count slope To use slope formula.
DRILL.
Constraint Satisfaction Problems
Graphing Horizontal and
Matrices and Determinants
Presentation transcript:

N-queens problem Original problem: How to place 8 queens on an 8x8 chessboard so that no two queens attack each other N-queen problem: Generalization for N queens on NxN chessboard

N-queens as a CSP N variables: Q1, …, QN Domain of each variable is {1,2,…, N 2 } (for each possible field) Q1 = 1, Q2 = 15, Q3 = 21, Q4 = 32 Q5 = 34, Q6 = 44, Q7 = 54, Q8 = 59 Representation has 64 8 ( ) possible assignments Problem representation

N-queens as a CSP N variables: Q1, …, QN Domain of each variable is {1,2, …, N} (i-th queen is in i-th column, the domain specifies available rows) Q1 = 1, Q2 = 5, Q3 = 8, Q4 = 6 Q5 = 3, Q6 = 7, Q7 = 2, Q8 = 4 Representation has 8 8 ( ) possible assignments More compact representation

N-queens as a CSP No queen can attack any other queen: Vertically (for the compact representation explicit) Horizontally: Qi ≠ Qj Diagonally: |i-j| ≠|Qi-Qj| Constraints