Beyond Prolog: Constraint Logic Programming

Size: px
Start display at page:

Download "Beyond Prolog: Constraint Logic Programming"

Transcription

1 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 applications of CLP(FD)

2 Solving the puzzle in Prolog (revision) Place the digits 1 to 6 in each row, column and marked shape. How could this puzzle be: represented solved in Prolog? 10 - Beyond Prolog: Constraint Logic Programming 1

3 General technique of search Prolog can be described as using a: generate and test search technique. This means: generate a possible solution to a problem test to see if the possible solution is acceptable Beyond Prolog: Constraint Logic Programming 2

4 Search Beyond Prolog: Constraint Logic Programming 3

5 Search Beyond Prolog: Constraint Logic Programming 4

6 Representation We need to be able to represent that individual squares are instantiated: A1 = 1, B3 = 1, B6 = 3, C3 = 2, D6 = 2, E1 = 3, E2 = 6, F3 = 4, F5 = Beyond Prolog: Constraint Logic Programming 5

7 Generating solutions - 1 In the first version, the program was very short: Step 1: Define the values that can fill a square: candidates([1,2,3,4,5,6]). Step 2: Go through the list of squares and put a candidate number in each square Beyond Prolog: Constraint Logic Programming 6

8 Generating solutions - 2 This is the code that puts all the candidates into the list of squares: % 1 - terminating generate([], _Candidates). % 2 - recursive generate([square Squares], Candidates) :- member(square, Candidates), generate(squares, Candidates) Beyond Prolog: Constraint Logic Programming 7

9 Testing solutions - 1 This involved testing each row, column and group to ensure that they have 6 unique numerical values. First the individual rows/columns/ groups were selected from the representation: % 1 - terminating test([]). % 2 - recursive test([six Sixes]) :- test_six(six), test(sixes) Beyond Prolog: Constraint Logic Programming 8

10 Testing solutions - 2 Then testing each combination of squares to ensure uniqueness: test_six(six(sq1, Sq2, Sq3, Sq4, Sq5, Sq6)) :- Sq1 =\= Sq2, Sq1 =\= Sq3, Sq1 =\= Sq4,, Sq4 =\= Sq6, Sq5 =\= Sq Beyond Prolog: Constraint Logic Programming 9

11 Running the program run :- % pick up the board and candidates board(display_square, square(square), sixes(sixes)), candidates(candidates), % generate a solution generate(square, Candidates), % test the solution test(sixes), % display successful solutions display_square(display_square) Beyond Prolog: Constraint Logic Programming 10

12 Analysing the program This program is correct, but it has to do a lot of work. Why? There are 6 ways of filling the first square, 6 ways of filling the second square,, 6 ways of filling the last square. = 10,314,424,798,490,535,546,171,949,056 possible solutions to be tested (if starting with an empty board) Beyond Prolog: Constraint Logic Programming 11

13 Too large a search space That program could be made more sophisticated. We could introduce heuristics earlier. Heuristic = rule of thumb Usually some insight into the search space that allows us to trim ( prune ) it in some way Beyond Prolog: Constraint Logic Programming 12

14 Too large a search space Ensure that a number has a different value from the squares immediately before it: Beyond Prolog: Constraint Logic Programming 13

15 Too large a search space Ensure each row is OK before filling the next row: But still many alternatives will be generated before being tested Beyond Prolog: Constraint Logic Programming 14

16 Too large a search space It also makes the program more complicated: % 3 - recursive - <6 previous squares generate([square Squares], [Sq1 Rest], Candidates) :- len_list(rest, Len), Len < 5, memb(square, Candidates), Square \== Sq1, generate(squares, [Square, Sq1 Rest], Candidates) Beyond Prolog: Constraint Logic Programming 15

17 Too large a search space This still takes a very long time, but If we assign numbers to the first row, then to the first column, then to the second row, then to the second column the solution is found much faster but still not quick enough Demo Beyond Prolog: Constraint Logic Programming 16

18 Programming with CLP(FD) In Constraint Logic Programming over Finite Domains, variables are constrained to take their values from a finite set. In the puzzle example, the values will be the finite set of integers {1,2,3,4,5,6}. Computation proceeds essentially by removing values from sets that cannot possible be part of the (partial) solution Beyond Prolog: Constraint Logic Programming 17

19 Programming with CLP(FD) This square is constrained to be 2 or 6. This square is constrained to be 1 or Beyond Prolog: Constraint Logic Programming 18

20 Structuring the program Instead of generate and test, we use constrain and generate. The structure is fairly standard: define the domains of the variables impose constraints on the variables generate the solutions by labelling 10 - Beyond Prolog: Constraint Logic Programming 19

21 Defining the board Defining the board is much easier than in the Prolog version: board(square(a1, A2, A3, A4, A5, A6, B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, D1, D2, D3, D4, D5, D6, E1, E2, E3, E4, E5, E6, F1, F2, F3, F4, F5, F6)) :- A1 #= 1,, F5 #= 5, 10 - Beyond Prolog: Constraint Logic Programming 20

22 Defining the domains of the variables We give a set of variables and the lower and upper range of their domain: % rows domain([a1, A2, A3, A4, A5, A6, B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, D1, D2, D3, D4, D5, D6, E1, E2, E3, E4, E5, E6, F1, F2, F3, F4, F5, F6], 1, 6), 10 - Beyond Prolog: Constraint Logic Programming 21

23 Imposing constraints on the variables Here are two alternative ways of imposing constraints: Rows and columns are constrained to have different values: all_different([a1, A2, A3, A4, A5, A6]), all_different([a1, B1, C1, D1, E1, F1]), An alternative way of achieving the same is used for groups: A1 #\= A2, A1 #\= A3, A1 #\= A4, A1 #\= B2, A1 #\= C2, 10 - Beyond Prolog: Constraint Logic Programming 22

24 Generating the solutions by labelling Solutions are generated using labelling : labeling([], [A1, A2, A3, A4, A5, A6]), labeling([], [B1, B2, B3, B4, B5, B6]), labeling([], [C1, C2, C3, C4, C5, C6]), labeling([], [D1, D2, D3, D4, D5, D6]), labeling([], [E1, E2, E3, E4, E5, E6]), labeling([], [F1, F2, F3, F4, F5, F6]). Note: alternatives are generated using backtracking Beyond Prolog: Constraint Logic Programming 23

25 Does this work more effectively than the LP version? Yes run the demo program! 10 - Beyond Prolog: Constraint Logic Programming 24

26 What can CLP(FD) be used for? CLP(FD) is used for: optimization planning layout configuration Examples include: optimizing containers in harbours; planning car production plants; layout of wireless network components university timetabling Beyond Prolog: Constraint Logic Programming 25

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

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

G53CLP Constraint Logic Programming

G53CLP Constraint Logic Programming G53CLP Constraint Logic Programming Dr Rong Qu Modeling CSPs Case Study I Constraint Programming... represents one of the closest approaches computer science has yet made to the Holy Grail of programming:

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

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

Part I At the top level, you will work with partial solutions (referred to as states) and state sets (referred to as State-Sets), where a partial solu

Part I At the top level, you will work with partial solutions (referred to as states) and state sets (referred to as State-Sets), where a partial solu Project: Part-2 Revised Edition Due 9:30am (sections 10, 11) 11:001m (sections 12, 13) Monday, May 16, 2005 150 points Part-2 of the project consists of both a high-level heuristic game-playing program

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

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

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

COMP9414: Artificial Intelligence Problem Solving and Search

COMP9414: Artificial Intelligence Problem Solving and Search CMP944, Monday March, 0 Problem Solving and Search CMP944: Artificial Intelligence Problem Solving and Search Motivating Example You are in Romania on holiday, in Arad, and need to get to Bucharest. What

More information

UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010

UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010 UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010 Question Points 1 Environments /2 2 Python /18 3 Local and Heuristic Search /35 4 Adversarial Search /20 5 Constraint Satisfaction

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

CS61B Lecture #33. Today: Backtracking searches, game trees (DSIJ, Section 6.5)

CS61B Lecture #33. Today: Backtracking searches, game trees (DSIJ, Section 6.5) CS61B Lecture #33 Today: Backtracking searches, game trees (DSIJ, Section 6.5) Coming Up: Concurrency and synchronization(data Structures, Chapter 10, and Assorted Materials On Java, Chapter 6; Graph Structures:

More information

MAS336 Computational Problem Solving. Problem 3: Eight Queens

