SlideShare uma empresa Scribd logo
1 de 4
Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and
Applications (IJERA) ISSN: 2248-9622 www.ijera.com
Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349
1346 | P a g e
A new approach to solve n-queens problem based on series
Vishal Kesri, Manoj Kumar Mishra
School of Computer Engineering KIIT University, India
Abstract
The N-queens problem is a popular
classic puzzle where numbers of queen were to be
placed on an n x n matrix such that no queen can
attack any other queen. The Branching Factor
grows in a roughly linear way, which is an
important consideration for the researchers.
However, many researchers have cited the issues
with help of artificial intelligence search patterns
say DFS, BFS and backtracking algorithms. The
proposed algorithm is able to compute one
unique solution in polynomial time when chess
board size is greater than 7. This algorithm is
based on 8 different series. For each series a
different approach is taken to place the queen on
a given chess board.
General Terms: N-Queen, Knight move, NP-
hard.
Keywords: Analyzer, Move, Rule, Partz.
I. INTRODUCTION
The n-queens problem is proposed for the
first time in 1850 by Carl Gauss. It is to determine a
placement of n queens on an n × n chessboard, such
that no two queens can attack each other [3]. This
problem falls in a special class of problems well
known as NP hard, whose solution cannot be found
out in polynomial time. Let’s consider the 8-queen
problem, which is computationally very expensive
since the total number of possible arrangements
queen is 64! / (56! x 8!) ~ 4.4 x 109
and the total
number of possible solutions are 92 [1]. But there
exists only 12 unique solutions. There are some
solutions that are to be the same and can be obtained
one from the other by taking rotations or symmetry.
The n-queen problem follows the same rules as in 8-
queen problem with N queens and an n x n
chessboard. Current knowledge of total number of
solutions of n-queens problem can be viewed from
the Table 1.
A. Applications
The N-queen problem can be applied in
many different areas, like parallel memory storage
schemes, VLSI testing, traffic control and deadlock
prevention. It is also applicable to find solutions of
those problems which require permutations like
travelling salesman problem [1].
N: Unique Solution Distinct Solution
1 1 1
2 0 0
3 0 0
4 1 2
5 2 10
6 1 4
7 6 40
8 12 92
9 46 352
10 92 724
11 341 2680
12 1787 14200
13 9233 73712
14 45752 365596
Table 1: The number of total and unique solutions
for the
N-Queens problem
II. N-QUEENS PROBLEM DEFINATION
The n-queens Problem of size n, where
need to place n queen into n × n chessboard, so that
no two queen can attack each other that is no two of
them are on the same row, column, or diagonal.
Therefore the rules to obtain the solution of n-
queens problem are follows [5]:
1. Only one queen can placed in each row
2. Only one queen can placed in each column
3. At any time maximum one queen can be in the
diagonal.
Suppose two queen are placed at position (i, j) and
(k, l). Then they are on the same diagonal only if
A. Notation
Here some notations are defined, which are
used in the propose algorithm .These notations are
defined in table 2.
Symbols Definition
S1 Positive Integer Series-A1
S2 Positive Integer Series-A2
S3 Positive Integer Series-A3
S4 Positive Integer Series-A4
Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and
Applications (IJERA) ISSN: 2248-9622 www.ijera.com
Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349
1347 | P a g e
S5 Positive Integer Series-A5
S6 Positive Integer Series-A6
S7 Positive Integer Series-A7
S8 Positive Integer Series-A8
R1 Rule-1, used to get the solution.
R2 Rule-2, used to get the solution.
MV1 It is first move function, which
defines the pattern of placing the
queens.
MV2 It is second move function, which
defines the pattern of placing the
queens.
MV3 It is third move function, which
defines the pattern of placing the
queens.
‘n’ Given number of queen (Input Size)
‘Cij’ Cell position of the chess board.
Table-2: List of Symbols
III. SERIES
The Proposed algorithm is a combination
of two rules and eight distinct series. These series
are given below:
A. Series- A1
The Series- A1 is used to get the solution such that:
B. Series- A2
The Series- A2 is used to get the solution such that:
C. Series- A3
The Series- A3 is used to get the solution such
that:
D. Series- A4
The Series- A4 is used to get the solution such that:
E. Series- A5
The Series- A6 is used to get the solution such
that:
F. Series- A6
The Series- A6 is used to get the solution such that:
G. Series- A7
The Series- A7 is used to get the solution such
that:
H. Series- A8
The Series- A8 is used to get the solution such
that:
IV. RULES
There are two Rules, which is used with a
particular series to achieve a solution for a given
chess board. Some series do not need any of the
rules, such as Series-A.
Analyzer: The core of these rules is an analyzer
function. The function of the analyzer is described
as below.
Step-1: initialize the cell ‘Cij’ of chess board to zero,
except where, ‘Cij’ already acquired by a queen.
0 Q 0 0 0
0 0 0 0 Q
0 0 0 0 0
0 0 0 0 0
0 0 Q 0 0
Figure-1: Put Zero in remaining ‘Cij’
Step-2: In the beginning take any queen and add ‘1’
to the value of its attacking cells. Then this step is
repeated for each queen as shown in figure 2.
1 Q 3 2 2
2 2 3 2 Q
2 3 3 3 2
1 2 2 2 3
1 2 Q 1 2
Figure-2: The value of each ‘Cij’ after step 2
The ‘Cij’ values shown in the figure 2 indicates that
the position Cij is attacked by that many queens e.g.
‘C23’ has an integer value 3, that means this cell is
attacked by 3 different queens e.g. by C12 ,C25 ,C53.
Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and
Applications (IJERA) ISSN: 2248-9622 www.ijera.com
Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349
1348 | P a g e
First Rule: First rule is applied to find the
solution lies in the series S2 from the solution of S1.
Algorithm of First Rule is described below:
Algorithm for “Rule”
Step-1: If the solution falls in any one of the series
(S1, S3)
Step-2: Increase the dimension of the chess board by
one, that is row +1 and column +1
Step-4: Call Analyzer function with this updated
dimensions
Step-5: Place a queen, where “Cij= =0”
Algorithm-1: Describe Steps of first Rule
Second Rule: Second rule is applied to find the
solution lies in the series S6 from the solution of S5.
The conditions for the second rule is “remove the
queen from Cij If Cin = = C1j = = 1 and |i-1| ≠ |n-j|.
And place queens at the positions C1j and Cin.
Algorithm of second Rule is described below:
Algorithm of Second Rule
Step-1: If the solution falls in any one of the
series (S5)
Step-2: Increase the dimension of the chess
board by one, that is row +1 and column +1
Step-3: Call Analyzer function with this
updated dimensions
Step-4: Remove Queen from Cij
Step-5: Call Analyzer function with this
updated dimensions
Step-6: Place queen, where “Cij= =0”
Algorithm-2: Describe Steps of second Rule
Table 3 show which series those rules apply:
S1 S2 S3 S4 S5 S6 S7 S8
R1        
R2        
Table-3
V. Move Function
MV function shows us the pattern of
placing queen on chess board. There is three Move
Functions defined namely MV1, MV2 and MV3. The
move function along with a particular series defines
the placement of queens on the chess board. The
algorithm for placing queen according to pattern is
described below:
Move-1: This function increases the row value of
the chess board by 3 and reduces the column value
by 1. Algorithm-3 for MV1 is given below.
Algorithm for “MV1”
/* The Place of first queen depend on series */
/* i = row value */
Cij Place First Queen
fora=1 to a ≤ n
i = i+3;
j = j-1;
Cij Place Queen
a = i;
Algorithm-3: Algorithm for MV1 function
Move-2: This function increases the row value of
the chess board by 2 and reduces the column value
by 1. Algorithm-4 for MV2 is given below.
Algorithm for “MV2”
/* The Place of first queen depend on series */
/* i = row value */
Cij Place First Queen
fora=1 to a ≤ n
i = i+2;
j = j-1;
Cij Place Queen
a = i;
Algorithm-4: Algorithm for MV2 function
Move-3: This function decreases the row value of
the chess board by 2 and increase column value by 3
or decrease column value by 1. Algorithm-5 for
MV3 is given below.
Algorithm for “MV3”
/* The Place of first queen depend on series */
/* i = row value, j = Column */
count = 0;
Cij Place First Queen
fora=n to a ≥ 1
i = i-2;
if (count % 2 =0 )
j = j+3;
else
j = j-1;
Cij Place Queen
a = i;
Algorithm-5: Algorithm for MV3 function
Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and
Applications (IJERA) ISSN: 2248-9622 www.ijera.com
Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349
1349 | P a g e
Table-4 shows, which move function is applied on
what series.
S1 S2 S3 S4 S5 S6 S7 S8
MV1        
MV2        
MV3        
Table-4
Algorithm for n-queens
The proposed algorithm finds a unique
solution of n-queens problem, which is described
below:
Algorithm to solve n-queens Problem
Step1:
Step2: If
{
Call “MV1”, where i = 1 && j = n/3
Call “MV1”, where i = 2 && j = (n/3) *2
Call “MV1”, where i = 3 && j = n
}
Step3: If
{
Get the solution of “n-1” chess board
/* n-1 chess board ∈ S1 */
Apply ‘R1’
}
Step4: If
{
Call “MV1”, where i = 2 && j = (n-1)/3
Call “MV1”, where i = 1 && j = (n-1/3)
*2+1
Call “MV1”, where i = 3 && j = n
}
Step5: If
{
Get the solution of “n-1” chess board
/* n-1 chess board ∈ S3 */
Apply ‘R1’
}
Step6: If
{
Call “MV2”, where i = 1 && j = n/2
Call “MV3”, where i = n && j = (n/2) + 2
}
Step7: If
{
Call “MV2”, where i = 2 && j = (n-1)/2
Call “MV3”, where i = n && j = (n-1)/2 +2
Apply ‘R2’
}
Step8: If
{
Call “MV2”, where i = 1 && j = (n/2) + 1
Call “MV3”, where i = n && j = (n/2) + 3
Place Queen At Cij, Where i = 2 && j = 1
}
Step9: If
{
Call “MV2”, where i = 1 && j = (n-1) /2+2
Call “MV3”, where i = n && j = (n-1) /2) + 4
Place Queen At Cij, Where i = 1 && j = 1
Place Queen At Cij, Where i = 3 && j = 2
}
Algorithm-6: Algorithm for Calculate Solution of
N-Queen
VI. DISADVANTAGE
The proposed algorithm provides only one
unique solution when chess board size is greater
than 7 and the algorithm is not able to provide all
the solutions. By Rotation of chess board we can get
few more solutions but those solutions are not
distinct.
VII. CONCLUSION AND FUTURE
WORK
This Algorithm provides only one unique
solution for n > 7. This method can be enhanced in
future to find all other solutions.
REFERENCES
[1] V. Kesri, Va. Kesri and P. Ku. Pattnaik.
“An Unique Solution for N queen Problem”.
International Journal of Computer
Applications.Vol:43 Issue:12 pp: 1-6, 2012.
[2] Gutiérrez-Naranjo, Miguel A., Martínez –
del - Amor Miguel A. , Pérez-Hurtado
Ignacio, and Pérez-Jiménez Mario J. February
02, 2009. “Solving the N-Queens Puzzle with
P Systems”, 7th Brainstorming Week on
Membrane Computing, volume 1, pp199-210.
[3] Letavec, C. and Ruggiero, J. 2002. “The n-
queen problem”, Informs Transaction on
Education, volume 2 number 3, May 2002.
[4] Uninformed Search Analysis of the N-queens
Problem, Ben Sauerwine, September 20,
2003. Available at:
http://www.andrew.cmu.edu/user/bsauerwi/re
search/P1.pdf
[5] Russell, S. and Norvig, P. “Artificial
Intelligence A Modern Approach”, Second
Edition, pp 139-140.
[6] Ellis Horowitz, Sartaj Sahni, Sanguthevar
Rajasekaran, “Fundamental of computer
Algorithm (pp 339)”.
[7] S.Ahmadi V. Kesri, and Va. Kesri.
“Clustering in backtracking for solution of N-
queen Problem”. Third International
Conference on Contemporary Issues in
Computer and Information Sciences CICIS
2012

Mais conteúdo relacionado

Destaque (20)

Hm3312981305
Hm3312981305Hm3312981305
Hm3312981305
 
Hg3312711275
Hg3312711275Hg3312711275
Hg3312711275
 
Im3115911596
Im3115911596Im3115911596
Im3115911596
 
Ir3116271633
Ir3116271633Ir3116271633
Ir3116271633
 
Ab34169175
Ab34169175Ab34169175
Ab34169175
 
Af34193199
Af34193199Af34193199
Af34193199
 
Ai34212218
Ai34212218Ai34212218
Ai34212218
 
A340105
A340105A340105
A340105
 
Ah34207211
Ah34207211Ah34207211
Ah34207211
 
Ac34176185
Ac34176185Ac34176185
Ac34176185
 
As35252256
As35252256As35252256
As35252256
 
Ap35235240
Ap35235240Ap35235240
Ap35235240
 
Ak35206217
Ak35206217Ak35206217
Ak35206217
 
An35225228
An35225228An35225228
An35225228
 
Ai35194197
Ai35194197Ai35194197
Ai35194197
 
Cv35547551
Cv35547551Cv35547551
Cv35547551
 
Di32687692
Di32687692Di32687692
Di32687692
 
Leyenda fuensanta
Leyenda fuensantaLeyenda fuensanta
Leyenda fuensanta
 
Presentacion Tequila Nock Premium
Presentacion Tequila Nock PremiumPresentacion Tequila Nock Premium
Presentacion Tequila Nock Premium
 
Guerra civil española Jose antonio diaz romero
Guerra civil española Jose antonio diaz romeroGuerra civil española Jose antonio diaz romero
Guerra civil española Jose antonio diaz romero
 

Semelhante a Ht3313461349

K means clustering algorithm
K means clustering algorithmK means clustering algorithm
K means clustering algorithmDarshak Mehta
 
Skiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracingSkiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracingzukun
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3AhsanIrshad8
 
Chapter 3: Linear Systems and Matrices - Part 2/Slides
Chapter 3: Linear Systems and Matrices - Part 2/SlidesChapter 3: Linear Systems and Matrices - Part 2/Slides
Chapter 3: Linear Systems and Matrices - Part 2/SlidesChaimae Baroudi
 
MODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxMODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxAlokSingh205089
 
12 Speed Gear Box Theory Notes by Prof. Sagar Dhotare
12 Speed Gear Box Theory Notes by Prof. Sagar Dhotare12 Speed Gear Box Theory Notes by Prof. Sagar Dhotare
12 Speed Gear Box Theory Notes by Prof. Sagar DhotareSagar Dhotare
 
Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2Vijayananda Mohire
 
Transportation and transshipment problems
Transportation  and transshipment problemsTransportation  and transshipment problems
Transportation and transshipment problemsDr. Adinath Damale
 
Calculating Mine Probability in Minesweeper
Calculating Mine Probability in MinesweeperCalculating Mine Probability in Minesweeper
Calculating Mine Probability in MinesweeperLukeVideckis
 
Matrices & Determinants
Matrices & DeterminantsMatrices & Determinants
Matrices & DeterminantsIshant Jain
 
Algorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation ProblemsAlgorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation ProblemsTina Gabel
 
Two algorithms to accelerate training of back-propagation neural networks
Two algorithms to accelerate training of back-propagation neural networksTwo algorithms to accelerate training of back-propagation neural networks
Two algorithms to accelerate training of back-propagation neural networksESCOM
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesOmprakash Chauhan
 
CI L11 Optimization 3 GlobalOptimization.pdf
CI L11 Optimization 3 GlobalOptimization.pdfCI L11 Optimization 3 GlobalOptimization.pdf
CI L11 Optimization 3 GlobalOptimization.pdfSantiagoGarridoBulln
 

Semelhante a Ht3313461349 (20)

DAA Notes.pdf
DAA Notes.pdfDAA Notes.pdf
DAA Notes.pdf
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Ma3bfet par 10.6 5 aug 2014
Ma3bfet par 10.6 5 aug 2014Ma3bfet par 10.6 5 aug 2014
Ma3bfet par 10.6 5 aug 2014
 
K means clustering algorithm
K means clustering algorithmK means clustering algorithm
K means clustering algorithm
 
Skiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracingSkiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracing
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
 
Chapter 3: Linear Systems and Matrices - Part 2/Slides
Chapter 3: Linear Systems and Matrices - Part 2/SlidesChapter 3: Linear Systems and Matrices - Part 2/Slides
Chapter 3: Linear Systems and Matrices - Part 2/Slides
 
MODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxMODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptx
 
N Queens problem
N Queens problemN Queens problem
N Queens problem
 
12 Speed Gear Box Theory Notes by Prof. Sagar Dhotare
12 Speed Gear Box Theory Notes by Prof. Sagar Dhotare12 Speed Gear Box Theory Notes by Prof. Sagar Dhotare
12 Speed Gear Box Theory Notes by Prof. Sagar Dhotare
 
Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2
 
Transportation and transshipment problems
Transportation  and transshipment problemsTransportation  and transshipment problems
Transportation and transshipment problems
 
Calculating Mine Probability in Minesweeper
Calculating Mine Probability in MinesweeperCalculating Mine Probability in Minesweeper
Calculating Mine Probability in Minesweeper
 
Matrices & Determinants
Matrices & DeterminantsMatrices & Determinants
Matrices & Determinants
 
Algorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation ProblemsAlgorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation Problems
 
1st Semester Physics Cycle (Dec-2015; Jan-2016) Question Papers
1st Semester Physics Cycle  (Dec-2015; Jan-2016) Question Papers1st Semester Physics Cycle  (Dec-2015; Jan-2016) Question Papers
1st Semester Physics Cycle (Dec-2015; Jan-2016) Question Papers
 
Two algorithms to accelerate training of back-propagation neural networks
Two algorithms to accelerate training of back-propagation neural networksTwo algorithms to accelerate training of back-propagation neural networks
Two algorithms to accelerate training of back-propagation neural networks
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Simplex method
Simplex methodSimplex method
Simplex method
 
CI L11 Optimization 3 GlobalOptimization.pdf
CI L11 Optimization 3 GlobalOptimization.pdfCI L11 Optimization 3 GlobalOptimization.pdf
CI L11 Optimization 3 GlobalOptimization.pdf
 

Último

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Ht3313461349

  • 1. Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and Applications (IJERA) ISSN: 2248-9622 www.ijera.com Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349 1346 | P a g e A new approach to solve n-queens problem based on series Vishal Kesri, Manoj Kumar Mishra School of Computer Engineering KIIT University, India Abstract The N-queens problem is a popular classic puzzle where numbers of queen were to be placed on an n x n matrix such that no queen can attack any other queen. The Branching Factor grows in a roughly linear way, which is an important consideration for the researchers. However, many researchers have cited the issues with help of artificial intelligence search patterns say DFS, BFS and backtracking algorithms. The proposed algorithm is able to compute one unique solution in polynomial time when chess board size is greater than 7. This algorithm is based on 8 different series. For each series a different approach is taken to place the queen on a given chess board. General Terms: N-Queen, Knight move, NP- hard. Keywords: Analyzer, Move, Rule, Partz. I. INTRODUCTION The n-queens problem is proposed for the first time in 1850 by Carl Gauss. It is to determine a placement of n queens on an n × n chessboard, such that no two queens can attack each other [3]. This problem falls in a special class of problems well known as NP hard, whose solution cannot be found out in polynomial time. Let’s consider the 8-queen problem, which is computationally very expensive since the total number of possible arrangements queen is 64! / (56! x 8!) ~ 4.4 x 109 and the total number of possible solutions are 92 [1]. But there exists only 12 unique solutions. There are some solutions that are to be the same and can be obtained one from the other by taking rotations or symmetry. The n-queen problem follows the same rules as in 8- queen problem with N queens and an n x n chessboard. Current knowledge of total number of solutions of n-queens problem can be viewed from the Table 1. A. Applications The N-queen problem can be applied in many different areas, like parallel memory storage schemes, VLSI testing, traffic control and deadlock prevention. It is also applicable to find solutions of those problems which require permutations like travelling salesman problem [1]. N: Unique Solution Distinct Solution 1 1 1 2 0 0 3 0 0 4 1 2 5 2 10 6 1 4 7 6 40 8 12 92 9 46 352 10 92 724 11 341 2680 12 1787 14200 13 9233 73712 14 45752 365596 Table 1: The number of total and unique solutions for the N-Queens problem II. N-QUEENS PROBLEM DEFINATION The n-queens Problem of size n, where need to place n queen into n × n chessboard, so that no two queen can attack each other that is no two of them are on the same row, column, or diagonal. Therefore the rules to obtain the solution of n- queens problem are follows [5]: 1. Only one queen can placed in each row 2. Only one queen can placed in each column 3. At any time maximum one queen can be in the diagonal. Suppose two queen are placed at position (i, j) and (k, l). Then they are on the same diagonal only if A. Notation Here some notations are defined, which are used in the propose algorithm .These notations are defined in table 2. Symbols Definition S1 Positive Integer Series-A1 S2 Positive Integer Series-A2 S3 Positive Integer Series-A3 S4 Positive Integer Series-A4
  • 2. Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and Applications (IJERA) ISSN: 2248-9622 www.ijera.com Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349 1347 | P a g e S5 Positive Integer Series-A5 S6 Positive Integer Series-A6 S7 Positive Integer Series-A7 S8 Positive Integer Series-A8 R1 Rule-1, used to get the solution. R2 Rule-2, used to get the solution. MV1 It is first move function, which defines the pattern of placing the queens. MV2 It is second move function, which defines the pattern of placing the queens. MV3 It is third move function, which defines the pattern of placing the queens. ‘n’ Given number of queen (Input Size) ‘Cij’ Cell position of the chess board. Table-2: List of Symbols III. SERIES The Proposed algorithm is a combination of two rules and eight distinct series. These series are given below: A. Series- A1 The Series- A1 is used to get the solution such that: B. Series- A2 The Series- A2 is used to get the solution such that: C. Series- A3 The Series- A3 is used to get the solution such that: D. Series- A4 The Series- A4 is used to get the solution such that: E. Series- A5 The Series- A6 is used to get the solution such that: F. Series- A6 The Series- A6 is used to get the solution such that: G. Series- A7 The Series- A7 is used to get the solution such that: H. Series- A8 The Series- A8 is used to get the solution such that: IV. RULES There are two Rules, which is used with a particular series to achieve a solution for a given chess board. Some series do not need any of the rules, such as Series-A. Analyzer: The core of these rules is an analyzer function. The function of the analyzer is described as below. Step-1: initialize the cell ‘Cij’ of chess board to zero, except where, ‘Cij’ already acquired by a queen. 0 Q 0 0 0 0 0 0 0 Q 0 0 0 0 0 0 0 0 0 0 0 0 Q 0 0 Figure-1: Put Zero in remaining ‘Cij’ Step-2: In the beginning take any queen and add ‘1’ to the value of its attacking cells. Then this step is repeated for each queen as shown in figure 2. 1 Q 3 2 2 2 2 3 2 Q 2 3 3 3 2 1 2 2 2 3 1 2 Q 1 2 Figure-2: The value of each ‘Cij’ after step 2 The ‘Cij’ values shown in the figure 2 indicates that the position Cij is attacked by that many queens e.g. ‘C23’ has an integer value 3, that means this cell is attacked by 3 different queens e.g. by C12 ,C25 ,C53.
  • 3. Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and Applications (IJERA) ISSN: 2248-9622 www.ijera.com Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349 1348 | P a g e First Rule: First rule is applied to find the solution lies in the series S2 from the solution of S1. Algorithm of First Rule is described below: Algorithm for “Rule” Step-1: If the solution falls in any one of the series (S1, S3) Step-2: Increase the dimension of the chess board by one, that is row +1 and column +1 Step-4: Call Analyzer function with this updated dimensions Step-5: Place a queen, where “Cij= =0” Algorithm-1: Describe Steps of first Rule Second Rule: Second rule is applied to find the solution lies in the series S6 from the solution of S5. The conditions for the second rule is “remove the queen from Cij If Cin = = C1j = = 1 and |i-1| ≠ |n-j|. And place queens at the positions C1j and Cin. Algorithm of second Rule is described below: Algorithm of Second Rule Step-1: If the solution falls in any one of the series (S5) Step-2: Increase the dimension of the chess board by one, that is row +1 and column +1 Step-3: Call Analyzer function with this updated dimensions Step-4: Remove Queen from Cij Step-5: Call Analyzer function with this updated dimensions Step-6: Place queen, where “Cij= =0” Algorithm-2: Describe Steps of second Rule Table 3 show which series those rules apply: S1 S2 S3 S4 S5 S6 S7 S8 R1         R2         Table-3 V. Move Function MV function shows us the pattern of placing queen on chess board. There is three Move Functions defined namely MV1, MV2 and MV3. The move function along with a particular series defines the placement of queens on the chess board. The algorithm for placing queen according to pattern is described below: Move-1: This function increases the row value of the chess board by 3 and reduces the column value by 1. Algorithm-3 for MV1 is given below. Algorithm for “MV1” /* The Place of first queen depend on series */ /* i = row value */ Cij Place First Queen fora=1 to a ≤ n i = i+3; j = j-1; Cij Place Queen a = i; Algorithm-3: Algorithm for MV1 function Move-2: This function increases the row value of the chess board by 2 and reduces the column value by 1. Algorithm-4 for MV2 is given below. Algorithm for “MV2” /* The Place of first queen depend on series */ /* i = row value */ Cij Place First Queen fora=1 to a ≤ n i = i+2; j = j-1; Cij Place Queen a = i; Algorithm-4: Algorithm for MV2 function Move-3: This function decreases the row value of the chess board by 2 and increase column value by 3 or decrease column value by 1. Algorithm-5 for MV3 is given below. Algorithm for “MV3” /* The Place of first queen depend on series */ /* i = row value, j = Column */ count = 0; Cij Place First Queen fora=n to a ≥ 1 i = i-2; if (count % 2 =0 ) j = j+3; else j = j-1; Cij Place Queen a = i; Algorithm-5: Algorithm for MV3 function
  • 4. Vishal Kesri, Manoj Kumar Mishra / International Journal of Engineering Research and Applications (IJERA) ISSN: 2248-9622 www.ijera.com Vol. 3, Issue 3, May-Jun 2013, pp. 1346-1349 1349 | P a g e Table-4 shows, which move function is applied on what series. S1 S2 S3 S4 S5 S6 S7 S8 MV1         MV2         MV3         Table-4 Algorithm for n-queens The proposed algorithm finds a unique solution of n-queens problem, which is described below: Algorithm to solve n-queens Problem Step1: Step2: If { Call “MV1”, where i = 1 && j = n/3 Call “MV1”, where i = 2 && j = (n/3) *2 Call “MV1”, where i = 3 && j = n } Step3: If { Get the solution of “n-1” chess board /* n-1 chess board ∈ S1 */ Apply ‘R1’ } Step4: If { Call “MV1”, where i = 2 && j = (n-1)/3 Call “MV1”, where i = 1 && j = (n-1/3) *2+1 Call “MV1”, where i = 3 && j = n } Step5: If { Get the solution of “n-1” chess board /* n-1 chess board ∈ S3 */ Apply ‘R1’ } Step6: If { Call “MV2”, where i = 1 && j = n/2 Call “MV3”, where i = n && j = (n/2) + 2 } Step7: If { Call “MV2”, where i = 2 && j = (n-1)/2 Call “MV3”, where i = n && j = (n-1)/2 +2 Apply ‘R2’ } Step8: If { Call “MV2”, where i = 1 && j = (n/2) + 1 Call “MV3”, where i = n && j = (n/2) + 3 Place Queen At Cij, Where i = 2 && j = 1 } Step9: If { Call “MV2”, where i = 1 && j = (n-1) /2+2 Call “MV3”, where i = n && j = (n-1) /2) + 4 Place Queen At Cij, Where i = 1 && j = 1 Place Queen At Cij, Where i = 3 && j = 2 } Algorithm-6: Algorithm for Calculate Solution of N-Queen VI. DISADVANTAGE The proposed algorithm provides only one unique solution when chess board size is greater than 7 and the algorithm is not able to provide all the solutions. By Rotation of chess board we can get few more solutions but those solutions are not distinct. VII. CONCLUSION AND FUTURE WORK This Algorithm provides only one unique solution for n > 7. This method can be enhanced in future to find all other solutions. REFERENCES [1] V. Kesri, Va. Kesri and P. Ku. Pattnaik. “An Unique Solution for N queen Problem”. International Journal of Computer Applications.Vol:43 Issue:12 pp: 1-6, 2012. [2] Gutiérrez-Naranjo, Miguel A., Martínez – del - Amor Miguel A. , Pérez-Hurtado Ignacio, and Pérez-Jiménez Mario J. February 02, 2009. “Solving the N-Queens Puzzle with P Systems”, 7th Brainstorming Week on Membrane Computing, volume 1, pp199-210. [3] Letavec, C. and Ruggiero, J. 2002. “The n- queen problem”, Informs Transaction on Education, volume 2 number 3, May 2002. [4] Uninformed Search Analysis of the N-queens Problem, Ben Sauerwine, September 20, 2003. Available at: http://www.andrew.cmu.edu/user/bsauerwi/re search/P1.pdf [5] Russell, S. and Norvig, P. “Artificial Intelligence A Modern Approach”, Second Edition, pp 139-140. [6] Ellis Horowitz, Sartaj Sahni, Sanguthevar Rajasekaran, “Fundamental of computer Algorithm (pp 339)”. [7] S.Ahmadi V. Kesri, and Va. Kesri. “Clustering in backtracking for solution of N- queen Problem”. Third International Conference on Contemporary Issues in Computer and Information Sciences CICIS 2012