Artificial Intelligence Programming Assignment

Problem Statements

Eight-Queens Puzzle

Is it possible to place eight Queens on a chessboard, so that none of the Queens occupy the same row, column, or diagonal?

Binary Search

Depth-First & Breadth-First Search

Newton’s Method

Take a number whose square root is to be calculated, any positive number.

Take a guess at the number’s square root.

Calculate the square root by improving on the current guess as indicated:

Next guess = (number/ current guess + current guess)/ 2

Repeat this process until the difference between the next guess and the current is within the accepted level of accuracy. The better your guess, the fewer the number of iterations needed to get the square root. A good first guess is typically half the number whose square root is to be calculated. The process is ten repeated until the desired accuracy is achieved.

Newton-Raphson Method

Determine a root of the equation f(x) = x^3-x^2-9x+9 = 0 using the Newton-Raphson method if the initial guess is x1 = 1.5.

Gauss-Siedel Method

Solve the following set of linear simultaneous equations using the Gauss-Seidel method:

10x1 + 2x2 + 3x3 = 11

X1 + 5x2 + 2x3 = 20

3x1 + 2x2 + 6x3 = -12

Theoretical Solutions

Eight-Queens Puzzle

1. Pick a position for the Queen

2. If legal, go to next row.

3. If illegal, pick the next position.

4. If no legal position is found, back up to one row.

If legal positions are found for all eight rows, the problem is solved.

Binary Search

• Search the current node value to see if it equals the search value.

• If the search value is smaller than the current value, make the current node the

left child node.

• Make the current node the right child node.

Depth-First & Breadth-First Search

Depth-First Search:

• Searches as far down the left side of the binary tree.

• When it encounters, NULL, the search switches to the bottom-most right child and

resumes.

Breadth-First Search:

• Remove a node from the queue. This becomes the current node.

• Place all child nodes of the current node onto the queue.

Newton’s Method

• Get a positive number whose square root is to be calculated from the user.

• Get the desired precision.

• While more numbers remain, calculate firs guess, x0.

• Repeat

Xn = 0.5 * (X (n-1) + Number/ X (n-1))

Until abs (Xn - X (n – 1)) *= Desired precision

Get a positive number whose square root is to be calculated from the user.

Get the desired precision.

End while

Newton-Raphson Method

1. Set number of iterations num_iter to zero.

Problem Statements

Eight-Queens Puzzle

Is it possible to place eight Queens on a chessboard, so that none of the Queens occupy the same row, column, or diagonal?

Binary Search

Depth-First & Breadth-First Search

Newton’s Method

Take a number whose square root is to be calculated, any positive number.

Take a guess at the number’s square root.

Calculate the square root by improving on the current guess as indicated:

Next guess = (number/ current guess + current guess)/ 2

Repeat this process until the difference between the next guess and the current is within the accepted level of accuracy. The better your guess, the fewer the number of iterations needed to get the square root. A good first guess is typically half the number whose square root is to be calculated. The process is ten repeated until the desired accuracy is achieved.

Newton-Raphson Method

Determine a root of the equation f(x) = x^3-x^2-9x+9 = 0 using the Newton-Raphson method if the initial guess is x1 = 1.5.

Gauss-Siedel Method

Solve the following set of linear simultaneous equations using the Gauss-Seidel method:

10x1 + 2x2 + 3x3 = 11

X1 + 5x2 + 2x3 = 20

3x1 + 2x2 + 6x3 = -12

Theoretical Solutions

Eight-Queens Puzzle

1. Pick a position for the Queen

2. If legal, go to next row.

3. If illegal, pick the next position.

4. If no legal position is found, back up to one row.

If legal positions are found for all eight rows, the problem is solved.

Binary Search

• Search the current node value to see if it equals the search value.

• If the search value is smaller than the current value, make the current node the

left child node.

• Make the current node the right child node.

Depth-First & Breadth-First Search

Depth-First Search:

• Searches as far down the left side of the binary tree.

• When it encounters, NULL, the search switches to the bottom-most right child and

resumes.

Breadth-First Search:

• Remove a node from the queue. This becomes the current node.

• Place all child nodes of the current node onto the queue.

Newton’s Method

• Get a positive number whose square root is to be calculated from the user.

• Get the desired precision.

• While more numbers remain, calculate firs guess, x0.

• Repeat

Xn = 0.5 * (X (n-1) + Number/ X (n-1))

Until abs (Xn - X (n – 1)) *= Desired precision

Get a positive number whose square root is to be calculated from the user.

Get the desired precision.

End while

Newton-Raphson Method

1. Set number of iterations num_iter to zero.

Related

- Satisfactory Essays
* Question 1. Write pseudocode (not Java code) for Prim's algorithm that we discussed in class. Beside each step, write the number of external I/O, memory I/O, incrementation, comparison, and other types of operations employed. Note in the above description that Prim's algorithm (for MST) is to be used, not Dijkstra's (for Shortest Path). The use of Dijkstra's was a typo...my apologies... Then, construct a work budget for each type of operation, together with a Big-Oh estimate of complexity for each of the following graph representations: (a) adjacency matrix, (b) edge list, and (c) adjacency list.

- 408 Words
- 1 Pages

