G53CLP Constraint Logic Programming

Size: px
Start display at page:

Download "G53CLP Constraint Logic Programming"

Transcription

1 G53CLP Constraint Logic Programming Dr Rong Qu Modeling CSPs Case Study I

2 Constraint Programming... represents one of the closest approaches computer science has yet made to the Holy Grail of programming: the user states the problem, the computer solves it. Eugene C. Freuder of 26

3 Constraint Programming The computer solves it A number of CP software tools available One can use the tools effectively after some training Necessary settings We ve seen foundations of constraint satisfaction Many software tools are based on this theory and algorithms 3 of 26

4 Constraint Programming The user states the problem Not the way we write/code the problem using languages of tools How we model the problem effectively in formulations In practice Model the problem understood by computers Code in specific languages Own codes for specific problems 4 of 26

5 Solving CSP How can we state the problem? Languages of different tools are different Model is the same 5 of 26

6 Solving CSP To improve the efficiency of CP solving Improve the algorithms Specialised domain information Higher level (complex) constraints (alldifferent) Different models for the problem Add redundant constraints More fundamental way Number of variables Number of constraints 6 of 26

7 Solving CSP software tools specific coding integration analyse coding problem model testing 7 of 26

8 Solving CSP... makes stating combinatorial problems easy in terms of a constraint satisfaction problem, however, it is more complicated to design solvable models. Roman Barták of 26

9 Solving CSP Primary role of constraint programmers Model the problem Translating high level constraints in the problem low level constraints supported by CP solvers 9 of 26

10 These Two Lectures Case study on AI puzzle n-queen Some in-class exercises Interactive Questions Discussions You can see the implementation/coding of these models 10 of 26

11 The n-queen Problem Any solution? How many solutions? 11 of 26

12 The n-queen Problem 12 of 26

13 The n-queen Problem Any solution? How many solutions? Some demos 13 of 26

14 The n-queen Problem Some questions How about n is (much) larger? Is the solution you have the only one? Number of solutions for n-queen* n: n: ,680 14,200 73, ,596 2,279,184 from wikipedia 14 of 26

15 The n-queen Problem Why modeling? Large computational time We have large problems We have problems of different sizes We have different problem (but can be modeled the same, see later) 15 of 26

16 The n-queen Problem model 1 Variables x i,j 1, if there is a queen in row i, column j; 0, otherwise Domain x i,j = {0, 1} 16 of 26

17 The n-queen Problem model 1 Constraints 1. One queen each row n j=1 x i,j = 1, i = 1,, n 2. One queen each column n i=1 x i,j = 1, j = 1,, n 17 of 26

18 The n-queen Problem model 1 Constraints 3. One queen diagonally Explicitly record all compatible values between each pair of variables Or Use function to represent the relationship between variables 18 of 26

19 The n-queen Problem model 2 Variables x 1, x 2,, x n : position of queens on the chessboard Domain {0 n 2-1}: tile index of each queen placed 19 of 26

20 The n-queen Problem model 2 Constraint R = x i / n + 1 C = x i mod n + 1 Given R 1, R 2 and C 1, C 2 of two queens positions 1. One queen each row R 1 R 2 2. One queen each column C 1 C 2 20 of 26

21 The n-queen Problem model 2 Constraint R = x i / n + 1 C = x i mod n + 1 Given R 1, R 2 and C 1, C 2 of two queens positions 3. One queen diagonally R 1 R 2 C 1 C 2 R 1 R 2 C 2 C 1 21 of 26

22 The n-queen Problem model 3 Variables x 1, x 2,, x n : rows of the chessboard Domain {1 n}: column index of each queen placed 22 of 26

23 The n-queen Problem model 3 Constraint 1. One queen each column for all i, j = {1,, n}, x i x j 2. One queen diagonally x i - x j i - j & x i - x j j - i 3. One queen each row? Row constraint is in the formulation 23 of 26

24 The n-queen Problem models The search space contains all possible assignments For the above three models module 3: {x 1,, x n }, {1,, n} module 2: {x 1,, x n }, (0,, (n 2 1)} module 1: {x i,j }, {0, 1} model variables domain search space n=4 n = 8 n = 10 n = 20 3 n n n! (or n n ) 24 4 E4 3.6 E6 2.4 E18 2 n n 2 (n 2 ) n 6.6 E4 2.8 E14 1 E E52 1 n (n2 ) 6.6 E E E E of 26

25 The n-queen Problem models Fewer number of variables with small domains of variables are preferable Smaller search space Problems solved more quickly Fewer number of variables with large domains of variables are preferable model variables domain search space n=4 n = 8 n = 10 n = 20 3 n n n! 24 4 E4 3.6 E6 2.4 E18 2 n n 2 (n 2 ) n 6.6 E4 2.8 E14 1 E E52 1 n (n2 ) 6.6 E E E E of 26

26 Summary Modeling in constraint programming Case study on 8-queen problem Comparison on 3 models Model in constraint programming Few number of variables Small domain 26 of 26

Constraint Satisfaction Problems: Formulation

Constraint Satisfaction Problems: Formulation Constraint Satisfaction Problems: Formulation Slides adapted from: 6.0 Tomas Lozano Perez and AIMA Stuart Russell & Peter Norvig Brian C. Williams 6.0- September 9 th, 00 Reading Assignments: Much of the

More information

Spring 06 Assignment 2: Constraint Satisfaction Problems

Spring 06 Assignment 2: Constraint Satisfaction Problems 15-381 Spring 06 Assignment 2: Constraint Satisfaction Problems Questions to Vaibhav Mehta(vaibhav@cs.cmu.edu) Out: 2/07/06 Due: 2/21/06 Name: Andrew ID: Please turn in your answers on this assignment

More information

Spring 06 Assignment 2: Constraint Satisfaction Problems

Spring 06 Assignment 2: Constraint Satisfaction Problems 15-381 Spring 06 Assignment 2: Constraint Satisfaction Problems Questions to Vaibhav Mehta(vaibhav@cs.cmu.edu) Out: 2/07/06 Due: 2/21/06 Name: Andrew ID: Please turn in your answers on this assignment

More information

CS 730/730W/830: Intro AI

CS 730/730W/830: Intro AI CS 730/730W/830: Intro AI 2 handouts: slides, asst 1 solution asst 1 due Wheeler Ruml (UNH) Lecture 6, CS 730 09 1 / 18 EOLQs Wheeler Ruml (UNH) Lecture 6, CS 730 09 2 / 18 Wheeler Ruml (UNH) Lecture 6,

More information

Beyond Prolog: Constraint Logic Programming

Beyond Prolog: Constraint Logic Programming Beyond Prolog: Constraint Logic Programming This lecture will cover: generate and test as a problem solving approach in Prolog introduction to programming with CLP(FD) using constraints to solve a puzzle

More information

Eight Queens Puzzle Solution Using MATLAB EE2013 Project

Eight Queens Puzzle Solution Using MATLAB EE2013 Project Eight Queens Puzzle Solution Using MATLAB EE2013 Project Matric No: U066584J January 20, 2010 1 Introduction Figure 1: One of the Solution for Eight Queens Puzzle The eight queens puzzle is the problem

More information

In the game of Chess a queen can move any number of spaces in any linear direction: horizontally, vertically, or along a diagonal.

In the game of Chess a queen can move any number of spaces in any linear direction: horizontally, vertically, or along a diagonal. CMPS 12A Introduction to Programming Winter 2013 Programming Assignment 5 In this assignment you will write a java program finds all solutions to the n-queens problem, for 1 n 13. Begin by reading the

More information

Solution Algorithm to the Sam Loyd (n 2 1) Puzzle

Solution Algorithm to the Sam Loyd (n 2 1) Puzzle Solution Algorithm to the Sam Loyd (n 2 1) Puzzle Kyle A. Bishop Dustin L. Madsen December 15, 2009 Introduction The Sam Loyd puzzle was a 4 4 grid invented in the 1870 s with numbers 0 through 15 on each

More information

Comp th February Due: 11:59pm, 25th February 2014

Comp th February Due: 11:59pm, 25th February 2014 HomeWork Assignment 2 Comp 590.133 4th February 2014 Due: 11:59pm, 25th February 2014 Getting Started What to submit: Written parts of assignment and descriptions of the programming part of the assignment

More information

CMPS 12A Introduction to Programming Programming Assignment 5 In this assignment you will write a Java program that finds all solutions to the n-queens problem, for. Begin by reading the Wikipedia article

More information

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina Conversion Masters in IT (MIT) AI as Representation and Search (Representation and Search Strategies) Lecture 002 Sandro Spina Physical Symbol System Hypothesis Intelligent Activity is achieved through

More information

More Recursion: NQueens

More Recursion: NQueens More Recursion: NQueens continuation of the recursion topic notes on the NQueens problem an extended example of a recursive solution CISC 121 Summer 2006 Recursion & Backtracking 1 backtracking Recursion

More information

N-Queens Problem. Latin Squares Duncan Prince, Tamara Gomez February

N-Queens Problem. Latin Squares Duncan Prince, Tamara Gomez February N-ueens Problem Latin Squares Duncan Prince, Tamara Gomez February 19 2015 Author: Duncan Prince The N-ueens Problem The N-ueens problem originates from a question relating to chess, The 8-ueens problem

More information

Lecture 2: Problem Formulation

Lecture 2: Problem Formulation 1. Problem Solving What is a problem? Lecture 2: Problem Formulation A goal and a means for achieving the goal The goal specifies the state of affairs we want to bring about The means specifies the operations

More information

Python for Education: The Exact Cover Problem

