Search Space 0 9 B G1 3 5 o 2 G2 3 9 C 5 5 A 8 7 4 Н. 6 H 8 D 1 2 2 G3 2 7 O 6 E 6 5 public class MyClass { public sta

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Search Space 0 9 B G1 3 5 o 2 G2 3 9 C 5 5 A 8 7 4 Н. 6 H 8 D 1 2 2 G3 2 7 O 6 E 6 5 public class MyClass { public sta

Post by answerhappygod »

 1
1 (141.55 KiB) Viewed 29 times
Follow the instructions below during the implementation of your
software program.
The actual path-cost values in the search space is entered to
the java program as an n x n square matrix, as shown in the
template program at the end of the assignment.
For example: The search space in Figure 2.1 below is represented
by the following 10 x 10 matrix
From/to
A
B
C
D
E
H
J
G1
G2
G3
A
0
0
0
6
1
0
0
0
0
0
B
5
0
2
0
0
0
0
0
0
0
C
9
3
0
0
0
0
0
0
0
0
D
0
0
1
0
2
0
0
0
0
0
E
6
0
0
0
0
2
0
0
0
0
H
0
0
0
7
0
0
0
0
0
0
J
0
0
0
0
2
0
0
0
0
0
G1
0
9
0
0
0
0
0
0
0
0
G2
0
0
0
5
0
0
0
0
0
0
G3
0
0
0
0
0
8
7
0
0
0
The heuristic values of all states are represented by an n-size
vector, as shown in the template program at the end of the
assignment.
For example, the heuristic vector of the search space in Figure
2.1 is represented by the following vector:
S = {5,7,3,4,6,8,5,0,0,0}
The program uses A* search algorithm to find the cheapest path
from the start state to one of the goal states. The goal states are
the ones with 0 value in the heuristic vector.
The software program should print out the cheapest path, the
goal state, and the number of cycles it took to reach the final
goal state.
Use the template below:
 2
2 (20.74 KiB) Viewed 29 times
Search Space 0 9 B G1 3 5 o 2 G2 3 9 C 5 5 A 8 7 4 Н. 6 H 8 D 1 2 2 G3 2 7 O 6 E 6 5
public class MyClass { public static void main(String args[]) { int[][] cost_matrix = {{0,0,0,6,1,0,0,0,0,0}, {5,0,2,0,0,0,0,0,0,0}, {9,3,0,0,0,0,0,0,0,0}, {0,0,1,0,2,0,0,0,0,0}, {6,0,0,0,0,2,0,0,0,0}, {0,0,0,7,0,0,0,0,0,0}, {0,0,0,0,2,0,0,0,0,0}, {0,9,0,0,0,0,0,0,0,0}, {0,0,0,5,0,0,0,0,0,0}, {0,0,0,0,0,8,7,0,0,0}}; int[] heuristic vector = {5,7,3,4,6,8,5,0,0,0); // Identify the Goal States and save them in a new vector // Write a program to implement the A* search // Print the cheapest path, the goal state and the number of cycles } }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply