[ad_1]
COMP 2019 Artificial Intelligence Java Assignment
This assignment consists of two parts. In the first part, you will implement a version of the A* algorithm for path finding; in the second part, you will tackle a more difficult variant of the same problem.
Question 1 Consider the example of a simple game where agents move on a rectangular world map:
Your agent has been dropped at the location (5,7) marked ‘S’ and must reach the goal (the location (0,0) marked ‘G’) as quickly as possible. Your agent’s movements are restricted to the four primary directions: North, South, East, and West, and the agent must stay within the bounds of the map.
Each location is annotated with a 0 (white background cells in the figure above) or a 1 (green background cells in the figure). Locations annotated with a 0 can be entered and traversed, whereas locations annotated with a 1 are inaccessible. Each action (moving from one cell to an adjacent cell) incurs a cost of 1. The cost for a path is the number of actions on the path. The unique best path in the example above is (5,7)(6,7)(6,8)(6,9)(5,9)(4,9)(3,9)(2,9)(2,8)(2,7)(1,7)(0,7)(0,6)(0,5)(0,4)(0,3)(0,2)(0,1)(0,0) and has a path cost of 18.
Create a Java program that uses the A* algorithm to find a shortest path for an agent given the agent’s Start- and goal locations and a world map showing the terrain accessibility at each location. If there are multiple shortest paths for a given map and agent, it is sufficient if your program finds one of the paths. You will need to pick a suitable heuristic function. The program must calculate the path and the total path cost.
Your program must be able to process any valid grid map and start and goal locations.
Your program should be as efficient as possible when using A* (in terms of the number of visited search states).
You are given sample code that reads the world map and establishes the classes and interfaces you must use for this assignment. Your code will be tested automatically and will break if you don’t adhere to the given framework.
Your program can be run either via the JUnit tests, or from the terminal. For example:
COMP 2019 Artificial Intelligence Java Assignment
Question 2 In this question you will implement cooperative pathfinding for multiple agents. This problem is more difficult as agents can obstruct the paths of other agents. Each agent must take the paths of other agents into account when planning its own path. We will consider the simplest variant of this idea, where each agent has a fixed priority and agents plan their paths in order of priority. Lower numerals denote higher priority; for example, Agent 1 has higher priority than Agent 3. Thus, the agent with the highest priority can usually follow its optimal path, whereas agents with lower priorities may need to take detours to accommodate the paths of agents with higher priority. Moreover, an agent may need to wait at a location until another agent has moved out of their way. A ‘Wait’ action is introduced for this purpose. Waiting at a location incurs a cost of 1.
For example, consider three agents who concurrently navigate the map given below:
Agent 0 (blue) starts in location (1,1) and aims to reach goal location (0,3). Agent 1 (red) starts in location (1,2) and aims to go to (1,1). Agent 2 (purple) starts in (3,3) and aims to go to (2,3). Suppose that Agent 0 has highest priority and gets to choose its path first, then Agent 1 gets to plan its path, and then Agent 2. According to A*, Agent 0 will travel along the path (1,1)(1,2)(1,3)(0,3) at cost 3. Although Agent 1 is only one step away from its goal location, the direct path (1,2)(1,1) is not feasible, as this would entail a head-on collision with Agent 0. Moreover, Agent 1 in its initial position obstructs Agent 0’s chosen path. Hence Agent 1 must move out of the way and take a different route. The shortest path for Agent 1 is (1,2)(1,3)(2,3)(1,3)(1,2)(1,1) at cost 5. Similarly, Agent 2 waits (for 2 time steps) in (3,3) until Agent 1 has entered and exited location (2,3). Its path is therefore (3,3)(3,3)(3,3)(2,3) at cost 3. (Alternatively, Agent 2 could use path (3,3)(2,3)(3,3)(2,3) or (3,3)(3,2)(3,3)(2,3), which bear the same cost.)
The Hierarchical Cooperative A* (HCA*) algorithm is capable of calculating paths for multiple moving agents. The HCA* algorithm improves upon the basic A* algorithm by considering which locations are occupied by agents at each time step. These locations are then treated as (temporary) obstacles when searching for other agents’ paths. COMP 2019 Artificial Intelligence Java Assignment
Need Help with a similar Assignment?
What Students Are Saying About Us
.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐"Honestly, I was afraid to send my paper to you, but splendidwritings.com proved they are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"
.......... Customer ID: 14***| Rating: ⭐⭐⭐⭐⭐
"The company has some nice prices and good content. I ordered a term paper here and got a very good one. I'll keep ordering from this website."