7COM1034: Artificial Intelligence – Search and Bayesian Update – A Whale Watching Scenario – Python Assignment Help

Responsive Centered Red Button

Need Help with this Question or something similar to this? We got you! Just fill out the order form (follow the link below), and your paper will be assigned to an expert to help you ASAP.

7COM1034: Artificial Intelligence Assignment Help
Task:
Task: Search | Decanting Problem
1.1     Description
The task consists of programming a Python implementation of a solver for the Decanting Task.
1.1.1    Example
Assume you have 3 vessels, vessel 1 capable of holding 5 litres of milk, vessel 2 capable of holding 3 litres and vessel 3 capable of holding 8 litres. The starting state is the rst vessel is lled to the limit (i.e. 5 litres), vessel 2 is also lled to the limit (3 litres), and vessel 3 is empty:

Vessel:

1

2

3

Capacity:

5

3

8

Filling:

5

3

0

One can now pour the contents of one vessel into another one, without spilling, and stopping when the target vessel is lled. The task is the following: by pouring back and forth, how can one split the total of 8 litres of milk into two equal portions of 4 litres each? How can one pour the contents of the vessels from one to another such that at the end of the pouring process, one vessel should contain 4 litres and another one also 4 litres.
The following considerations apply: it is not allowed to estimate quantities by eye”. In pouring the contents from one vessel to another, one stops either when the pouring vessel is empty, or when the target vessel is full. One can not do a partial decanting”.
1.1.2    The Rules for the General Decanting Task
State Consider a number of vessels 1,2,. . . ,n. Each vessel i has a capacity ci (which is an integer larger than 0). In each state, there is given a ll level fi (which is an integer ranging from 0 to the capacity of the vessel: 0 fi ci).
In above example, we had: (c1; c2; c3) = (5; 3; 8) and for the start ll level (f1; f2; f3) = (5; 3; 0).
Move    A move consists of pouring the contents of one vessel i into another vessel j such tha

nothing is spilled or added (conservation of liquid);

decanting stops wheni is empty; or j is full;(or both).