Python for Education: The Exact Cover Problem Python for Education: The Exact Cover Problem Andrzej Kapanowski Marian Smoluchowski Institute of Physics, Jagiellonian University, Cracow, Poland andrzej.kapanowski@uj.edu.pl Abstract Python implementation

More information

arxiv: v1 [cs.ai] 25 Jul 2012

arxiv: v1 [cs.ai] 25 Jul 2012 To appear in Theory and Practice of Logic Programming 1 Redundant Sudoku Rules arxiv:1207.926v1 [cs.ai] 2 Jul 2012 BART DEMOEN Department of Computer Science, KU Leuven, Belgium bart.demoen@cs.kuleuven.be

More information

Complete and Incomplete Algorithms for the Queen Graph Coloring Problem

Complete and Incomplete Algorithms for the Queen Graph Coloring Problem Complete and Incomplete Algorithms for the Queen Graph Coloring Problem Michel Vasquez and Djamal Habet 1 Abstract. The queen graph coloring problem consists in covering a n n chessboard with n queens,

More information

Writing and debugging programs

Writing and debugging programs Writing and debugging programs Programs should be designed top-down and built bottom-up. Style and presentation are aids to producing correct programs. Once written, programs should be tested analytically.

More information

On the Combination of Constraint Programming and Stochastic Search: The Sudoku Case

On the Combination of Constraint Programming and Stochastic Search: The Sudoku Case On the Combination of Constraint Programming and Stochastic Search: The Sudoku Case Rhydian Lewis Cardiff Business School Pryfysgol Caerdydd/ Cardiff University lewisr@cf.ac.uk Talk Plan Introduction:

More information

Tutorial: Constraint-Based Local Search

Tutorial: Constraint-Based Local Search Tutorial: Pierre Flener ASTRA Research Group on CP Department of Information Technology Uppsala University Sweden CP meets CAV 25 June 212 Outline 1 2 3 4 CP meets CAV - 2 - So Far: Inference + atic Values

More information

1 Introduction. 2 An Easy Start. KenKen. Charlotte Teachers Institute, 2015

1 Introduction. 2 An Easy Start. KenKen. Charlotte Teachers Institute, 2015 1 Introduction R is a puzzle whose solution requires a combination of logic and simple arithmetic and combinatorial skills 1 The puzzles range in difficulty from very simple to incredibly difficult Students

More information

Sudoku 16 X 16: 100 Sudoku Puzzles Volume 2 By David Badger READ ONLINE

Sudoku 16 X 16: 100 Sudoku Puzzles Volume 2 By David Badger READ ONLINE Sudoku 16 X 16: 100 Sudoku Puzzles Volume 2 By David Badger READ ONLINE If you are searching for a ebook Sudoku 16 x 16: 100 Sudoku puzzles Volume 2 by David Badger in pdf format, then you've come to the

More information

Modelling Equidistant Frequency Permutation Arrays: An Application of Constraints to Mathematics

Modelling Equidistant Frequency Permutation Arrays: An Application of Constraints to Mathematics Modelling Equidistant Frequency Permutation Arrays: An Application of Constraints to Mathematics Sophie Huczynska, Paul McKay, Ian Miguel and Peter Nightingale 1 Introduction We used CP to contribute to

More information

CS 188 Fall Introduction to Artificial Intelligence Midterm 1

CS 188 Fall Introduction to Artificial Intelligence Midterm 1 CS 188 Fall 2018 Introduction to Artificial Intelligence Midterm 1 You have 120 minutes. The time will be projected at the front of the room. You may not leave during the last 10 minutes of the exam. Do

More information

A1 Problem Statement Unit Pricing

A1 Problem Statement Unit Pricing A1 Problem Statement Unit Pricing Given up to 10 items (weight in ounces and cost in dollars) determine which one by order (e.g. third) is the cheapest item in terms of cost per ounce. Also output the

More information

10/5/2015. Constraint Satisfaction Problems. Example: Cryptarithmetic. Example: Map-coloring. Example: Map-coloring. Constraint Satisfaction Problems

10/5/2015. Constraint Satisfaction Problems. Example: Cryptarithmetic. Example: Map-coloring. Example: Map-coloring. Constraint Satisfaction Problems 0/5/05 Constraint Satisfaction Problems Constraint Satisfaction Problems AIMA: Chapter 6 A CSP consists of: Finite set of X, X,, X n Nonempty domain of possible values for each variable D, D, D n where

More information

Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing

Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing Informed Search II Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing CIS 521 - Intro to AI - Fall 2017 2 Review: Greedy

More information

ON 4-DIMENSIONAL CUBE AND SUDOKU

ON 4-DIMENSIONAL CUBE AND SUDOKU ON 4-DIMENSIONAL CUBE AND SUDOKU Marián TRENKLER Abstract. The number puzzle SUDOKU (Number Place in the U.S.) has recently gained great popularity. We point out a relationship between SUDOKU and 4- dimensional

More information

A Glimpse of Constraint Satisfaction

A Glimpse of Constraint Satisfaction Journal Artificial Intelligence Review, Kluwer Academic Publishers, Vol., 999, pages - A Glimpse of Constraint Satisfaction EDWARD TSANG Department of Computer Science, University of Essex, Colchester,

More information

Python for education: the exact cover problem

Python for education: the exact cover problem Python for education: the exact cover problem arxiv:1010.5890v1 [cs.ds] 28 Oct 2010 A. Kapanowski Marian Smoluchowski Institute of Physics, Jagellonian University, ulica Reymonta 4, 30-059 Kraków, Poland

More information

Solving Nonograms by combining relaxations

Solving Nonograms by combining relaxations Solving Nonograms by combining relaxations K.J. Batenburg a W.A. Kosters b a Vision Lab, Department of Physics, University of Antwerp Universiteitsplein, B-0 Wilrijk, Belgium joost.batenburg@ua.ac.be b

More information

Automatically Generating Puzzle Problems with Varying Complexity

Automatically Generating Puzzle Problems with Varying Complexity Automatically Generating Puzzle Problems with Varying Complexity Amy Chou and Justin Kaashoek Mentor: Rishabh Singh Fourth Annual PRIMES MIT Conference May 19th, 2014 The Motivation We want to help people

More information

Chapter 5 Backtracking. The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem

Chapter 5 Backtracking. The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem Chapter 5 Backtracking The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem Backtracking maze puzzle following every path in maze until a dead

More information

AUTOMATED REASONING. Agostino Dovier. Udine, November Università di Udine CLPLAB

AUTOMATED REASONING. Agostino Dovier. Udine, November Università di Udine CLPLAB AUTOMATED REASONING Agostino Dovier Università di Udine CLPLAB Udine, November 2016 AGOSTINO DOVIER (CLPLAB) AUTOMATED REASONING UDINE, NOVEMBER 2016 1 / 13 Modeling CSP with ASP AGOSTINO DOVIER (CLPLAB)

More information

CS 188 Introduction to Fall 2014 Artificial Intelligence Midterm

CS 188 Introduction to Fall 2014 Artificial Intelligence Midterm CS 88 Introduction to Fall Artificial Intelligence Midterm INSTRUCTIONS You have 8 minutes. The exam is closed book, closed notes except a one-page crib sheet. Please use non-programmable calculators only.

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 20. Combinatorial Optimization: Introduction and Hill-Climbing Malte Helmert Universität Basel April 8, 2016 Combinatorial Optimization Introduction previous chapters:

More information

Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems

Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems Bahare Fatemi, Seyed Mehran Kazemi, Nazanin Mehrasa International Science Index, Computer and Information Engineering waset.org/publication/9999524

More information

Hybridization of CP and VLNS for Eternity II.

Hybridization of CP and VLNS for Eternity II. Actes JFPC 2008 Hybridization of CP and VLNS for Eternity II. Pierre Schaus Yves Deville Department of Computing Science and Engineering, University of Louvain, Place Sainte Barbe 2, B-1348 Louvain-la-Neuve,

More information

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat Overview The goal of this assignment is to find solutions for the 8-queen puzzle/problem. The goal is to place on a 8x8 chess board

More information

Investigation of Algorithmic Solutions of Sudoku Puzzles

Investigation of Algorithmic Solutions of Sudoku Puzzles Investigation of Algorithmic Solutions of Sudoku Puzzles Investigation of Algorithmic Solutions of Sudoku Puzzles The game of Sudoku as we know it was first developed in the 1979 by a freelance puzzle

More information

Lecture 1, CS 2050, Intro Discrete Math for Computer Science

Lecture 1, CS 2050, Intro Discrete Math for Computer Science Lecture 1, 08--11 CS 050, Intro Discrete Math for Computer Science S n = 1++ 3+... +n =? Note: Recall that for the above sum we can also use the notation S n = n i. We will use a direct argument, in this

More information

Explaining Ourselves: Human-Aware Constraint Reasoning

Explaining Ourselves: Human-Aware Constraint Reasoning Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence (AAAI-17) Explaining Ourselves: Human-Aware Constraint Reasoning Eugene C. Freuder Insight Centre for Data Analytics, School of

More information

SudokuSplashZone. Overview 3

SudokuSplashZone. Overview 3 Overview 3 Introduction 4 Sudoku Game 4 Game grid 4 Cell 5 Row 5 Column 5 Block 5 Rules of Sudoku 5 Entering Values in Cell 5 Solver mode 6 Drag and Drop values in Solver mode 6 Button Inputs 7 Check the

More information

Written examination TIN175/DIT411, Introduction to Artificial Intelligence

Written examination TIN175/DIT411, Introduction to Artificial Intelligence Written examination TIN175/DIT411, Introduction to Artificial Intelligence Question 1 had completely wrong alternatives, and cannot be answered! Therefore, the grade limits was lowered by 1 point! Tuesday

More information

Knights, Knaves, and Logical Reasoning