MAS336 Computational Problem Solving. Problem 3: Eight Queens MAS336 Computational Problem Solving Problem 3: Eight Queens Introduction Francis J. Wright, 2007 Topics: arrays, recursion, plotting, symmetry The problem is to find all the distinct ways of choosing

More information

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1 CS61B Lecture #22 Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55:07 2016 CS61B: Lecture #22 1 Searching by Generate and Test We vebeenconsideringtheproblemofsearchingasetofdatastored

More information

Kenken For Teachers. Tom Davis January 8, Abstract

Kenken For Teachers. Tom Davis   January 8, Abstract Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles January 8, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic

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

Section Marks Agents / 8. Search / 10. Games / 13. Logic / 15. Total / 46

Section Marks Agents / 8. Search / 10. Games / 13. Logic / 15. Total / 46 Name: CS 331 Midterm Spring 2017 You have 50 minutes to complete this midterm. You are only allowed to use your textbook, your notes, your assignments and solutions to those assignments during this midterm.

More information

1 Introduction. 1.1 Game play. CSC 261 Lab 4: Adversarial Search Fall Assigned: Tuesday 24 September 2013

1 Introduction. 1.1 Game play. CSC 261 Lab 4: Adversarial Search Fall Assigned: Tuesday 24 September 2013 CSC 261 Lab 4: Adversarial Search Fall 2013 Assigned: Tuesday 24 September 2013 Due: Monday 30 September 2011, 11:59 p.m. Objectives: Understand adversarial search implementations Explore performance implications

More information

Constraint Programming and Genetic Algorithms to Solve Layout Design Problem

Constraint Programming and Genetic Algorithms to Solve Layout Design Problem Proceedings of the 6th WSEAS Int. Conf. on EVOLUTIONARY COMPUTING, Lisbon, Portugal, June 6-, 200 (pp2-29) Constraint Programming and Genetic Algorithms to Solve Layout Design Problem JOSÉ TAVARES GECAD

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

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

Algorithmique appliquée Projet UNO

Algorithmique appliquée Projet UNO Algorithmique appliquée Projet UNO Paul Dorbec, Cyril Gavoille The aim of this project is to encode a program as efficient as possible to find the best sequence of cards that can be played by a single

More information

Adverserial Search Chapter 5 minmax algorithm alpha-beta pruning TDDC17. Problems. Why Board Games?

Adverserial Search Chapter 5 minmax algorithm alpha-beta pruning TDDC17. Problems. Why Board Games? TDDC17 Seminar 4 Adversarial Search Constraint Satisfaction Problems Adverserial Search Chapter 5 minmax algorithm alpha-beta pruning 1 Why Board Games? 2 Problems Board games are one of the oldest branches

More information

Lecture 20: Combinatorial Search (1997) Steven Skiena. skiena

Lecture 20: Combinatorial Search (1997) Steven Skiena.   skiena Lecture 20: Combinatorial Search (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Give an O(n lg k)-time algorithm

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

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search COMP19: Artificial Intelligence COMP19: Artificial Intelligence Dr. Annabel Latham Room.05 Ashton Building Department of Computer Science University of Liverpool Lecture 1: Game Playing 1 Overview Last

More information

COMP5211 Lecture 3: Agents that Search

COMP5211 Lecture 3: Agents that Search CMP5211 Lecture 3: Agents that Search Fangzhen Lin Department of Computer Science and Engineering Hong Kong University of Science and Technology Fangzhen Lin (HKUST) Lecture 3: Search 1 / 66 verview Search

More information

Yet Another Organized Move towards Solving Sudoku Puzzle

Yet Another Organized Move towards Solving Sudoku Puzzle !" ##"$%%# &'''( ISSN No. 0976-5697 Yet Another Organized Move towards Solving Sudoku Puzzle Arnab K. Maji* Department Of Information Technology North Eastern Hill University Shillong 793 022, Meghalaya,

More information

Problem C The Stern-Brocot Number System Input: standard input Output: standard output

Problem C The Stern-Brocot Number System Input: standard input Output: standard output Problem C The Stern-Brocot Number System Input: standard input Output: standard output The Stern-Brocot tree is a beautiful way for constructing the set of all nonnegative fractions m / n where m and n

More information

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2007 Task Scheduling Slide 1

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2007 Task Scheduling Slide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering May 00 Task Scheduling Slide About This Presentation This presentation belongs to the lecture series

More information

isudoku Computing Solutions to Sudoku Puzzles w/ 3 Algorithms by: Gavin Hillebrand Jamie Sparrow Jonathon Makepeace Matthew Harris

isudoku Computing Solutions to Sudoku Puzzles w/ 3 Algorithms by: Gavin Hillebrand Jamie Sparrow Jonathon Makepeace Matthew Harris isudoku Computing Solutions to Sudoku Puzzles w/ 3 Algorithms by: Gavin Hillebrand Jamie Sparrow Jonathon Makepeace Matthew Harris What is Sudoku? A logic-based puzzle game Heavily based in combinatorics

More information

Instability of Scoring Heuristic In games with value exchange, the heuristics are very bumpy Make smoothing assumptions search for "quiesence"

Instability of Scoring Heuristic In games with value exchange, the heuristics are very bumpy Make smoothing assumptions search for quiesence More on games Gaming Complications Instability of Scoring Heuristic In games with value exchange, the heuristics are very bumpy Make smoothing assumptions search for "quiesence" The Horizon Effect No matter

More information

ISudoku. Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand

ISudoku. Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand ISudoku Abstract In this paper, we will analyze and discuss the Sudoku puzzle and implement different algorithms to solve the puzzle. After

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

game tree complete all possible moves

game tree complete all possible moves Game Trees Game Tree A game tree is a tree the nodes of which are positions in a game and edges are moves. The complete game tree for a game is the game tree starting at the initial position and containing

More information

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2016 Task Scheduling Slide 1

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2016 Task Scheduling Slide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering May 0 Task Scheduling Slide About This Presentation This presentation belongs to the lecture series

More information

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing COMP10: Artificial Intelligence Lecture 10. Game playing Trevor Bench-Capon Room 15, Ashton Building Today We will look at how search can be applied to playing games Types of Games Perfect play minimax

More information

Microsoft Excel Math Formula Guide

Microsoft Excel Math Formula Guide Microsoft Excel is a spreadsheet software that is used to organize and calculate data. This handout will focus on how to use built-in Excel functions to solve basic mathematical calculations. Basics of

More information

EARIN Jarosław Arabas Room #223, Electronics Bldg.

EARIN   Jarosław Arabas Room #223, Electronics Bldg. EARIN http://elektron.elka.pw.edu.pl/~jarabas/earin.html Jarosław Arabas jarabas@elka.pw.edu.pl Room #223, Electronics Bldg. Paweł Cichosz pcichosz@elka.pw.edu.pl Room #215, Electronics Bldg. EARIN Jarosław

More information

How hard are computer games? Graham Cormode, DIMACS

How hard are computer games? Graham Cormode, DIMACS How hard are computer games? Graham Cormode, DIMACS graham@dimacs.rutgers.edu 1 Introduction Computer scientists have been playing computer games for a long time Think of a game as a sequence of Levels,

More information

Solving Sudoku Using Artificial Intelligence

Solving Sudoku Using Artificial Intelligence Solving Sudoku Using Artificial Intelligence Eric Pass BitBucket: https://bitbucket.org/ecp89/aipracticumproject Demo: https://youtu.be/-7mv2_ulsas Background Overview Sudoku problems are some of the most

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

An improved strategy for solving Sudoku by sparse optimization methods

An improved strategy for solving Sudoku by sparse optimization methods An improved strategy for solving Sudoku by sparse optimization methods Yuchao Tang, Zhenggang Wu 2, Chuanxi Zhu. Department of Mathematics, Nanchang University, Nanchang 33003, P.R. China 2. School of

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

BCD Adder. Lecture 21 1

BCD Adder. Lecture 21 1 BCD Adder -BCD adder A 4-bit binary adder that is capable of adding two 4-bit words having a BCD (binary-coded decimal) format. The result of the addition is a BCD-format 4-bit output word, representing

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

Artificial Intelligence Lecture 3

Artificial Intelligence Lecture 3 Artificial Intelligence Lecture 3 The problem Depth first Not optimal Uses O(n) space Optimal Uses O(B n ) space Can we combine the advantages of both approaches? 2 Iterative deepening (IDA) Let M be a

More information

Games and Adversarial Search II

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

More information

CPSC 217 Assignment 3

CPSC 217 Assignment 3 CPSC 217 Assignment 3 Due: Friday November 24, 2017 at 11:55pm Weight: 7% Sample Solution Length: Less than 100 lines, including blank lines and some comments (not including the provided code) Individual

More information

General Game Playing (GGP) Winter term 2013/ Summary

General Game Playing (GGP) Winter term 2013/ Summary General Game Playing (GGP) Winter term 2013/2014 10. Summary Sebastian Wandelt WBI, Humboldt-Universität zu Berlin General Game Playing? General Game Players are systems able to understand formal descriptions

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

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

NCSS Statistical Software

NCSS Statistical Software Chapter 147 Introduction A mosaic plot is a graphical display of the cell frequencies of a contingency table in which the area of boxes of the plot are proportional to the cell frequencies of the contingency

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

Senior Math Circles February 10, 2010 Game Theory II

Senior Math Circles February 10, 2010 Game Theory II 1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Senior Math Circles February 10, 2010 Game Theory II Take-Away Games Last Wednesday, you looked at take-away

More information

QUICKSTART COURSE - MODULE 7 PART 3

QUICKSTART COURSE - MODULE 7 PART 3 QUICKSTART COURSE - MODULE 7 PART 3 copyright 2011 by Eric Bobrow, all rights reserved For more information about the QuickStart Course, visit http://www.acbestpractices.com/quickstart Hello, this is Eric

More information

CSE 260 Digital Computers: Organization and Logical Design. Lab 4. Jon Turner Due 3/27/2012

CSE 260 Digital Computers: Organization and Logical Design. Lab 4. Jon Turner Due 3/27/2012 CSE 260 Digital Computers: Organization and Logical Design Lab 4 Jon Turner Due 3/27/2012 Recall and follow the General notes from lab1. In this lab, you will be designing a circuit that implements the

More information

1. Open the Feature Modeling demo part file on the EEIC website. Ask student about which constraints needed to Fully Define.

1. Open the Feature Modeling demo part file on the EEIC website. Ask student about which constraints needed to Fully Define. BLUE boxed notes are intended as aids to the lecturer RED boxed notes are comments that the lecturer could make Control + Click HERE to view enlarged IMAGE and Construction Strategy he following set of

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

Model-Based Testing. CSCE Lecture 18-03/29/2018

Model-Based Testing. CSCE Lecture 18-03/29/2018 Model-Based Testing CSCE 747 - Lecture 18-03/29/2018 Creating Requirements-Based Tests Write Testable Specifications Produce clear, detailed, and testable requirements. Identify Independently Testable

More information

Estimated Time Required to Complete: 45 minutes

Estimated Time Required to Complete: 45 minutes Estimated Time Required to Complete: 45 minutes This is the first in a series of incremental skill building exercises which explore sheet metal punch ifeatures. Subsequent exercises will address: placing

More information

KenKen Strategies. Solution: To answer this, build the 6 6 table of values of the form ab 2 with a {1, 2, 3, 4, 5, 6}

KenKen Strategies. Solution: To answer this, build the 6 6 table of values of the form ab 2 with a {1, 2, 3, 4, 5, 6} 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

MITOCW watch?v=6fyk-3vt4fe

MITOCW watch?v=6fyk-3vt4fe MITOCW watch?v=6fyk-3vt4fe Good morning, everyone. So we come to the end-- one last lecture and puzzle. Today, we're going to look at a little coin row game and talk about, obviously, an algorithm to solve

More information

CS 171, Intro to A.I. Midterm Exam Fall Quarter, 2016

CS 171, Intro to A.I. Midterm Exam Fall Quarter, 2016 CS 171, Intro to A.I. Midterm Exam all Quarter, 2016 YOUR NAME: YOUR ID: ROW: SEAT: The exam will begin on the next page. Please, do not turn the page until told. When you are told to begin the exam, please

More information

Games (adversarial search problems)

Games (adversarial search problems) Mustafa Jarrar: Lecture Notes on Games, Birzeit University, Palestine Fall Semester, 204 Artificial Intelligence Chapter 6 Games (adversarial search problems) Dr. Mustafa Jarrar Sina Institute, University

More information

Artificial Intelligence Search III

Artificial Intelligence Search III Artificial Intelligence Search III Lecture 5 Content: Search III Quick Review on Lecture 4 Why Study Games? Game Playing as Search Special Characteristics of Game Playing Search Ingredients of 2-Person

More information

The K.U.Leuven CHR System: Implementation and Application

The K.U.Leuven CHR System: Implementation and Application The K.U.Leuven CHR System: Implementation and Application Tom Schrijvers, Bart Demoen {tom.schrijvers,bart.demoen}@cs.kuleuven.ac.be. Katholieke Universiteit Leuven, Belgium The K.U.Leuven CHR System p.1

More information

Expectation-based Learning in Design

Expectation-based Learning in Design Expectation-based Learning in Design Dan L. Grecu, David C. Brown Artificial Intelligence in Design Group Worcester Polytechnic Institute Worcester, MA CHARACTERISTICS OF DESIGN PROBLEMS 1) Problem spaces

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

