Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Sudoku Hands-on Training Masters Project Presentation Yiqi Gao March 19, 2014 PROJECT MOTIVATION • Passion for Sudoku • Missing pages found on the flight to Mexico • Thrill of building an expert system with user interface by integrating Clips with Java BACKGROUND • Sudoku – 数独 sūdoku, Digit-single – Originally called Number Place, is a logic-based, combinatorial numberplacement puzzle BACKGROUND • Sudoku – The objective is to fill the playing board with digits so that each row, column and box contains all of the digits from 1 to 9. – The same single integer can only appear once in each row, column or box INTRODUCTION • Objective – Part I: Show solution to a given Sudoku puzzle step by step with detailed illustration – Part II: Introduce user interaction that could tell whether user gives the answer by guessing or reasoning and only accept answers got by reasoning INTRODUCTION • Design Choice – Clips (Inference Engine): a public domain software tool for building expert systems – Swing (User Interface): Java GUI widget toolkit – Jess (IE & UI Interaction): a rule engine for the Java platform, which is a superset of the CLIPS programming language INTRODUCTION • User Interface INTRODUCTION • Functions – Quick Start with a built-in Sudoku puzzle INTRODUCTION • Functions – Initialize your own Sudoku puzzle INTRODUCTION • Functions – Try a number to check the correctness INTRODUCTION • Functions – Step to get a currently possible answer INTRODUCTION • Functions – Solve the puzzle immediately INTRODUCTION • Functions – Clear the playing board INTRODUCTION • Difficulties & Solutions (Part I) – How to make the sequence of outcomes more natural (close to the sequence when done by human) ? – Declare different salience for rules INTRODUCTION • Difficulties & Solutions (Part I) – How to illustrate the reasoning for each step on the playing board? – Trace the rules that make a cell have only one possibility, color the related cells and give the reasoning INTRODUCTION • Difficulties & Solutions (Part II) – How to interact with user? – Take user input as an assertion of fact, modify the rules to make the inference engine run again with the new fact and after checking the correctness, retract the fact INTRODUCTION • Difficulties & Solutions (Part II) – Sudoku is a constraint satisfaction problem, and usually more than one cell is available at a point, thus choosing different cells makes different paths. – However, inference engine could only get one path at a point INTRODUCTION • Difficulties & Solutions (Part II) – How to check the correctness if the cell is not the first on the path? – Instead of a depth-first way of thinking, keep the possibilities of the cells before they get to one, put them in a list, thus all the currently available cells are in the list until the inference engine has no rule to trigger, then compare the cell with the list PROJECT STRUCTURE PROJECT STRUCTURE • System Architecture: Sudoku Board Sudoku Rules & Patterns Sudoku Problem Captured from lecture notes of CAP 5635 Artificial Intelligence EXPERT KNOWLEDGE • Sudoku Rules – Each row, column and box contains all of the digits from 1 to 9 – The same single integer can only appear once in each row, column and box EXPERT KNOWLEDGE • Solving Patterns – Sole Candidate – Unique Candidate – Box and column / Row Interaction – Box / Box Interaction http://www.kristanix.com/sudokuepic/sudoku-solving-techniques.php EXPERT KNOWLEDGE • Solving Patterns – Naked Subset – Hidden subset http://www.kristanix.com/sudokuepic/sudoku-solving-techniques.php INFERENCE ENGINE • Facts – Cell: 9×9 facts recording the information of each cell and 20+ facts for the puzzle (box 0) INFERENCE ENGINE • Facts – Current: 1 fact recording current status and currently available results INFERENCE ENGINE • Rules – Initialize puzzle: extract the (possibilities ?) value from puzzle(20+ Cell facts) to board(9×9 Cell facts) and retract these facts after initialization so that there are always 9×9 Cell facts afterwards INFERENCE ENGINE • Rules – All elimination rules: each time eliminate only one number from a cell; if after elimination the cell has only one possibility, then keep that number so that the cell has two possibilities and put this cell and its value in the current results list, meanwhile trace the rules and related cells USER INTERFACE • Sudoku Board – Board/Box/Cell – CardLayout (JLabel/InputBox) for Cell USER INTERFACE • Buttons & InfoBar – JButton – JLabel IE & UI INTERACTION • Assert new facts for user input with Jess • Get slot values from facts and show the information on User Interface after reorganization EXPECTED RESULTS • Two Parts (Both Finished) – Part I: Show solution to a given Sudoku puzzle step by step with detailed illustration – Part II: Introduce user interaction that could tell whether the user gives the answer by guessing or reasoning and only accept answers got by reasoning RESULTS RESULTS RESULTS RESULTS RESULTS RESULTS RESULTS RESULTS MAIN INNOVATIONS • Teaching with detailed illustrations – Part I : Colored cells with reasoning • Training rather than just teaching – Part II : Be able to tell whether the user gets the answer by guessing or reasoning and only accept answers got by reasoning PROJECT SUMMARY • • • • Sudoku teaching and training tool Clips and Java integration Expert system with GUI User interaction