Docsity

PROJECT 2 Coloring Puzzle DESCRIPTIONS , Exercises of Artificial Intelligence

Toggle sidebar
bg1
Faculty of Information Technology
Computer Science Department
CSC14003–Introduction to AI
1
Proj 2: Proportion Logic
PROJECT 2: Coloring Puzzle
DESCRIPTIONS:
You are asked to build a coloring puzzle solver by using the first order logic to CNF as
described below:
Given a matrix of size 𝑚 × 𝑛, where each cell will be a non-negative integer or zero
(empty cell). Each cell is considered to be adjacent to itself and 8 surrounding cells.
Your puzzle needs to color all the cells of the matrix with either blue or red, so that the
number inside each cell corresponds to the number of blue squares adjacent to that cell (see
Figure 1)
Figure 1 An example of input matrix (left) and output matrix (right)
In order to solve this problem, you can consider some steps:
- A logical variable is assigned to each cell of the matrix (If the logical variable of
that cell is True, it will be colored blue, otherwise it will be red)
- Write constraints for cells containing numbers to obtain a set of constraint clauses
in CNF (note that you need to remove duplicate clauses)
- Then, using the pysat library or the A* algorithm to find the value for each
variable and infer the result.
o With A*, students asked to design the application with the interface as
shown that allows users to browse the input file as well as enter the delay
time for each step (default is 0.5s). See Figure 2.
pf3
pf4

Partial preview of the text

Download PROJECT 2 Coloring Puzzle DESCRIPTIONS and more Exercises Artificial Intelligence in PDF only on Docsity!

Computer Science Department 1

PROJECT 2 : Coloring Puzzle

DESCRIPTIONS:

You are asked to build a coloring puzzle solver by using the first order logic to CNF as described below: Given a matrix of size 𝑚 × 𝑛, where each cell will be a non-negative integer or zero (empty cell). Each cell is considered to be adjacent to itself and 8 surrounding cells. Your puzzle needs to color all the cells of the matrix with either blue or red, so that the number inside each cell corresponds to the number of blue squares adjacent to that cell (see Figure 1 ) Figure 1 An example of input matrix (left) and output matrix (right) In order to solve this problem, you can consider some steps:

  • A logical variable is assigned to each cell of the matrix (If the logical variable of that cell is True, it will be colored blue, otherwise it will be red)
  • Write constraints for cells containing numbers to obtain a set of constraint clauses in CNF (note that you need to remove duplicate clauses)
  • Then, using the pysat library or the _A_* algorithm to find the value for each variable and infer the result. o With A*, students asked to design the application with the interface as shown that allows users to browse the input file as well as enter the delay time for each step (default is 0.5s). See Figure 2.

Computer Science Department 2 Figure 2 A Sample GUI for coloring puzzle o When the user presses the Start button, runs the A* algorithm, at each step, the state of the current State is displayed on the form, the step order and the current State's heuristic value are also displayed on the form (you can find a demo video at here.) o Students can use Python's tkinter library to create GUI REQUIREMENTS:

1. Collaboration Policy You can work individually or in groups. Each group has maximum 3 students. 2. Submitted documents

Computer Science Department 4 Grading Policy: We have some rubric for assessing your work. No. Criteria % 1 Solution description Describe the logical principles for generating CNFs correctly. 30 % 2 Implementation: Generate CNFs automatically ( 1 0%) Use pysat library to solve CNFs correctly ( 10 %) Apply A* to solve CNFs without a library ( 10 %) Program brute-force algorithm to compare with A* (speed) (5%) Program backtracking algorithm to compare with A* (speed) (5%) Graphic interface (10%)

Documents and other resources: Give at least 5 testcases with difference sizes (5x5, 9x9, 11x11, 15x15, 20x20…) to check your solution ( 10 %) Thoroughness in analysis and experimentation ( 5 %) Comparing results and performance ( 5 %) Comply with the regulations of submission requirements ( 10 %) 30 % Note:

  • 0 points will be given for the same content submissions.
  • Only submissions on the Moodle link are accepted.
  • All submission files are packaged in a compressed file. The file name submitted must be set according to the following syntax: StudentID1_StudentID2.zip
  • Any plagiarism will be get 0 point.