Satisfactory Essays - Satisfactory Essays
To get credit, you must explain your answer in 1-2 sentences. * Question 2. Given the sequence S = {-9, 2, 4, 6, 30, -10, 1, 5, 8, 7}, (a) [1 point] Diagram a binary search tree (BST) for this sequence. (b) [1 point] Insert the values -46, -47, 38, 39, 40, and 45 into the BST you diagrammed in Question 2a) and draw the new BST (the resultant tree, after all values are inserted). (c) [1 point] Using the array representation of a binary tree that we discussed in class, diagram the array representation of the tree you obtained in Question 2a).

- 654 Words
- 2 Pages

Satisfactory Essays - Good Essays
## Reverse Delelete Algorithm: An Analysis Of Retente Algorithm

- 828 Words
- 2 Pages

1) The highest weighted edge is CD its weight is 14. According to reverse delete algorithm we can delete this edge. C D 2) Now the second highest weighted edge point is AB its weight is 10. So we can delete this edge. A B 3) Now the third highest weighted edge point is ED its weight is 9.But we can delete it because D is disconnected with the Graph.

- 828 Words
- 2 Pages

Good Essays - Good Essays
## An Exploration of the Theoretical Support of the 24 Game

- 753 Words
- 2 Pages

( a ⋇ b ) ⋇ ( c ⋇ d ) By calculating the 24 permutations above, and swap ⋇ with +, -, ×, ÷, it is possible for a computer program to obtain and record every unsolvable combinations. According to the data, there are 458 unsolvable combinations out of the total 1820 results. Hence, the probability of a random picked combination that can be solved is ((1820-458))/1820 × 100%≈ 74.84% However, the result above is only the theoretic result. Although in the game, suits do not matter, in realistic calculation the change in suits has to be counted. A study of the unsolvable question 4 cards 3 same 1 different 2 same 2 different 2 same the other 2 same 4 different Total Unsolvable Questions 8 70 33 239 108 458

- 753 Words
- 2 Pages

Good Essays - Satisfactory Essays
## Growing Squares

- 854 Words
- 2 Pages

The diagrams numbers squared added to one less than the diagram number squared gives the correct number of squares. For diagram n it should be: Un = (n - 1) 2 + n2 (n - 1)(n - 1) + n2 n2 - n - n - n + 1 + n Un = 2n2 - 2n + 1 This is correct. Growing Hexagons I will now repeat my investigation, and change the original shape of the square to hexagons, and try to find the formula as before. I shall start by finding the

- 854 Words
- 2 Pages

Satisfactory Essays - Satisfactory Essays
## Hash Essay

- 756 Words
- 2 Pages

It uses three 64 bit registers a, b and c for intermediate hash values. Also each 512 bit blocks is divided into 8 , 64 bits words. It consists of the following stages:- save_abc, pass(a,b,c,5), key_schedule, pass(c,a,b,7),key _schedule, pass(b,c,a,9) and feedforward. Save_abc saves the initial value so that it will be used later on feedforward.Each pass consists of 8 rounds and uses multiplier of 5 ,7 and 9 to redistribute bits between s-box lookups. The round function will then generate new values using the following algorithm.

- 756 Words
- 2 Pages

Satisfactory Essays - Satisfactory Essays
## Finding the Hidden Faces of a Cube

- 801 Words
- 2 Pages

In order to work out the number of hidden faces I found the total number of faces and took away the number of visible faces, which equals to 6n-(3n+2), which is equal to 3n-2. I will now test 3n-2 to show that it is correct. Foucault denied 11r's rationalisation idea. [IMAGE] I can see that 3%n is 3%6 and then I will minus 2. So 3%6-2 = 16, which is correct, so I now know that the formula is correct.

- 801 Words
- 2 Pages

Satisfactory Essays - Good Essays
## Mental Rotation : A Classic Cognitive Psychology Paradigm

- 1612 Words
- 4 Pages

Interestingly, reaction time doesn 't depend on which axes the shapes are rotated along, it only depends on the total amount of rotation. So, are the shapes in Fig. 12.5 the same or mirror images of each other? It 's a hard task, right? As with the mental map experiments, the fact that reaction time depends directly on the degree of rotation has been taken as evidence that we solve the... ... middle of paper ... ...as about the same in each case (roughly 10%).

- 1612 Words
- 4 Pages

Good Essays - Satisfactory Essays
## Programming

- 668 Words
- 2 Pages

a. AND b. AND/OR c. OR d. OR/AND Save answer Bottom of Form Question 13 (1 point) A path that can never be traveled is known as a dead or __________ path. a. unreachable b. unusable c. closed d. useable Save answer Bottom of Form Question 14 (1 point) How many AND and OR statements can you combine in most programming languages? a. one b. two c. three d. as many as you need Save answer Bottom of Form Question 15 (1 point) Case structures are used when you have a series of __________ based on the value stored in a single variable.

- 668 Words
- 2 Pages

Satisfactory Essays - Satisfactory Essays
## Beyond Pythagoras Investigation

- 4849 Words
- 10 Pages

Beyond Pythagoras Investigation In this investigation, I am trying to find the rules and patterns for right-angled triangles. Each length of the right-angle triangle is going to be a positive integer, and the shortest length is going to be an odd number. Below is a typical type of a Pythagoras triple equation: [IMAGE] Formula:a² + b² = c² 3² + 4² = 5² 9 + 16 = 25 In this equation, the first step I took was to put the numbers instead of the letters. Once I did that I squared all the numbers, and when I add a² + b² it equaled to c². Incase one of the numbers was missing on the triangle; I would replace that as x², and carry out the formula as a normal algebraic expression.

- 4849 Words
- 10 Pages

Satisfactory Essays