heuristic (noun) - the study or practice of heuristic procedure - a heuristic method or procedure

heuristic (noun) - the study or practice of heuristic procedure - a heuristic method or procedure Heuristic 1 heuristic (adj) - involving or serving as an aid to learning, discovery, or problem-solving by experimental and especially trial-and-error methods; - of or relating to exploratory problem-solving

More information

Solving Problems by Searching

Solving Problems by Searching Solving Problems by Searching Berlin Chen 2005 Reference: 1. S. Russell and P. Norvig. Artificial Intelligence: A Modern Approach. Chapter 3 AI - Berlin Chen 1 Introduction Problem-Solving Agents vs. Reflex

More information

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25. Homework #1. ( Due: Oct 10 ) Figure 1: The laser game.

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25. Homework #1. ( Due: Oct 10 ) Figure 1: The laser game. CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25 Homework #1 ( Due: Oct 10 ) Figure 1: The laser game. Task 1. [ 60 Points ] Laser Game Consider the following game played on an n n board,

More information

Simon Nestler Florian Echtler Andreas Dippon Gudrun Klinker

Simon Nestler Florian Echtler Andreas Dippon Gudrun Klinker Simon Nestler Florian Echtler Andreas Dippon Gudrun Klinker Introduction Motivation: mass casualty incidents Collaboration between.. Paramedics and doctors (mobile hand-helds) Operation control center

More information

FreeCell Puzzle Protocol Document

FreeCell Puzzle Protocol Document AI Puzzle Framework FreeCell Puzzle Protocol Document Brian Shaver April 11, 2005 FreeCell Puzzle Protocol Document Page 2 of 7 Table of Contents Table of Contents...2 Introduction...3 Puzzle Description...

More information

mywbut.com Two agent games : alpha beta pruning

mywbut.com Two agent games : alpha beta pruning Two agent games : alpha beta pruning 1 3.5 Alpha-Beta Pruning ALPHA-BETA pruning is a method that reduces the number of nodes explored in Minimax strategy. It reduces the time required for the search and

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 13 Register Allocation: Coalescing

Lecture 13 Register Allocation: Coalescing Lecture 13 Register llocation: Coalescing I. Motivation II. Coalescing Overview III. lgorithms: Simple & Safe lgorithm riggs lgorithm George s lgorithm Phillip. Gibbons 15-745: Register Coalescing 1 Review:

More information

Numerical Roots and Radicals

Numerical Roots and Radicals Numerical Roots and Radicals Table of Contents Squares, Square Roots & Perfect Squares Square Roots of Numbers Greater than 400 Estimating Square Roots click on topic to go to that section 1 Squares, Square

More information

THE APPLICATION OF DEPTH FIRST SEARCH AND BACKTRACKING IN SOLVING MASTERMIND GAME

THE APPLICATION OF DEPTH FIRST SEARCH AND BACKTRACKING IN SOLVING MASTERMIND GAME THE APPLICATION OF DEPTH FIRST SEARCH AND BACKTRACKING IN SOLVING MASTERMIND GAME Halida Astatin (13507049) Informatics School of Electrical Engineering and Informatics Institut Teknologi Bandung Jalan

More information

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

A NUMBER THEORY APPROACH TO PROBLEM REPRESENTATION AND SOLUTION

A NUMBER THEORY APPROACH TO PROBLEM REPRESENTATION AND SOLUTION Session 22 General Problem Solving A NUMBER THEORY APPROACH TO PROBLEM REPRESENTATION AND SOLUTION Stewart N, T. Shen Edward R. Jones Virginia Polytechnic Institute and State University Abstract A number

More information

1 Place value (1) Quick reference. *for NRICH activities mapped to the Cambridge Primary objectives, please visit

1 Place value (1) Quick reference. *for NRICH activities mapped to the Cambridge Primary objectives, please visit : Core activity 1.2 To 1000 Cambridge University Press 1A 1 Place value (1) Quick reference Number Missing numbers Vocabulary Which game is which? Core activity 1.1: Hundreds, tens and ones (Learner s

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

Latin Squares for Elementary and Middle Grades

Latin Squares for Elementary and Middle Grades Latin Squares for Elementary and Middle Grades Yul Inn Fun Math Club email: Yul.Inn@FunMathClub.com web: www.funmathclub.com Abstract: A Latin square is a simple combinatorial object that arises in many

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

CSC 396 : Introduction to Artificial Intelligence

CSC 396 : Introduction to Artificial Intelligence CSC 396 : Introduction to Artificial Intelligence Exam 1 March 11th - 13th, 2008 Name Signature - Honor Code This is a take-home exam. You may use your book and lecture notes from class. You many not use

More information

Heuristics, and what to do if you don t know what to do. Carl Hultquist

Heuristics, and what to do if you don t know what to do. Carl Hultquist Heuristics, and what to do if you don t know what to do Carl Hultquist What is a heuristic? Relating to or using a problem-solving technique in which the most appropriate solution of several found by alternative

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

Heuristic Search with Pre-Computed Databases

Heuristic Search with Pre-Computed Databases Heuristic Search with Pre-Computed Databases Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Abstract Use pre-computed partial results to improve the efficiency of heuristic

More information

AUTOMATIC IMPLEMENTATION OF FIR FILTERS ON FIELD PROGRAMMABLE GATE ARRAYS

AUTOMATIC IMPLEMENTATION OF FIR FILTERS ON FIELD PROGRAMMABLE GATE ARRAYS AUTOMATIC IMPLEMENTATION OF FIR FILTERS ON FIELD PROGRAMMABLE GATE ARRAYS Satish Mohanakrishnan and Joseph B. Evans Telecommunications & Information Sciences Laboratory Department of Electrical Engineering

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

First Grade Art Print. Still Life with Grapes and Clarinet - by Georges Braque!!!!!!

First Grade Art Print. Still Life with Grapes and Clarinet - by Georges Braque!!!!!! First Grade Art Print Still Life with Grapes and Clarinet - by Georges Braque Other still lifes at Murray you can use for comparison: Diego Rivera - Still Life 1913 Cezanne - Still Life Fruit Picasso -

More information

NX 7.5. Table of Contents. Lesson 3 More Features

NX 7.5. Table of Contents. Lesson 3 More Features NX 7.5 Lesson 3 More Features Pre-reqs/Technical Skills Basic computer use Completion of NX 7.5 Lessons 1&2 Expectations Read lesson material Implement steps in software while reading through lesson material

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence CS482, CS682, MW 1 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis, sushil@cse.unr.edu, http://www.cse.unr.edu/~sushil Games and game trees Multi-agent systems

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

Ziggy MacDonald University of Leicester

Ziggy MacDonald University of Leicester 1 -> 6 07.03.2006 21:38 Volume 9, Issue 3, 1995 Teaching Linear Programming using Microsoft Excel Solver Ziggy MacDonald University of Leicester Linear programming (LP) is one of the most widely applied

More information

Topic 10 Recursive Backtracking

Topic 10 Recursive Backtracking Topic 10 ki "In ancient times, before computers were invented, alchemists studied the mystical properties of numbers. Lacking computers, they had to rely on dragons to do their work for them. The dragons

More information

AN ALTERNATIVE METHOD FOR ASSOCIATION RULES

AN ALTERNATIVE METHOD FOR ASSOCIATION RULES AN ALTERNATIVE METHOD FOR ASSOCIATION RULES RECAP Mining Frequent Itemsets Itemset A collection of one or more items Example: {Milk, Bread, Diaper} k-itemset An itemset that contains k items Support (

More information

Monte Carlo based battleship agent

Monte Carlo based battleship agent Monte Carlo based battleship agent Written by: Omer Haber, 313302010; Dror Sharf, 315357319 Introduction The game of battleship is a guessing game for two players which has been around for almost a century.

More information