Knights, Knaves, and Logical Reasoning Knights, Knaves, and Logical Reasoning Mechanising the Laws of Thought Fabio Papacchini 1 8 March 2016 1 Special thanks to Francis Southern F. Papacchini Knights, Knaves, and Logical Reasoning 8 March

More information

Problem of the Month. Miles of Tiles. 5 in. Problem of the Month Miles of Tiles Page 1

Problem of the Month. Miles of Tiles. 5 in. Problem of the Month Miles of Tiles Page 1 Problem of the Month Miles of Tiles Level A: You have a picture frame. You would like to decorate the frame by gluing tiles on it. The frame is a square shape. 14 in The frame is 1 inch wide all around.

More information

Overview. Algorithms: Simon Weber CSC173 Scheme Week 3-4 N-Queens Problem in Scheme

Overview. Algorithms: Simon Weber CSC173 Scheme Week 3-4 N-Queens Problem in Scheme Simon Weber CSC173 Scheme Week 3-4 N-Queens Problem in Scheme Overview The purpose of this assignment was to implement and analyze various algorithms for solving the N-Queens problem. The N-Queens problem

More information

Topspin: Oval-Track Puzzle, Taking Apart The Topspin One Tile At A Time

Topspin: Oval-Track Puzzle, Taking Apart The Topspin One Tile At A Time Salem State University Digital Commons at Salem State University Honors Theses Student Scholarship Fall 2015-01-01 Topspin: Oval-Track Puzzle, Taking Apart The Topspin One Tile At A Time Elizabeth Fitzgerald

More information

2-TONE CODING FORMAT INSTRUCTION MANUAL

2-TONE CODING FORMAT INSTRUCTION MANUAL 2-TONE CODING FORMAT INSTRUCTION MANUAL Prepared by: Donna Tomlinson Version 1 May 17, 2001 CODING Coding is to paging systems what languages are to humans. Coding is the language with which a paging control

More information

Introduction to Spring 2009 Artificial Intelligence Final Exam

Introduction to Spring 2009 Artificial Intelligence Final Exam CS 188 Introduction to Spring 2009 Artificial Intelligence Final Exam INSTRUCTIONS You have 3 hours. The exam is closed book, closed notes except a two-page crib sheet, double-sided. Please use non-programmable

More information

1 Introduction The n-queens problem is a classical combinatorial problem in the AI search area. We are particularly interested in the n-queens problem

1 Introduction The n-queens problem is a classical combinatorial problem in the AI search area. We are particularly interested in the n-queens problem (appeared in SIGART Bulletin, Vol. 1, 3, pp. 7-11, Oct, 1990.) A Polynomial Time Algorithm for the N-Queens Problem 1 Rok Sosic and Jun Gu Department of Computer Science 2 University of Utah Salt Lake

More information

Caching Search States in Permutation Problems

Caching Search States in Permutation Problems Caching Search States in Permutation Problems Barbara M. Smith Cork Constraint Computation Centre, University College Cork, Ireland b.smith@4c.ucc.ie Abstract. When the search for a solution to a constraint

More information

SUDOKU X. Samples Document. by Andrew Stuart. Moderate

SUDOKU X. Samples Document. by Andrew Stuart. Moderate SUDOKU X Moderate Samples Document by Andrew Stuart About Sudoku X This is a variant of the popular Sudoku puzzle which contains two extra constraints on the solution, namely the diagonals, typically indicated

More information

Permutations. = f 1 f = I A

Permutations. = f 1 f = I A Permutations. 1. Definition (Permutation). A permutation of a set A is a bijective function f : A A. The set of all permutations of A is denoted by Perm(A). 2. If A has cardinality n, then Perm(A) has

More information

Overview PROBLEM SOLVING AGENTS. Problem Solving Agents

Overview PROBLEM SOLVING AGENTS. Problem Solving Agents Overview PROBLEM SOLVING AGENTS Aims of the this lecture: introduce problem solving; introduce goal formulation; show how problems can be stated as state space search; show the importance and role of abstraction;

More information

Unit 12: Artificial Intelligence CS 101, Fall 2018

Unit 12: Artificial Intelligence CS 101, Fall 2018 Unit 12: Artificial Intelligence CS 101, Fall 2018 Learning Objectives After completing this unit, you should be able to: Explain the difference between procedural and declarative knowledge. Describe the

More information

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm Weight: 8% Individual Work: All assignments in this course are to be completed individually. Students are advised to read the guidelines

More information

Sudoku Solver Version: 2.5 Due Date: April 5 th 2013

Sudoku Solver Version: 2.5 Due Date: April 5 th 2013 Sudoku Solver Version: 2.5 Due Date: April 5 th 2013 Summary: For this assignment you will be writing a program to solve Sudoku puzzles. You are provided with a makefile, the.h files, and cell.cpp, and

More information

Taking Sudoku Seriously

