CMPT 310 Assignment 1

Similar documents
CMPT 310 Assignment 1

Spring 06 Assignment 2: Constraint Satisfaction Problems

Spring 06 Assignment 2: Constraint Satisfaction Problems

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

CS 188 Fall Introduction to Artificial Intelligence Midterm 1

Techniques for Generating Sudoku Instances

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

PROBLEMS & INVESTIGATIONS. Introducing Add to 15 & 15-Tac-Toe

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

Grade 7/8 Math Circles. Visual Group Theory

Sudoku Mock Test 5. Instruction Booklet. 28 th December, IST (GMT ) 975 points + Time Bonus. Organized by. Logic Masters: India

Introduction to Spring 2009 Artificial Intelligence Final Exam

GET OVERLAPPED! Author: Huang Yi. Forum thread:

CS 32 Puzzles, Games & Algorithms Fall 2013

a b c d e f g h 1 a b c d e f g h C A B B A C C X X C C X X C C A B B A C Diagram 1-2 Square names

Tic-tac-toe. Lars-Henrik Eriksson. Functional Programming 1. Original presentation by Tjark Weber. Lars-Henrik Eriksson (UU) Tic-tac-toe 1 / 23

Grade 7/8 Math Circles. Visual Group Theory

SudokuSplashZone. Overview 3

Practice Session 2. HW 1 Review

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

Homework Assignment #1

Unit 12: Artificial Intelligence CS 101, Fall 2018

Project Connect Four (Version 1.1)

IN THIS ISSUE. Cave vs. Pentagroups

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

CPSC 217 Assignment 3

An application of the least squares plane fitting interpolation process to image reconstruction and enhancement

Sudoku Online Qualifiers2017

Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, :59pm

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

1st Grade Math. Please complete the activity below for the day indicated. Day 1: Double Trouble. Day 2: Greatest Sum. Day 3: Make a Number

5.4 Imperfect, Real-Time Decisions

G51PGP: Software Paradigms. Object Oriented Coursework 4

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

Embedded Systems Lab

Kenken For Teachers. Tom Davis January 8, Abstract

Fall 2017 March 13, Written Homework 4

UN DOS TREZ Sudoku Competition. Puzzle Booklet for Preliminary Round. 19-Feb :45PM 75 minutes

Eleventh Annual Ohio Wesleyan University Programming Contest April 1, 2017 Rules: 1. There are six questions to be completed in four hours. 2.

CS 188 Introduction to Fall 2014 Artificial Intelligence Midterm

WPF SUDOKU/PUZZLE GRAND PRIX 2014 WPF SUDOKU GP 2014 COMPETITION BOOKLET ROUND 4. Puzzle authors: Russia Andrey Bogdanov, Olga Leontieva.

Cracking the Sudoku: A Deterministic Approach

5.4 Imperfect, Real-Time Decisions

Intelligent Agents p.1/25. Intelligent Agents. Chapter 2

Instructions [CT+PT Treatment]

Introduction to Counting and Probability

Free Cell Solver. Copyright 2001 Kevin Atkinson Shari Holstege December 11, 2001

Game Playing in Prolog

Problem 1. Imagine that you are being held captive in a dungeon by an evil mathematician with

Comparing Methods for Solving Kuromasu Puzzles

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

Investigation of Algorithmic Solutions of Sudoku Puzzles

Sudoku Touch. 1-4 players, adult recommended. Sudoku Touch by. Bring your family back together!

Chapter 4 Heuristics & Local Search

Heuristic Search with Pre-Computed Databases

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

Due: Sunday 13 November by 10:59pm Worth: 8%

2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard

Intro to Java Programming Project


Problem 1. (15 points) Consider the so-called Cryptarithmetic problem shown below.

CSC 396 : Introduction to Artificial Intelligence

BIEB 143 Spring 2018 Weeks 8-10 Game Theory Lab

Over ===* Three games of strategy and chance Unique solitaire puzzles. For I to 4 players Ages 12 to adult. PassTM

PLAYERS AGES MINS.

Part III F F J M. Name

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

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

Google DeepMind s AlphaGo vs. world Go champion Lee Sedol

CSCE 2004 S19 Assignment 5. Halfway checkin: April 6, 2019, 11:59pm. Final version: Apr. 12, 2019, 11:59pm

Assignment 2 (Part 1 of 2), University of Toronto, CSC384 - Intro to AI, Winter

CSC242 Intro to AI Spring 2012 Project 2: Knowledge and Reasoning Handed out: Thu Mar 1 Due: Wed Mar 21 11:59pm

Programming Languages and Techniques Homework 3

Assignment 5 due Monday, May 7

The 2017 British Informatics Olympiad

Episode 3 16 th 19 th March Made In India and Regions by Prasanna Seshadri

LMI SUDOKU TEST 7X JULY 2014 BY RICHARD STOLK

KenKen Strategies 17+

COSC 117 Programming Project 2 Page 1 of 6

The patterns considered here are black and white and represented by a rectangular grid of cells. Here is a typical pattern: [Redundant]

MODULE: DESIGNING AND DEVELOPING OBJECT-ORIENTED COMPUTER PROGRAMS ASSIGNMENT TITLE: WORDSEARCH MARCH 2014

1st UKPA Sudoku Championship

For this assignment, your job is to create a program that plays (a simplified version of) blackjack. Name your program blackjack.py.

arxiv: v1 [cs.cc] 21 Jun 2017

LMI Monthly Test May 2010 Instruction Booklet

This chapter gives you everything you

SUDOKU1 Challenge 2013 TWINS MADNESS

37 Game Theory. Bebe b1 b2 b3. a Abe a a A Two-Person Zero-Sum Game

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

2 Textual Input Language. 1.1 Notation. Project #2 2

Problem 4.R1: Best Range

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat

The 2009 British Informatics Olympiad

Welcome to the Sudoku and Kakuro Help File.

Logic Masters India Presents

CSE 573 Problem Set 1. Answers on 10/17/08

1 Modified Othello. Assignment 2. Total marks: 100. Out: February 10 Due: March 5 at 14:30

An Intuitive Approach to Groups

Data Structure Analysis

Midterm 2 6:00-8:00pm, 16 April

Transcription:

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 a single.py file, one file per question. Free-answer questions should be submitted as PDF file. You may write your solution using LaTeX, Microsoft Word (print to PDF, do not submit a.doc file), or write on paper and scan it. If you write on paper, please use a scanner or a scanner app (such as TinyScanner for ios) that removes the background; do not submit a photo. You are encouraged to work in a group. Feel free to discuss solution strategies and check each other s work. However, you must write all the text and code you submit on your own. Joint submissions are not allowed, nor is copying someone elses text or code. Plagiarism is not okay, and will be taken very seriously. If you re not sure whether something is okay, please ask. If you are having trouble, please take advantage of office hours and the discussion forum. If you see a question from another student on the discussion forum that you think you know the answer to, please respond. (Do your best to lead your fellow student to a solution, rather than simply giving the solution directly.) 1 PEAS model (10 points) For each of the following problems, develop a PEAS model and characterize the environment along the dimensions: observable, deterministic, episodic, static, discrete, single-agent. 1. Google Maps search for directions using public transit in Vancouver. 2. The game show Jeopardy, as played by IBM s Watson. 1

2 Problem formulation (10 points) Give a complete problem formulation for each of the following. Choose a formulation that is precise enough to be implemented. 1. Using only four colors, you have to color a planar map in such a way that no two adjacent regions have the same color. 2. You have three jugs, measuring 12 gallons, 8 gallons, and 3 gallons, and a water faucet. You can fill the jugs up or empty them out from on to another or onto the ground. You need to measure out exactly one gallon. 3 Searching using composite actions (10 points) An action such as Go(Sibiu) really consists of a long sequence of finer-grained actions: turn on the car, release the brake, accelerate forward, etc. Having composite actions of this kind reduces the number of steps in a solution sequence, thereby reducing the search time. Suppose we take this to the logical extreme, by making super-composite actions out of every possible sequence of Go actions. Then every problem instance is solved by a single super-composite action, such as Go(Sibiu)Go(Rimnicu Vilcea)Go(Pitesti)Go(Bucharest). Explain how search would work in this formulation. Is this a practical approach for speeding up problem solving? 4 Lights Out puzzle (60 points total) In this question we will consider the Lights Out puzzle. In this puzzle, there is an n m board of cells, each of which is On or Off. The puzzle starts out with some cells On and some Off. In each move, the player chooses one cell; that cell and all adjacent cells are toggled (i.e. On turns to Off, and Off turns to On). Cells count as adjacent horizontally or vertically, but not diagonally. In other words, targeting a cell in the center of the board toggles a total of five cells; a move on the side toggles four; and a 2