Goal Starting with a particular start con guration, nd a sequence of moves such that a goal con guration is reached (in the example from Sec. 1.1.1, that is (f1; f2; f3) = (4; 0; 4).
The Task
Based on the search algorithms covered in the lecture, write a Python program that starts from some starting state, (f1; f2; f3) and moves according to the rules until it reaches a given goal state for the decanting task.
Your solution must at least be able to solve the example from Sec. 1.1.1, but should be more general than that, in that it allows for larger number of vessels and di erent llings (see below for a variant).
For this, you have to adapt the search algorithms introduced in the lecture presented in the lecture and apply it to a Decant class which you have to write. Keep in mind that a naive depth- rst search need not work, as the problem can repeat positions.
 Detailed Instructions and Marking Scheme
Core Tasks You need to write a class Decant and de ne for it (at least) the following class methods:

start(self): returns the starting state for the decanting task.

Hint: There are di erent ways of representing the board | whatever you choose to do, make sure you give a clear comment how you decided to represent the state.

goal(self, node): returns True if the con guration node is a goal con guration, i.e. if it ful ls the target requirement (in the example from Sec. 1.1.1, two vessels with 4 litres

 Advanced Tasks
Once you have successfully implemented the depth- rst or breadth- rst solution for the Decanting Task, you can proceed to implement a variant of the problem for additional marks.

demonstrate the operation of your solution by solving a variant of the rst task, with capacities (c1; c2; c3) = (7; 4; 3), initial state (f1; f2; f3) = (7; 0; 0) (all 7 litres in the rst vessel at the beginning), target state (2; 2; 3).

modify your class to handle the following variations of the problem:

You have two vessels, one with 4 and one with 9 litres volume. You also have a tap (which allows you to completely ll a vessel) and a sink (which allows you to completely empty a vessel). How can you use the vessels to obtain exactly 6 litres of liquid (collected in a single vessel)?
Note: this problem is di erent from the above, in that the total amount of liquid is not conserved anymore and liquid can be topped up or poured out as required.
Note: however, as before, you cannot estimate” to which proportion a vessel is lled. You only identify when a target vessel is entirely lled or when a source vessel is entirely empty.

Task: Bayesian Update | A Whale Watching” Scenario

2.1     Description
The task consists of writing a Python program which simulates a ship trying to reach a whale in a 10 10 grid world. More precisely, the ship moves through the grid world and measures (e.g. by sonar”) a distance to the whale. From it, it deduces where the whale could be (using a Bayesian model), moves, measures again, etc. until it knows where the whale is.
More precisely, the skeleton of the Python program is provided with the le whale_fillin.py (Fig. 1) and the task consists of lling in the missing components.
2.1.1    The Rules for the Whale Watching” Scenario
World The world consists of a 10 10 array, both x and y coordinates are numbered from 0 to 9 inclusive, in standard Python convention. Both, whale and ship are located on one of these (x; y) positions, and the initial positions are randomly chosen (see the __init__() methods of the Whale and the Ship class in the whale_fillin.py le, Fig. 1).

(Puzzle sources available on request after submission)

Scenario Run Loop The scenario run loop is already implemented in the whale_fillin.py le (Fig. 1), via the function run(whale, ship) and the main body of the program.
The run loop of the Whale Watching scenario has the following phases:

It is rst checked whether the whale has been found by the ship, which means that the ship has moved to the same location as the whale.

If this is the case, the scenario is completed successfully.

If not, the whale performs its move (to be lled in according to the speci cation in the Tasks sections, Secs. 2.1.2 and 2.1.3).

The ship now obtains the measurement of its distance to the whale | implemented in method whale.estimated by(ship). The distance between two locations l1 = (x1; y1) and l2 = (x2; y2) is computed via d(l1; l2) :=            (x1          x2)2 + (y1           y2)2 :

(In the code, we use the integer part thereof). This distance measure is already imple-mented in whale_fillin.py.

Based on this measurement and its own position, the ship now has to perform a Bayesian estimate of the new position | needs to be lled in in method ship.measure(d).

The ship’s internal Bayesian model of the whale’s position is printed by ship.show_model() (to be lled in).

The ship now moves | ship.move() | to a new position according to the movement rules speci ed in the Tasks sections, Secs. 2.1.2 and 2.1.3.

The scenario run loop now repeats.

The Task
The task of this assignment is to ll in the missing parts of the program, indicated by three dots …” in the Python program whale_fillin.py (Fig. 1).
Unless stated, the tasks are core tasks.
Detailed Instructions and Marking Scheme
In the le whale_fillin.py (Fig. 1), ll in the following missing code snippets denoted by …”.

In the ship.__init__(xwhale, ywhale) initialization method, the missing initialization of the entries of p_w for the probability of the location of the whale should be lled in.

Hint: This is easy: what is the initial probability of the whale being at a particular location? (Remember the mine search problem and what the initial probability of the mine being at some location was).
2. Fill in the missing code for ship.p_d_cond_w(d,x,y). The method should return p(d|x, y) where x and y are the location of the whale and we assume that the sonar returns perfectly accurate distances d of the ship from the whale. Note that in that method you have access to the ship’s location via self.x and self.y.
In detail, the method should return the probability of 1.0 if the potential position of the whale (x, y) has distance d from the ship’s position (self.x, self.y), and 0.0 otherwise.
3. Advanced Task: In ship.measure(d), fill in the Bayesian update for p(w|d) for the whale location given the distance. In the code, a variable p_w_cond_d has already been prepared. [5 marks]
Hint: check the mines example from the lecture.
Hint 2: this task is challenging; if you have difficulties with it, leave it to the end. In the meantime, set p_w_cond_d to the equidistribution on the potential positions.
4. In ship.show_model(), fill in a procedure that prints the current Bayesian model ship.p_w. Assume that ship.p_w is a dictionary that takes x, y tuples as keys and has probabilities (float numbers) as values. [4 marks]
5. In ship.move(), fill in the dots by a movement of the ship (position of self.x and self.y) in a useful way. This can be
(a) moving the ship closer to the hypothesized whale position;
(b) moving the ship to a position where it is easier to estimate where the whale is or some other solution (indicate in a comment what your movement does!).
Hint: If you have problems with this task, make the ship jump randomly to some position. You will get partial marks for such a solution.
6. Advanced Task: Replace the pass statement in whale.move() by a 1-step move of the whale in an arbitrary direction, inside the 10 × 10 board. You will need to modify the ship.measure(d) method to incorporate the whale’s random movement into the Bayesian model.
Hint: This task is very difficult. Do not attempt it unless you have covered all other tasks.
3 Task: Discussion
3.1 Description
In Assignment 1, you needed to consider a search problem and in Assignment 2 the update of a model of the uncertain state of a system.
In the minesweeper problem from the lecture, you find a combination of these ideas: you need to estimate the state of the system and you need to solve it (here: find the mine) as quickly as possible. In the minesweeper example, the problem is also that you trade off safety for speed 6
— a more aggressive search will increase the likelihood of stepping on the mine, but accelerate identification of its location as compared to a more conservative one.
Sketch and discuss an algorithm (verbal pseudocode is sufficient, no need for a full program) to find the whale as quickly as possible when your ship can only make single steps and discuss whether and, if yes, how the algorithm would need to be modified to operate on the mine problem. Discuss, in particular, how this idea is related to the puzzle task from Sec. 1 and the whale search task from Sec. 2. You should write 1,000 words (less if you have instructive illustrations/diagrams).
You will get marks for:
1. Research on above issues (e.g. brief literature review on the link between search algorithms and state identification, including, but not limited to partially observable systems). Do not forget to cite your sources! Avoid plagiarism!
2. Sketching an algorithm that would address the double problem of searching and identifying state (no need for a detailed Python code).
3. Discussing the algorithm in the light of the minesweeper problem and the whale watching problem.
4 Software Code Requirements
The code has to be written in Python and is to be submitted on Canvas. The code has to be appropriately commented and the code logic understandable to the marker. Functions whose operation can not be understood from the combination of code and comment or operations which are obscure in any way and are not explained by the comments will lead to mark deduction. For the Decanting Task, provide at least two scenarios, one of them must be the example from Sec. 1.1.1.
This 7COM1034: Artificial Intelligence Assignment has been solved by our Python experts at TVAssignmentHelp. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

How to create Testimonial Carousel using Bootstrap5

Clients' Reviews about Our Services