Taking Sudoku Seriously Taking Sudoku Seriously Laura Taalman, James Madison University You ve seen them played in coffee shops, on planes, and maybe even in the back of the room during class. These days it seems that everyone

More information

The Birds of a Feather Research Challenge. Todd W. Neller Gettysburg College November 9 th, 2017

The Birds of a Feather Research Challenge. Todd W. Neller Gettysburg College November 9 th, 2017 The Birds of a Feather Research Challenge Todd W. Neller Gettysburg College November 9 th, 2017 Outline Backstories: Rook Jumping Mazes Parameterized Poker Squares FreeCell Birds of a Feather Rules 4x4

More information

An efficient algorithm for solving nonograms

An efficient algorithm for solving nonograms Appl Intell (2011) 35:18 31 DOI 10.1007/s10489-009-0200-0 An efficient algorithm for solving nonograms Chiung-Hsueh Yu Hui-Lung Lee Ling-Hwei Chen Published online: 13 November 2009 Springer Science+Business

More information

Two Parity Puzzles Related to Generalized Space-Filling Peano Curve Constructions and Some Beautiful Silk Scarves

Two Parity Puzzles Related to Generalized Space-Filling Peano Curve Constructions and Some Beautiful Silk Scarves Two Parity Puzzles Related to Generalized Space-Filling Peano Curve Constructions and Some Beautiful Silk Scarves http://www.dmck.us Here is a simple puzzle, related not just to the dawn of modern mathematics

More information

A Novel Approach to Solving N-Queens Problem

A Novel Approach to Solving N-Queens Problem A Novel Approach to Solving N-ueens Problem Md. Golam KAOSAR Department of Computer Engineering King Fahd University of Petroleum and Minerals Dhahran, KSA and Mohammad SHORFUZZAMAN and Sayed AHMED Department

More information

Sally s Bedroom. 12 feet. 9 Bedroom C Bedroom D feet. 11 feet. Bedroom F. 11 feet. 1. If you were choosing, which room would you choose? Why?

Sally s Bedroom. 12 feet. 9 Bedroom C Bedroom D feet. 11 feet. Bedroom F. 11 feet. 1. If you were choosing, which room would you choose? Why? Sally s Sally s family is planning to build a new house. Today they are looking at possible designs for Sally s bedroom. So far, they are thinking about the six rooms below. 9 16 12 A 6 B 10. 11 11 9 C

More information

Asymptotic Results for the Queen Packing Problem

Asymptotic Results for the Queen Packing Problem Asymptotic Results for the Queen Packing Problem Daniel M. Kane March 13, 2017 1 Introduction A classic chess problem is that of placing 8 queens on a standard board so that no two attack each other. This

More information

Finding First and Most-Beautiful Queens by Integer Programming

Finding First and Most-Beautiful Queens by Integer Programming Finding First and Most-Beautiful Queens by Integer Programming Matteo Fischetti a,, Domenico Salvagnin a a DEI, University of Padova, Italy Abstract The n-queens puzzle is a well-known combinatorial problem

More information

Activity Sheet #1 Presentation #617, Annin/Aguayo,

Activity Sheet #1 Presentation #617, Annin/Aguayo, Activity Sheet #1 Presentation #617, Annin/Aguayo, Visualizing Patterns: Fibonacci Numbers and 1,000-Pointed Stars n = 5 n = 5 n = 6 n = 6 n = 7 n = 7 n = 8 n = 8 n = 8 n = 8 n = 10 n = 10 n = 10 n = 10

More information

Chapter 4 Heuristics & Local Search

Chapter 4 Heuristics & Local Search CSE 473 Chapter 4 Heuristics & Local Search CSE AI Faculty Recall: Admissable Heuristics f(x) = g(x) + h(x) g: cost so far h: underestimate of remaining costs e.g., h SLD Where do heuristics come from?

More information

Logic Masters India Presents

Logic Masters India Presents Logic Masters India Presents February 12 13, 2011 February 2011 Monthly Sudoku Test INSTRUCTION BOOKLET Submission: http://logicmastersindia.com/m201102s/ This contest deals with Sudoku variants. Each

More information

COMP219: Artificial Intelligence. Lecture 13: Game Playing

COMP219: Artificial Intelligence. Lecture 13: Game Playing CMP219: Artificial Intelligence Lecture 13: Game Playing 1 verview Last time Search with partial/no observations Belief states Incremental belief state search Determinism vs non-determinism Today We will

More information

Chained Permutations. Dylan Heuer. North Dakota State University. July 26, 2018

Chained Permutations. Dylan Heuer. North Dakota State University. July 26, 2018 Chained Permutations Dylan Heuer North Dakota State University July 26, 2018 Three person chessboard Three person chessboard Three person chessboard Three person chessboard - Rearranged Two new families

More information

Grade 6 Math Circles March 7/8, Magic and Latin Squares

Grade 6 Math Circles March 7/8, Magic and Latin Squares Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 6 Math Circles March 7/8, 2017 Magic and Latin Squares Today we will be solving math and logic puzzles!