move in the corner toggles three. The goal of the game is to change all cells to the Off position in as few moves as possible. You can try playing Lights Out yourself at: http://www.neok12.com/games/lights-out/lights-out.htm 4.1 (5 points) Create an implementation of the Lights Out puzzle. It should support the following functions: 4.2 create puzzle(rows, cols): Create a Lights Out puzzle with all cells initialized to off. perform move(puzzle, row, col): Toggle the appropriate cells corresponding to a move at position (row,col). scramble(puzzle): Scramble the puzzle by, on each cell, randomly with 50% probability, calling perform move(). This ensures that the puzzle is solvable, which might not be the case if cells are flipped individually. is solved(puzzle): Returns True or False depending on whether all cells are off. (10 points) Does the order of moves for a Lights Out puzzle matter? Can an optimal solution ever involve running perform move() twice on the same cell? Explain why or why not. Write a function next cell(rows,cols,row,col) that takes the (row,col) coordinates of a cell on a rows cols grid and outputs the (row,col) coordinates of the next cell in left-right top-bottom order. For example, in a 5 5, zero-indexed grid, next cell(5,5,0,0) = (0,1) and next cell(5,5,3,4) = (4,0). (Any other order is fine, too.) 4.3 (10 points) Come up with a nontrivial admissible heuristic for this puzzle. Describe your heuristic and explain why it is admissible. 3

4.4 (30 points) Implement three functions to solve the Lights Out puzzle, using each of the following algorithms respectively: Depth-First, Breadth-First, A*. A* should use the heuristic you designed above. Each function should take a puzzle as input and return a list of moves that solves the puzzle. In addition, each function should output the number of steps it took to find the solution, measured by the number of times the search algorithm used perform move() to find the next board state. (You only need to output a single solution (i.e. one list of moves), not all possible solutions.) Hint: Your implementations of Depth-First and Breadth-First search should have worst-case running time of O(2 nm ), where n and m are the numbers of rows and columns respectively. You may want to make use of next cell(). 4.5 (5 points) Create 100 random puzzles with 4 rows and 4 columns, and run each of the three algorithms on each puzzle. For each algorithm, report (1) the total length of the 100 solutions, (2) the total number of steps taken by the search algorithm to generate all the solutions, and (3) the wallclock time taken by the algorithm. Hint: This should take less than 5 minutes to run. 4.6 (Challenge problem: +10 points extra credit). Come up with your own algorithms for searching for a solution. You may use A* with any heuristic you like, rely on precomputed sub-problems, or use any other algorithm you can think of. Run your algorithm on 100 n n puzzles and report moves, search steps and wallclock time, as above. We will post a leaderboard on the course web page with the top solutions for n = 5 and n = 8, and award extra credit for solutions that perform particularly well on either measure. 4

If you decide to use an algorithm that does not run perform move() directly as part of its search, it may not be obvious how to measure how many steps it takes. If that is the case, use your judgement and measure the number of steps in whatever way is most appropriate. In particular, every step should take O(1) time: the running time of a step should not depend on the number of rows and columns of the puzzle. If you like, you can do any amount of pre-computation, such as storing the results of puzzles with partial solutions. However, your algorithm must do the pre-computation before seeing any of the 100 test puzzles. There will likely be some variation in results due to random chance; however, this will likely be small because of the large number of puzzles. You are allowed to repeat the 100-puzzle process as many times as you like and report the best results. We are counting on everyone to report their results faithfully. This is a friendly competition; please do not cheat and report different numbers than you got. We may verify specific results if we suspect the numbers are mis-reported. 5 Feedback (5 points) Give one short piece of feedback about the course so far. What have you found most interesting? Is there a topic that you had trouble understanding? Are there any changes that could improve the value of the course to you? 6 Time (5 points) How many hours did you spend on this assignment? 5