You are on page 1of 9

ARTIFICIAL INTELLIGENCE

Assignment # 2

Joudet Ahsan
17-CS-24
Sir Awais Awan
28-November-2020

17-CS-24@students.uettaxila.edu.pk
The forthcoming Artificial Intelligence (AI) revolution: Its impact on society and
firms
This paper is about Artificial Intelligence (AI) Revolution and its impact on all aspects of our
society, firms and life in general by evaluating predictions made in 1995 for the year 2015.
The paper is divided into 4 sections and the highlights of the sections are;
1. The first section overviews the predictions made in the 1995 paper for the year 2015,
identifying successes and failures (hits and misses)
2. Second section investigates existing and forthcoming technological advances in the
field of AI and the ability of computers/machines to acquire real intelligence.
3. Third one of the sections, sums up the impact of the AI revolution and describes the
four major scenarios being advocated, as well as what could be done to avoid the
possible negative consequences of AI technologies.
4. In the fourth part, discussions about how firms will be affected by these technologies
that will transform the competitive landscape, how start-up firms are founded, and
the way success can be achieved is discussed.
5. In the conclusion, speculations about the future of AI and its impact on our society,
life, firms and employment are briefed.

 The 1995 paper: hits and misses


Hits:
1. Information revolution would be in full swing (computers and
communication)
2. Wireless telecommunication was predicted
3. Super automation leading to unattended factories
4. Decline of industrial firms and agriculture labor
Misses:
1. Smartphones and internet influence and extent of their usage was not
foreseen
2. Large amount of data for free was not predicted.
3. Smart phones as powerful as supercomputer of 1995 would cost less than
500pounds
4. Widespread of internet usage and social networking

 Towards the AI revolution


This section discusses AI’s greatest achievements, self-driving vehicles, skypes and
many more. The first 190 years of advancements is discussed. During the initial time
of technological advancement, the process of new inventions coming out was slow.
But not after the first computer was out. Within a few decades, advancement in field
of information and technology was unstoppable. It went from a computer as big as a
size of room to pocket sized and even more powerful.
From smart machines to clever computers and to Artificial Intelligence (AI)
programs
The following are notable advancements
1997 Deep Blue defeats the world chess champion
1998 Robotic toy Furby learns how to speak
2005 Robot ASIMO serves restaurant customers
2009 Google's first self-driving car
2011 Watson computer beats Jeopardy's
2016 AlphaGo defeats GO champions using
From digital computers to AI tools
Deep mind(neural program) utilizes deep learning, deep learning products are also
unstoppable, it’s hard to define its boundary, because it brings cumulative learning.

 The four AI scenarios


what will the role of humans be at a time when computers and robots could perform
as well or better and much cheaper, practically all tasks that humans do at present?”
Four scenarios can answer the above questions
1. Optimists
Science fiction, achieving immortality, time travel, genetic modification,
reversing age, humans to enjoy life to the fullest etc.
2. Pessimists
Robotics, genetic engineering, and nanotech – are threatening to make
humans an endangered species”. Machines will get in effective control of
human life taking over all life. humans may be reduced to second rate status
(some saying the equivalent of computer pets).
3. Pragmatists
By concentrating research efforts on intelligence augmentation, they claim we
can avoid or minimize the possible danger of AI while providing the means to
stay ahead in the race against thinking machines and smart robots.
4. Doubters
The doubters do not believe that AI is possible and that it will ever become a
threat to humanity. Doubters argues that human intelligence and expertise
cannot be replicated and captured in formal rules. All tasks requiring
creativity, including innovative breakthroughs, strategic thinking,
entrepreneurship, risk taking and similar ones could never, or at least not in
the foreseeable future, be done algorithmically, providing humans with a
clear superiority versus intelligent machines.

 Firms and employment: from the industrial and digital to the AI


revolution
4.1 The successful, dominant firm of the AI revolution and its management
1. Technologies and their usage
2. Managing people
3. Growth by acquisition
4.2 Competitive requirements: big data, algorithmic decisions and operational excellence
4.3 The 2037 successful firm
4.4 Garage start-ups, crowd sourcing and VC Funding
4.5 Employment patterns
4.6 Work and leisure

Conclusions
There are concerns, about AI might overtake us. This conclusive quote,

Thinking about the risks associated with emerging AI technology is hard work, engineering
potential solutions and safeguards is harder work, and collaborating globally on
implementation and monitoring of initiatives is the hardest work of all. But considering all
that is at stake, I would place all my bets on the table and argue that the effort is worth the
risk many times over”

Code
from copy import deepcopy
import numpy as np
import time

# takes the input of current states and evaluvates the best path to goal state
def bestsolution(state):
bestsol = np.array([], int).reshape(-1, 9) #take the input
#1
#2
#3
#4
#6
#5
#turns it into an array, reshaping it like (-1 0 1 2 3...)
while count != -1:
bestsol = np.insert(bestsol, 0, state[count]['puzzle'], 0)#level of the tree is here, best path (up, down,left..
#which ever is better is returen

#this array keeps, the bestsol array,


count = (state[count]['parent'])
return bestsol.reshape(-1, 3, 3) # 3 rows 3 column
#This function takes all the states as input and traverses through each of the states to find the best solution and
returns the best optimal solution.

# this function checks for the uniqueness of the iteration(it) state, weather it has been previously traversed or
not.
def all(checkarray):
set = []
for it in set: #set unique
for checkarray in it:
return 1 #if unique
else:
return 0

# calculate Manhattan distance cost between each digit of puzzle(start state) and the goal state
def manhattan(puzzle, goal):
a = abs(puzzle // 3 - goal // 3) #floor division
b = abs(puzzle % 3 - goal % 3) #modulus
mhcost = a + b
return sum(mhcost[1:])
#thiss is hn because gn moves one step...

# will calcuates the number of misplaced tiles in the current state as compared to the goal state
def misplaced_tiles(puzzle, goal):
mscost = np.sum(puzzle != goal) - 1 #cost to go from current to goal state
return mscost if mscost > 0 else 0 #if cost is zero i.e already in goal state return 0 cost

# 3[on_true] if [expression] else [on_false]

# will indentify the coordinates of each of goal or initial state values


def coordinates(puzzle):
pos = np.array(range(9))
for p, q in enumerate(puzzle):
pos[q] = p #all positions of the puzzle (positions as in 1 2 3; 4 5 6; 7 8 9)
return pos
# positions of tiles is returend

# start of 8 puzzle evaluvation, using Manhattan heuristics

def evaluvate(puzzle, goal):


steps = np.array([('up', [0, 1, 2], -3), ('down', [6, 7, 8], 3), ('left', [0, 3, 6], -1), ('right', [2, 5, 8], 1)],
dtype=[('move', str, 1), ('position', list), ('head', int)])
#up down left and right moves are performed( to move a tile up 1 step we need to subtract 3
dtstate = [('puzzle', list), ('parent', int), ('g_cost', int), ('h_cost', int)]

# initializing the parent, gn and hn, where hn is manhattan distance function call
costg = coordinates(goal) #position of tile is taken and added to costg
parent = -1
g_cost = 0
h_cost = manhattan(coordinates(puzzle), costg) #manhatten is calculated
state = np.array([(puzzle, parent, g_cost, h_cost)], dtstate)
# state array keeps the current state, its parent, gn(usually 1) and hn heuristic value
#position is location i.e 0 1 2(on top of the puzze
# We make use of priority queues with position as keys and fn as value.
dtpriority = [('position', int), ('fn', int)] #full node.
priority = np.array([(0, h_cost)], dtpriority) # heuristic value and priority is kept in an array

while 1: #loop is ran


priority = np.sort(priority, kind='mergesort', order=['fn', 'position'])
#sorting is done on the basis of fn, lowest to highest, so the
#first element is the one with the lowest fn
position, fn = priority[0]
#now we have th the positons(tile locationof the tile and fn value
priority = np.delete(priority, 0, 0)
# sort priority queue using merge sort,the first element is picked for exploring remove from queue what we
are exploring
puzzle, parent, g_cost, h_cost = state[position]
puzzle = np.array(puzzle)
# Identify the blank square in input
blank = int(np.where(puzzle == 0)[0])
g_cost = g_cost + 1
c=1
start_time = time.time()
for s in steps:
c = c + 1 # incrementing the count
if blank not in s['position']:
# generate new state as copy of current
openstates = deepcopy(puzzle) # deepcopy to save the original one as it is
openstates[blank], openstates[blank + s['head']] = openstates[blank + s['head']], openstates[
blank] # swapping
# The check function is called, if the node has been previously explored or not.
if ~(np.all(list(state['puzzle']) == openstates, 1)).any(): # openstate contain the current visting node
# of the puzzle so here it will check whether
# the current node is already visited or not
end_time = time.time() # calculate time to generate the new state and checking whether the
# node is already visited or not
if ((end_time - start_time) > 2): # time claculated above must be less than 2
print(" The 8 puzzle is unsolvable \n")
break
# calls the Misplaced_tiles function to calcuate the cost
h_cost = misplaced_tiles(coordinates(openstates), costg) # coordinate(openstates) contain the
current node
# and costg contain the goal node
# generate and add new state in the list
q = np.array([(openstates, position, g_cost, h_cost)], dtstate)
state = np.append(state, q, 0) # Array is converted back to the node form and addded to the list
# f(n) is the sum of cost to reach node and the cost to reach from the node to the goal state
fn = g_cost + h_cost

q = np.array([(len(state) - 1, fn)], dtpriority)


priority = np.append(priority, q, 0) # priority contains the visited nodes
# Checking if the node in openstates are matching the goal state.
if np.array_equal(openstates, goal):
print(' The 8 puzzle is solvable \n')
return state, len(priority) # returns the current state and visited nodes for each loop iteration

return state, len(priority)

# ---------- Program start -----------------

# User input for initial state


puzzle = []
print(" Input vals from 0-8 for start state ")
for i in range(0, 9):
x = int(input("enter vals :"))
puzzle.append(x)

# User input of goal state


goal = []
print(" Input vals from 0-8 for goal state ")
for i in range(0, 9):
x = int(input("Enter vals :"))
goal.append(x)

n = int(input("1. Manhattan distance \n2. Misplaced tiles"))

if (n == 1):
state, visited = evaluvate(puzzle, goal)
bestpath = bestsolution(state)
print(str(bestpath).replace('[', ' ').replace(']', '')) # as best solution is returned with square brackets
# so remove the square bracket with blank space
totalmoves = len(bestpath) - 1 # moves are one less than the total path
print('Steps to reach goal:', totalmoves)
visit = len(state) - visited
print('Total nodes visited: ', visit, "\n")
print('Total generated:', len(state))

if (n == 2):
state, visited = evaluvate_misplaced(puzzle, goal)
bestpath = bestsolution(state)
print(str(bestpath).replace('[', ' ').replace(']', '')) # as best solution is returned with square brackets
# so remove the square bracket with blank space
totalmoves = len(bestpath) - 1 # moves are one less than the total path
print('Steps to reach goal:', totalmoves)
visit = len(state) - visited
print('Total nodes visited: ', visit, "\n")
print('Total generated:', len(state))

Input
Output

To move from one state to the other. So, if we move from one level to another, only a cost of 1 is inflicted,
because only one step is taken (up, down, left or right). So, this relates to the depth of the tree, depth = 0, cost
would be zero. i.e. at first the cost is also zero, since no tile has been moved. To go to the level 1 or depth =1,
the cost is 1 and so on.
Bibliography
(n.d.). Retrieved from
https://github.com/harshkv/8_Puzzle_Problem/blob/master/8PuzzleProblem.py

You might also like