More information

CS 188: Artificial Intelligence Spring 2007

CS 188: Artificial Intelligence Spring 2007 CS 188: Artificial Intelligence Spring 2007 Lecture 7: CSP-II and Adversarial Search 2/6/2007 Srini Narayanan ICSI and UC Berkeley Many slides over the course adapted from Dan Klein, Stuart Russell or

More information

8. You Won t Want To Play Sudoku Again

8. You Won t Want To Play Sudoku Again 8. You Won t Want To Play Sudoku Again Thanks to modern computers, brawn beats brain. Programming constructs and algorithmic paradigms covered in this puzzle: Global variables. Sets and set operations.

More information

Lecture 6: Latin Squares and the n-queens Problem

Lecture 6: Latin Squares and the n-queens Problem Latin Squares Instructor: Padraic Bartlett Lecture 6: Latin Squares and the n-queens Problem Week 3 Mathcamp 01 In our last lecture, we introduced the idea of a diagonal Latin square to help us study magic

More information

A B O U T T H E S E P U Z Z L E S

A B O U T T H E S E P U Z Z L E S A B O U T T H E S E P U Z Z L E S Suguru, also known as Tectonics, Number Blocks, or (Nanba Burokku), were first created in Japan by prolific puzzle designer Naoki Inaba. While the rules of Suguru are

More information

CMSC 201 Fall 2018 Project 3 Sudoku

CMSC 201 Fall 2018 Project 3 Sudoku CMSC 201 Fall 2018 Project 3 Sudoku Assignment: Project 3 Sudoku Due Date: Design Document: Tuesday, December 4th, 2018 by 8:59:59 PM Project: Tuesday, December 11th, 2018 by 8:59:59 PM Value: 80 points

More information

Griddler Creator. Supervisor: Linda Brackenbury. Temitope Otudeko 04/05

Griddler Creator. Supervisor: Linda Brackenbury. Temitope Otudeko 04/05 Griddler Creator Supervisor: Linda Brackenbury Temitope Otudeko 04/05 TABLE OF CONTENTS Introduction... 3 Griddler puzzle Puzzles... 3 Rules and Techniques for solving griddler puzzles... 3 History of

More information

Local search algorithms

Local search algorithms Local search algorithms Some types of search problems can be formulated in terms of optimization We don t have a start state, don t care about the path to a solution We have an objective function that

More information

Automatic Generation of Constraints for Partial Symmetry Breaking

Automatic Generation of Constraints for Partial Symmetry Breaking Automatic Generation of Constraints for Partial Symmetry Breaking Karen Petrie and Christopher Jefferson Overview How to break symmetries. How to find symmetries. How to choose which symmetries to break.

More information

INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1

INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1 INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1 1 The game of Sudoku Sudoku is a game that is currently quite popular and giving crossword puzzles a run for their money

More information

Game Playing in Prolog

Game Playing in Prolog 1 Introduction CIS335: Logic Programming, Assignment 5 (Assessed) Game Playing in Prolog Geraint A. Wiggins November 11, 2004 This assignment is the last formally assessed course work exercise for students

More information

Cracking the Sudoku: A Deterministic Approach

Cracking the Sudoku: A Deterministic Approach Cracking the Sudoku: A Deterministic Approach David Martin Erica Cross Matt Alexander Youngstown State University Youngstown, OH Advisor: George T. Yates Summary Cracking the Sodoku 381 We formulate a

More information

CS 1571 Introduction to AI Lecture 12. Adversarial search. CS 1571 Intro to AI. Announcements

CS 1571 Introduction to AI Lecture 12. Adversarial search. CS 1571 Intro to AI. Announcements CS 171 Introduction to AI Lecture 1 Adversarial search Milos Hauskrecht milos@cs.pitt.edu 39 Sennott Square Announcements Homework assignment is out Programming and experiments Simulated annealing + Genetic

More information

Computing Explanations for the Unary Resource Constraint

Computing Explanations for the Unary Resource Constraint Computing Explanations for the Unary Resource Constraint Petr Vilím Charles University Faculty of Mathematics and Physics Malostranské náměstí 2/25, Praha 1, Czech Republic vilim@kti.mff.cuni.cz Abstract.

More information

A difficult question until you realize algebra is the way to go. n = Nick, l = Lynne, a = Alf, s=shadi, c=chris

A difficult question until you realize algebra is the way to go. n = Nick, l = Lynne, a = Alf, s=shadi, c=chris Chapter 3 End of Chapter Exercises 1. Nick's computer has three times the memory of Lynne's and Alf's computers put together. Shadi's PC has twice as much memory as Chris's. Nick's computer has one-and-a-half

More information

LESSON 2: THE INCLUSION-EXCLUSION PRINCIPLE

LESSON 2: THE INCLUSION-EXCLUSION PRINCIPLE LESSON 2: THE INCLUSION-EXCLUSION PRINCIPLE The inclusion-exclusion principle (also known as the sieve principle) is an extended version of the rule of the sum. It states that, for two (finite) sets, A

More information

Pennies vs Paperclips

Pennies vs Paperclips Pennies vs Paperclips Today we will take part in a daring game, a clash of copper and steel. Today we play the game: pennies versus paperclips. Battle begins on a 2k by 2m (where k and m are natural numbers)

More information

Swarming the Kingdom: A New Multiagent Systems Approach to N-Queens

Swarming the Kingdom: A New Multiagent Systems Approach to N-Queens Swarming the Kingdom: A New Multiagent Systems Approach to N-Queens Alex Kutsenok 1, Victor Kutsenok 2 Department of Computer Science and Engineering 1, Michigan State University, East Lansing, MI 48825

More information

Adversary Search. Ref: Chapter 5

Adversary Search. Ref: Chapter 5 Adversary Search Ref: Chapter 5 1 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans is possible. Many games can be modeled very easily, although

More information

KenKen Strategies 17+

KenKen Strategies 17+ KenKen is a puzzle whose solution requires a combination of logic and simple arithmetic and combinatorial skills. The puzzles range in difficulty from very simple to incredibly difficult. Students who

More information

CS188: Section Handout 1, Uninformed Search SOLUTIONS

CS188: Section Handout 1, Uninformed Search SOLUTIONS Note that for many problems, multiple answers may be correct. Solutions are provided to give examples of correct solutions, not to indicate that all or possible solutions are wrong. Work on following problems

More information

Lecture 1 What is AI? EECS 348 Intro to Artificial Intelligence Doug Downey

Lecture 1 What is AI? EECS 348 Intro to Artificial Intelligence Doug Downey Lecture 1 What is AI? EECS 348 Intro to Artificial Intelligence Doug Downey Outline 1) What is AI: The Course 2) What is AI: The Field 3) Why to take the class (or not) 4) A Brief History of AI 5) Predict

More information

Announcements. CS 188: Artificial Intelligence Fall Today. Tree-Structured CSPs. Nearly Tree-Structured CSPs. Tree Decompositions*

Announcements. CS 188: Artificial Intelligence Fall Today. Tree-Structured CSPs. Nearly Tree-Structured CSPs. Tree Decompositions* CS 188: Artificial Intelligence Fall 2010 Lecture 6: Adversarial Search 9/1/2010 Announcements Project 1: Due date pushed to 9/15 because of newsgroup / server outages Written 1: up soon, delayed a bit

More information

CMPT 310 Assignment 1

CMPT 310 Assignment 1 CMPT 310 Assignment 1 October 4, 2017 100 points total, worth 10% of the course grade. Turn in on CourSys. Submit a compressed directory (.zip or.tar.gz) with your solutions. Code should be submitted as

More information

AI Plays Yun Nie (yunn), Wenqi Hou (wenqihou), Yicheng An (yicheng)

AI Plays Yun Nie (yunn), Wenqi Hou (wenqihou), Yicheng An (yicheng) AI Plays 2048 Yun Nie (yunn), Wenqi Hou (wenqihou), Yicheng An (yicheng) Abstract The strategy game 2048 gained great popularity quickly. Although it is easy to play, people cannot win the game easily,

More information

Logic Masters India Presents. April 14 16, 2012 April 2012 Monthly Sudoku Test INSTRUCTION BOOKLET

Logic Masters India Presents. April 14 16, 2012 April 2012 Monthly Sudoku Test INSTRUCTION BOOKLET Logic Masters India Presents April 14 16, 2012 April 2012 Monthly Sudoku Test INSTRUCTION BOOKLET Thanks to Tawan Sunathvanichkul (ta mz29) for test solving the puzzles and David Millar for designing the

More information

UMBC 671 Midterm Exam 19 October 2009

UMBC 671 Midterm Exam 19 October 2009 Name: 0 1 2 3 4 5 6 total 0 20 25 30 30 25 20 150 UMBC 671 Midterm Exam 19 October 2009 Write all of your answers on this exam, which is closed book and consists of six problems, summing to 160 points.

More information

Reflections on the N + k Queens Problem

Reflections on the N + k Queens Problem Integre Technical Publishing Co., Inc. College Mathematics Journal 40:3 March 12, 2009 2:02 p.m. chatham.tex page 204 Reflections on the N + k Queens Problem R. Douglas Chatham R. Douglas Chatham (d.chatham@moreheadstate.edu)

More information

UKPA Presents. March 12 13, 2011 INSTRUCTION BOOKLET.

UKPA Presents. March 12 13, 2011 INSTRUCTION BOOKLET. UKPA Presents March 12 13, 2011 INSTRUCTION BOOKLET This contest deals with Sudoku and its variants. The Puzzle types are: No. Puzzle Points 1 ChessDoku 20 2 PanDigital Difference 25 3 Sequence Sudoku

More information