SOLVING SUDOKU WITH MATLAB VERIFICATION FUNCTION correctness verification of the puzzle: checks if the current element appears twice in the same line,

Slides:



Advertisements
Similar presentations
Computing Science 1P Large Group Tutorial 19 Simon Gay Department of Computing Science University of Glasgow 2006/07.
Advertisements

CREATED BY: CALVIN WILLIAMS Bidirectional Search.
Solving Sudoku1 Website: Labelling scheme.
Number puzzles in the paper Did you know there’s a whole range of number puzzles you can try in most newspapers? Click on the puzzles below to complete.
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
Operations Research Assignment Problem.
Sudoku. Introduction In this presentation I will cover the Sudoku puzzle, some basics of its complexity as well as specifically discussing the complexity.
Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Backtracking COP Backtracking  Backtracking is a technique used to solve problems with a large search space, by systematically trying and eliminating.
Sudoku Pseudo code 1.decide the prototype 2.verbalize the solution in terms of a recursive call to the prototype 3.write the code for the recursion being.
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 8 Multidimensional.
Support: UCARE grant awarded to Chris Reeson & CAREER Award # from the National Science Foundation. To the public: –Illustrate the power of CP For.
Lecture 281 Loop Analysis. Lecture 282 Loop Analysis Nodal analysis was developed by applying KCL at each non-reference node. Loop analysis is developed.
A game of logic where the player must assign the numbers 1..9 to cells on a 9x9 grid. The placement of the numbers must be such that every number must.
Midterm II Solution Prof. Mohamed Batouche Department of Computer Science CCIS – King Saud University Saudi Arabia.
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
Row Reduction and Echelon Forms (9/9/05) A matrix is in echelon form if: All nonzero rows are above any all-zero rows. Each leading entry of a row is in.
SOLVING SUDOKU Graham Hutton University of Nottingham (with thanks to Richard Bird)
Solving Sudoku Mark PTTLS Micro teach. Solving Sudoku What is a Sudoku? A Sudoku is a number puzzle based on a 9x9 grid made up from smaller 3x3 blocks.
CS194 Project: Sudoku Difficulty Kha Chu Advisor: Professor Sahai.
SUDOKU Via Relaxation Labeling
REPETITION STRUCTURES. Topics Introduction to Repetition Structures The while Loop: a Condition- Controlled Loop The for Loop: a Count-Controlled Loop.
By: Adam Hebert.  Why Sudoku?  Attempts at an App  MATLAB Implementation - Use of webcam - Algorithm  Problems with method  Demonstration  Questions.
Computer Science Department Data Structure & Algorithms Problem Solving with Stack.
Sudoku Hands-on Training Masters Project Presentation Yiqi Gao March 19, 2014.
SOLVING SUDOKU WITH MATLAB Raluca Marinescu, Andrea Garcia, Ivan Castro, Eduard Enoiu Mälardalen University, Västerås,
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
2009/11/14GPW20091 Analysis of the Behavior of People Solving Sudoku Puzzles Reijer Grimbergen School of Computer Science, Tokyo University of Technology.
This is your worksheet for the Unit 4 IP. You will find that there are two tables – one for animal cells and one for plants cells.
Whiteboardmaths.com © 2008 All rights reserved
Announcements This Wednesday, Class and Labs are cancelled! The last lab is due this Wednesday … how many people are planning on doing it? Finally posted.
Formal Methods & Verification: Project 1 Sudoku for Nonomino board Farn Wang.
Sudoku Solver Comparison A comparative analysis of algorithms for solving Sudoku.
HKOI2006 Analysis and Solution Junior Q3 – Sudoku HKOI Training Team
Sudoku Jordi Cortadella Department of Computer Science.
Propositional Satisfiability A compound proposition is satisfiable if there is an assignment of truth values to its variables that make it true. When no.
SOLVING SUDOKU WITH MATLAB Raluca Marinescu, Andrea Garcia, Ivan Castro, Eduard Enoiu Mälardalen University, Västerås,
SUDOKO PROBLEM: Modeled as an ILP* Daryl L. Santos, Ph.D. Professor – Systems Science and Industrial Engineering Thomas J. Watson School of Engineering.
Units Of Output TFCTVCTCMCAFCAVC Marginal Cost Puzzle 20.
Class Opener:. Identifying Matrices Student Check:
3D Puzzle Assignment #1 Programming Language, Spring 2003.
1 Collection, Iterable, and Iterator Interfaces The Collection Interface and its Hierarchy The Iterable and Iterator Interfaces For-each Loops with Iterable.
1 Project Management Example Solving Sudoku 2 What is Sudoku?  Sudoku is a game with 9 columns and 9 rows and 9 “boxes” composed of a 3 x 3 Grid  Numbers.
How Do I Solve This Thing?. You are familiar with Sudoku puzzles. For this variation, place the integers 1 – 9 into each row or column such that the.
Monster (“Mega”) Sudoku
Backtracking & Brute Force Optimization Intro2CS – weeks
CompSci Problem Solving: Sudoku  Rules of the Game Sudoku is played with a 9 by 9 "board" consisting of nine 3 by 3 sub-boards. The symbols 1 -
Lives and Scoring Games Programming in Scratch. Games Programming in Scratch L2 Lives and Scoring Learning Objectives Define a variable Understand the.
軟體實作與計算實驗 1  SUDOKU  New  Play  Check Lecture 8II SUDOKU PUZZLE.
Sit-In Lab 1 Twenty-Forty-Eight
Monster (“Mega”) Sudoku
Data Structures and Algorithms
EGR 115 Introduction to Computing for Engineers
EGR 115 Introduction to Computing for Engineers
Sit-In Lab 1 Ob-CHESS-ion
Linear Algebra Lecture 4.
Introduction to MATLAB
Example Fill in the grid so that every row, column and box contains each of the numbers 1 to 9:
Jordi Cortadella Department of Computer Science
Modeling Sudoku as a CNF Formula
Modeling Sudoku as a CNF Formula
Multidimensional Arrays
Sudoku (数独 sūdoku?), also known as Number Place or Nanpure, is a logic-based placement puzzle. The objective is to fill the grid so that every column,
CS Software Studio Assignment 1
Solving Equations with Variables on Both Sides
Solving Equations with Variables on Both Sides
Sudoku.
Modeling Sudoku as a CNF Formula
Objective: to find and verify inverses of functions.
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
Presentation transcript:

SOLVING SUDOKU WITH MATLAB VERIFICATION FUNCTION correctness verification of the puzzle: checks if the current element appears twice in the same line, column, or in the 3-by-3 grid. Input: the cell matrix A which contains the current puzzle. Output: variable val which can have two values: 0 if the puzzle is correct 1 otherwise function [val]=verific(A)

SOLVING SUDOKU WITH MATLAB ALGORITHM Based on constraint propagation The key internal function is: When a value is assigned to a cell that same value cannot be used as a possible assignment in all related cells; If a cell has only one single value for possible assignment, that value is immediately assigned. % Read predefined games and outputs the solved puzzle function [A]= iSudokuALG(A)

SOLVING SUDOKU WITH MATLAB ALGORITHM Steps: 1. Find all the possible values for all the empty cells; 2. If there is a single possible value, we assign that value to the cell; 3. Propagate constraints to other cells until you reach the end of the puzzle; 4. If all the cells have more than one possible value we fill in a tentative value for that cell. 5. START AGAIN (When do we stop?)

SOLVING SUDOKU WITH MATLAB ALGORITHM When do we stop? When there are no more empty cells in the puzzle; When for a cell we cannot place any possible value.

SOLVING SUDOKU WITH MATLAB ALGORIHM TESTING Experimental results for different Sudoku puzzles: