<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS607 Assignment 2 Solution and Discussion]]></title><description><![CDATA[<p dir="auto">Assignment No. 02<br />
Semester: Fall 2019<br />
CS607: Artificial Intelligence<br />
Total Marks: 20</p>
<p dir="auto">Due Date:29/11/2019</p>
<p dir="auto">Instructions<br />
It should be clear that your assignment will not get any credit if:<br />
	The assignment is submitted after the due date.<br />
	The submitted assignment does not open or the file is corrupt.<br />
	The Solution is copied from any other source.<br />
Objective<br />
The objective of this assignment is to;<br />
	Learn and practice basic concepts of Eight Queen problem.<br />
	Basic understanding of Knowledge representation through graph.</p>
<p dir="auto">Assignment</p>
<p dir="auto">Question No. 1</p>
<p dir="auto">Consider the Eight-Queen problem to use representation and strategy on chess board. Show the positions of Individuals on chess board table and calculate the fitness values for both individuals in first iteration. The individuals (board positions) are given below:<br />
(a)  47285421<br />
(b)  52416782</p>
<p dir="auto">Question No. 2</p>
<p dir="auto">Given the following information you are required to represent it by using the graph.<br />
o	Zulfiqar is Hussain’s Father<br />
o	Zahra is Hussain’s Mother<br />
o	Hussain is Zulfiqar and Zahra‘s Son</p>
<p dir="auto">You are required to submit your solution through LMS as an MS Word document.</p>
]]></description><link>https://community.secnto.com//topic/706/cs607-assignment-2-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 22:42:07 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/706.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 29 Nov 2019 08:02:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS607 Assignment 2 Solution and Discussion on Fri, 29 Nov 2019 08:58:18 GMT]]></title><description><![CDATA[<p dir="auto"><img src="https://i.imgur.com/PrCtGDT.png" alt="75e800c4-734a-4da0-b7f2-a70a573e7d3d-image.png" class=" img-fluid img-markdown" /><br />
<img src="https://i.imgur.com/kzcb3Ji.png" alt="e7566592-ccf8-4238-a3cf-7c0cc878a0c5-image.png" class=" img-fluid img-markdown" /> <img src="https://i.imgur.com/KgtNbic.png" alt="1be27094-ad83-452a-975c-3699e530e275-image.png" class=" img-fluid img-markdown" /> <img src="https://i.imgur.com/LSn7LA0.png" alt="94972566-8dda-4699-b28e-bbfe10bb71f2-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.secnto.com//post/2018</link><guid isPermaLink="true">https://community.secnto.com//post/2018</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Fri, 29 Nov 2019 08:58:18 GMT</pubDate></item><item><title><![CDATA[Reply to CS607 Assignment 2 Solution and Discussion on Fri, 29 Nov 2019 08:46:04 GMT]]></title><description><![CDATA[<ul>
<li>
<p dir="auto">For the 1st Queen, there are total 8 possibilities as we can place 1st Queen in any row of first column. Let’s place Queen 1 on row 3.</p>
</li>
<li>
<p dir="auto">After placing 1st Queen, there are 7 possibilities left for the 2nd Queen. But wait, we don’t really have 7 possibilities. We cannot place Queen 2 on rows 2, 3 or 4 as those cells are under attack from Queen 1. So, Queen 2 has only 8 – 3 = 5 valid positions left.</p>
</li>
<li>
<p dir="auto">After picking a position for Queen 2, Queen 3 has even fewer options as most of the cells in its column are under attack from the first 2 Queens.</p>
</li>
</ul>
]]></description><link>https://community.secnto.com//post/2017</link><guid isPermaLink="true">https://community.secnto.com//post/2017</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Fri, 29 Nov 2019 08:46:04 GMT</pubDate></item><item><title><![CDATA[Reply to CS607 Assignment 2 Solution and Discussion on Fri, 29 Nov 2019 08:10:22 GMT]]></title><description><![CDATA[<p dir="auto">Dear Students for Queen Problem Solution Please contact in <a href="https://cyberian.pk/videochat" target="_blank" rel="noopener noreferrer nofollow ugc">Live Chat</a>!</p>
]]></description><link>https://community.secnto.com//post/2014</link><guid isPermaLink="true">https://community.secnto.com//post/2014</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Fri, 29 Nov 2019 08:10:22 GMT</pubDate></item><item><title><![CDATA[Reply to CS607 Assignment 2 Solution and Discussion on Fri, 29 Nov 2019 08:35:09 GMT]]></title><description><![CDATA[<pre><code>/* C/C++ program to solve N Queen Problem using 
backtracking */
#define N 4 
#include &lt;stdbool.h&gt; 
#include &lt;stdio.h&gt; 

/* A utility function to print solution */
void printSolution(int board[N][N]) 
{ 
	for (int i = 0; i &lt; N; i++) { 
		for (int j = 0; j &lt; N; j++) 
			printf(" %d ", board[i][j]); 
		printf("\n"); 
	} 
} 

/* A utility function to check if a queen can 
be placed on board[row][col]. Note that this 
function is called when "col" queens are 
already placed in columns from 0 to col -1. 
So we need to check only left side for 
attacking queens */
bool isSafe(int board[N][N], int row, int col) 
{ 
	int i, j; 

	/* Check this row on left side */
	for (i = 0; i &lt; col; i++) 
		if (board[row][i]) 
			return false; 

	/* Check upper diagonal on left side */
	for (i = row, j = col; i &gt;= 0 &amp;&amp; j &gt;= 0; i--, j--) 
		if (board[i][j]) 
			return false; 

	/* Check lower diagonal on left side */
	for (i = row, j = col; j &gt;= 0 &amp;&amp; i &lt; N; i++, j--) 
		if (board[i][j]) 
			return false; 

	return true; 
} 

/* A recursive utility function to solve N 
Queen problem */
bool solveNQUtil(int board[N][N], int col) 
{ 
	/* base case: If all queens are placed 
	then return true */
	if (col &gt;= N) 
		return true; 

	/* Consider this column and try placing 
	this queen in all rows one by one */
	for (int i = 0; i &lt; N; i++) { 
		/* Check if the queen can be placed on 
		board[i][col] */
		if (isSafe(board, i, col)) { 
			/* Place this queen in board[i][col] */
			board[i][col] = 1; 

			/* recur to place rest of the queens */
			if (solveNQUtil(board, col + 1)) 
				return true; 

			/* If placing queen in board[i][col] 
			doesn't lead to a solution, then 
			remove queen from board[i][col] */
			board[i][col] = 0; // BACKTRACK 
		} 
	} 

	/* If the queen cannot be placed in any row in 
		this colum col then return false */
	return false; 
} 

/* This function solves the N Queen problem using 
Backtracking. It mainly uses solveNQUtil() to 
solve the problem. It returns false if queens 
cannot be placed, otherwise, return true and 
prints placement of queens in the form of 1s. 
Please note that there may be more than one 
solutions, this function prints one of the 
feasible solutions.*/
bool solveNQ() 
{ 
	int board[N][N] = { { 0, 0, 0, 0 }, 
						{ 0, 0, 0, 0 }, 
						{ 0, 0, 0, 0 }, 
						{ 0, 0, 0, 0 } }; 

	if (solveNQUtil(board, 0) == false) { 
		printf("Solution does not exist"); 
		return false; 
	} 

	printSolution(board); 
	return true; 
} 

// driver program to test above function 
int main() 
{ 
	solveNQ(); 
	return 0; 
} 

</code></pre>
]]></description><link>https://community.secnto.com//post/2013</link><guid isPermaLink="true">https://community.secnto.com//post/2013</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Fri, 29 Nov 2019 08:35:09 GMT</pubDate></item></channel></rss>