+1 (208) 254-6996 [email protected]
  

Each link in the tree has a weight that reflects the distance between a pair of divisions. Navigation is done by moving from the current position in the map (say the robot is at division B) to other map locations (say D) in order to service customer orders. 

9/29/21, 12:33 PM project 1.ipynb – Colaboratory

Don't use plagiarized sources. Get Your Custom Essay on
Purpose Is To Adapt The Iterative Deepening Search (IDS) Method Learnt In Class To A Realistic Problem That Is Of Relevance To Industry.
Just from $13/Page
Order Essay

https://colab.research.google.com/drive/1wnJNx5lok6JBVBotnaz3Kt8-NqePt4NW?authuser=1#scrollTo=82bde6dc&uniqifier=23&printMode=true 1/5

1. Sneha Yerramsetti 2. Charitha Rajala

Fundamentals of Arti�cial Intelligence – Project 1

import random as rd from operator import add

#warehouse grids 6*6

w = [ [‘P’, ”, ‘D’, ”, ”, ”], [”, ‘A’, ”, ”, ‘G’, ”], [‘E’, ”, ‘B’, ”, ‘I’, ”], [”, ‘C’, ”, ”, ”, ”], [”, ”, ‘F’, ”, ”, ‘H’], [”, ”, ”, ‘J’, ”, ”] ] items = [‘A’, ‘B’,’C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’] #items present in the

# Modified warehouse grid layout 2 w1 = [

[‘D’, ”, ‘B’, ”, ‘M’, ”], [‘E’, ”, ‘F’, ”, ‘K’, ”], [‘C’, ”, ‘H’, ”, ”, ‘O’], [‘G’, ”, ‘J’, ”, ”, ‘Q’], [‘I’, ”, ”, ”, ‘N’, ”] ] items1 = [‘A’, ‘P’,’D’, ‘B’, ‘M’, ‘E’, ‘F’, ‘K’, ‘C’, ‘H’,’O’,’G’,’J’,’Q’,’I’, ‘N’]

[‘P’, ”, ‘A’, ”, ‘P’, ”],

# Original warehouse grid layout 1

# gird layout1

#items present in the gird layot 2

#the possible positions for the robot to move are up,down,left and right

positionsavailable = [ list(map(add, [0,-1],current_position )), #up list(map(add, [0,1], current_position)), #left list(map(add, [-1,0],current_position)), #down list(map(add, [1,0], current_position)) #right ]

def route(current_position,previous_position, itemsordered,w):

9/29/21, 12:33 PM project 1.ipynb – Colaboratory

https://colab.research.google.com/drive/1wnJNx5lok6JBVBotnaz3Kt8-NqePt4NW?authuser=1#scrollTo=82bde6dc&uniqifier=23&printMode=true 2/5

p = list(filter(lambda position:

0 <= position[1] < len(w[0]) , positionsavailable))

next_position = movements(p, itemsordered, w) if(len(next_position) == 0): next_position = p return next_position[rd.randint(0,len(next_position)-1)]

0 <= position[0] < len(w) and

#the random movements of to robot in order to get the customer ordered items

movements = [] rn = rd.randint(1,10); #random number from the items A-J are choosen for position in p : if rn in range(1,11) and w[position[0]][position[1]] in ordered_items: movements.append(position) elif rn == 9: movements.append(position) else: break

def movements(p,ordered_items ,w ): #p is position of the robot

return movements

def agent(w,avail_items): #available items in the grid

sp_score = 0 #shortest path score lp_score = 0 #longest path score total = 0

for order in range(0,norders): # no of orders nitems = rd.randint(1, len(avail_items)) #random number is generated ordereditems = rd.sample(avail_items, nitems) #the items ordered or listed by the ran rem_items = list(ordereditems) #remaining items left out from the listed items current_position = [0,0] #starting position of the robot is P score = 0 path = [(current_position[0], current_position[1])] while len(rem_items) > 0: #if the items listed are still need to be picked by the rob previous_position = current_position #the last position of the robot will be the current_position = route(current_position,previous_position, rem_items, w)

shortest_path = [] s_ordereditems = [] longest_path = [] l_ordereditems = []

scoredtotal = 0 norders = 1000

9/29/21, 12:33 PM project 1.ipynb – Colaboratory

https://colab.research.google.com/drive/1wnJNx5lok6JBVBotnaz3Kt8-NqePt4NW?authuser=1#scrollTo=82bde6dc&uniqifier=23&printMode=true 3/5

path.append((current_position[0], current_position[1])) if w[current_position[0]][current_position[1]] in rem_items: score += 3 #reached to the required grid position(item needed) rem_items.remove(w[current_position[0]][current_position[1]]); else: score -=-1 #if the robot goes to an unwanted grid position just to travel if(len(shortest_path) == 0 or len(shortest_path) > len(path)): shortestpath = path sp_score = score s_ordereditems = ordereditems if(len(longest_path) < len(path)): longest_path = path lp_score = score l_ordereditems = ordereditems

scoredtotal += score avg_items = total/ norders avg_score = scoredtotal / norders

total += nitems

#Shortest path print(‘The scores for 1000 episodes are’) print(‘Customer Ordered Items are: \n’ + str(s_ordereditems)) print(‘Shortest Path: \n’ + str(shortestpath)) print(‘Score of the shortest path:’ + str(sp_score))

#longest path print(‘Customer Ordered Items: ‘ + str(l_ordereditems)) print(‘Longest Path:\n’ + str(longest_path)) print(‘Score of the logest path: ‘ + str(lp_score)) print(‘\n’)

print(‘Average Score : ‘ + str(avg_score))

print(‘\n’)

print(‘Average(no. of items ordered): ‘ + str(avg_items))

print(‘brute force : ‘ + str(brute_force(avg_items)))

def brute_force(nitems): return -35+4*nitems

The scores for 1000 episodes are Customer Ordered Items are: [‘I’, ‘A’, ‘D’, ‘B’, ‘J’, ‘E’, ‘C’] Shortest Path: [(0, 0), (1, 0), (2, 0), (2, 1), (1, 1), (2, 1), (1, 1), (0, 1), (0, 0), (1, 0), (2, 0), Score of the shortest path:162

#output for the grid layout 1 agent(w,items)

9/29/21, 12:33 PM project 1.ipynb – Colaboratory

https://colab.research.google.com/drive/1wnJNx5lok6JBVBotnaz3Kt8-NqePt4NW?authuser=1#scrollTo=82bde6dc&uniqifier=23&printMode=true 4/5

Customer Ordered Items: [‘D’, ‘I’, ‘G’, ‘F’, ‘H’, ‘A’, ‘B’, ‘C’, ‘E’] Longest Path: [(0, 0), (0, 1), (0, 0), (1, 0), (1, 1), (0, 1), (0, 0), (0, 1), (1, 1), (2, 1), (2, 0), Score of the logest path: 639

Average(no. of items ordered): 5.484 Average Score : 126.74 brute force : -13.064

The scores for 1000 episodes are Customer Ordered Items are: [‘P’, ‘N’] Shortest Path: [(0, 0), (0, 1), (0, 0), (0, 1), (1, 1), (0, 1), (0, 2), (0, 1), (1, 1), (2, 1), (1, 1), Score of the shortest path:89

Customer Ordered Items: [‘Q’, ‘F’, ‘K’, ‘N’, ‘J’, ‘M’, ‘O’, ‘G’, ‘B’, ‘H’, ‘C’, ‘P’, ‘D Longest Path: [(0, 0), (0, 1), (0, 0), (0, 1), (0, 2), (1, 2), (1, 1), (1, 0), (1, 1), (1, 0), (0, 0), Score of the logest path: 737

Average(no. of items ordered): 8.384 Average Score : 169.465 brute force : -1.4639999999999986

#output for the grid layout 2 agent(w1,items1)

9/29/21, 12:33 PM project 1.ipynb – Colaboratory

https://colab.research.google.com/drive/1wnJNx5lok6JBVBotnaz3Kt8-NqePt4NW?authuser=1#scrollTo=82bde6dc&uniqifier=23&printMode=true 5/5

Could not connect to the reCAPTCHA service. Please check your internet connection and reload to get a reCAPTCHA challenge.

 1s completed at 12:32 PM

Project 2

Artificial Intelligence

CSCE 5210 – Fall 2021

Distributed: Tuesday, September 28

Due: Tuesday October 19

[Solutions to this assignment must be submitted via CANVAS prior to midnight on the due date. Submissions no more than one day late will not be penalized. Submissions up to one week late will be penalized 10 points. Submissions will not be accepted if more than one week later than the due date.]

This project may be undertaken individually or in pairs. If working in a pair, please state clearly the names of the two people undertaking the project and the contributions that each has made. Only one submission should be made per pair.

The purpose is to adapt the Iterative Deepening Search (IDS) method learnt in class to a realistic problem that is of relevance to Industry.

The environment is the warehouse that was used in Project 1, except that it has 15 locations, instead of 10. The 15 locations now represent divisions in the warehouse that stock different types of items. For example, location 1 is a division that stocks Electronics items while division 2 holds Clothes, and so on.

For reasons of efficiency the lead designer in the AI team has decided to map the warehouse in the hope that it will optimize the robot navigation process. Also, it was observed in the trial run undertaken earlier that the sensors were not accurate enough to support a 1-step lookahead search and it was thus decided to use the sensors to perceive the current location only and not the surrounding neighborhood.

The map produced by the AI team is in the form of a binary tree as shown below:

20

20

20

30

10

40

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

30

10

20

30

20

20

20

20

Each link in the tree has a weight that reflects the distance between a pair of divisions. Navigation is done by moving from the current position in the map (say the robot is at division B) to other map locations (say D) in order to service customer orders.

Part A

In this part we are concerned with minimizing the amount of inter-divisional movement. A customer always orders items from only one division in the company. Answer the following two questions. Note that the answers to the questions do not need any programming effort.

Q1) From the map above what data structure needs to be derived to support the minimization of movement between divisions that is required to support consecutive orders that involve different divisions?

Q2) How will we populate the data structure that you proposed in Q1 above? Outline the procedure involved. You only need to describe the procedure, not implement it at this stage.

Part B

In Part A above we only considered movement to divisions. In this part we will consider the effort involved in servicing a customer order by moving to the divisions required as well as navigating to the shelf location that contains the item ordered.

Customer orders are generated by a 3-step process. First, a random number is generated that specifies the division number that contains the items ordered. This will be thus a random number in the range 1 to 15. Next, a random number is generated that represents the number of items ordered k. We will assume that no customer orders more than 3 items. In the 3rd step, k random numbers, each in the range 1 to 63, are generated that represent the shelf numbers where the items are located. For example, a customer may have ordered two different items at shelf locations 17 and 61 respectively. Shelves across all divisions have the same numbering scheme, which is in the range 1 to 63.

Thus, within a division you can represent the shelf by a complete binary tree. Except for the lowest level each node k has two children numbered 2k and 2k+1 respectively. Within any division you may assume a constant step cost of 1 to move from any parent node to any one of its child nodes.

Customer orders are serviced one-by-one in the order that they were received. The robot is in division 1 at the first order. From there it may have to move to another division if the first order does not have items contained in the first order. Once the robot services the current order at a given division it must retrace its path back to the entrance of that division which is represented by the root node of the binary tree that covers the shelf locations for that division.

Q3) Implement Q2 above by writing a Python program that populates the data structure you proposed in Q1.

Q4 Implement Iterative Deepening Search (IDS) to locate shelf locations for servicing customer orders.

Q5) Test your program for this boundary case. Generate an order for division 6 and trace its path from division 1 to division 6 and then onwards to the only item, item 33, that was ordered. Check that its path length is what you expected. Print out both the path and its length.

Q6) Run your program for a certain number N of customer orders (say 100) and answer the following questions:

1. What is the average path length travelled across the N orders? Take care to include in your path length both the paths travelled to get to the division that contains the order and the movement required within the division to get to the items required.

2. Print out the length of the shortest and longest paths across the N orders that you generated.

Hand in:

1) A short report (between 1 and 2 pages in size) describing the approach that you took. In addition to the description of your approach you should answer the 6 questions given above.

2) Any assumptions that you made while undertaking this project.

3) The complete set of Python code that you used.

End of project specification.

P.S. A* is coming in the next project.

Order your essay today and save 10% with the discount code ESSAYHELP