0% found this document useful (0 votes)
2 views27 pages

Ai Problem

The document outlines the curriculum for a Computer Engineering laboratory focused on Artificial Intelligence at B R Harne College for the academic year 2025-2026. It includes a list of experiments, such as implementing various search algorithms and a case study on AI applications in medical diagnostics. The document also discusses the significance of AI in healthcare, its current applications, and future prospects, highlighting the need for regulatory frameworks and data sharing for effective implementation.

Uploaded by

Mohan Barhate
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views27 pages

Ai Problem

The document outlines the curriculum for a Computer Engineering laboratory focused on Artificial Intelligence at B R Harne College for the academic year 2025-2026. It includes a list of experiments, such as implementing various search algorithms and a case study on AI applications in medical diagnostics. The document also discusses the significance of AI in healthcare, its current applications, and future prospects, highlighting the need for regulatory frameworks and data sharing for effective implementation.

Uploaded by

Mohan Barhate
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

B R Harne College of Engineering and Technology, Vangani

Department of Computer Engineering

Subject: Artificial Intelligence

Name of Laboratory: Computer

Lab Class/Sem: TE/VI


Year: 2025-2026
Subject: Artificial Intelligence Class/Sem: TE/VI Name of Laboratory:
Computer Lab Year: 2025-2026

LIST OF EXPERIMENTS

Exp Name of the Experiment Date Pa


t. ge
No
. N
o.
1. A Case Study on Artificial Intelligence Application in
Medical Diagnostics.

2. Write a program to implement Breadth First Search.

3. Write a program to implement Depth First Search.

4. Write a program to implement Uniform Cost Search.

5. Write a program to implement Greedy Best First


Search.
6. Write a program to implement A* Algorithm.

7. To learn the basics of Prolog and installation of SWI


Prolog.
8. Write a program to implement Min Max Algorithm.

9 To deduce information from family tree.

10 Write a program to implement Graph Coloring


Algorithm.
11 Write a program to find factorial of a number using
SWI Prolog.

Prof. Kishan Rangeele


Subject In-charge
Experiment 1

A Case Study on Artificial Intelligence Application in Medical Diagnostics. Abstract

The main focus of Artificial Intelligence is to improvise the human cognitive


capabilities. It brings about tremendous change in health-care, and the date that is
being incessantly generated and the progress in the techniques to analyse them are
the factors controlling the backbones of development in AI. Today, AI is playing an
essential part in the advancement of the field of medicinal diagnostics. The review of
AI applications in healthcare and medical diagnostics along with its future
applications and effects The techniques are being applied to structure as well as
unstructured medical data. Popular and effective AI systems incorporate machine
techniques for structured data like neural network, classical support vector machine
and deep learning, and NLP for unstructured data. Major AI techniques involve medical
diagnostics including cancer, neurology and cardiology.

Keywords: Medical Diagnostics, Support Vector Machine, Deep Learning, NLP.

Introduction

Medical Artificial Intelligence:

There is a strong likelihood that AI will help doctors make more reliable and error-free
clinical decisions and in some cases give it more importance than human judgement
in some important areas of medical care (eg. oncology). The four most important
perspective of medical investigators‟:

• The need of AI application in healthcare


• Data types to be analysed by AI systems
• Generating meaningful results using Artificial Intelligence through procedural
mechanism
• Disease groups that can be dealt by AI systems

Need of Ai

AI employs procedural algorithms to process large set of datasets in healthcare, and it


further uses the results to come up to a final judgement to assist medical diagnostics.
Learning and self-correcting capability can be added feature to improve its accuracy.
Moreover, AI systems can provide updated medical information from journals, clinical
practices with relatively less error. Dataset

In the diagnosis stage of clinical dataset, a substantial proportion of data for the
literature analysis of Artificial Intelligence is obtained from electro-diagnosis, diagnosis
imaging and genetic testing. An example is, Ankita Sahu and Akhil Sahu encouraged
radiologists into adopting Artificial Intelligence technology while analysing the huge
data that is retrieved from diagnostic images. In order to diagnose gastric cancer Li et
al tried to analyse the long non coding RNAs and the abnormal genetic expression that
is obtained from them. An electro diagnosis support system had been developed by
Shin et al which is used for localising injury to the brain. There are two other major
data sources which comprise of notes made from physical examination along with
results obtained from running lab tests. It can be recognized through images,
electrophysiological and genetic dataset since they carry a huge amount of clinical
notes that can‟t be directly analysed. Hence the main focus of AI system is to convert
these unstructured texts to system-
understandable electronic medical data.

Ai Systems:

The AI system is divided into two major categories on the basis of dataset. The first
category employs machine learning techniques to analyse structured data directly. On
the other hand second category works on unstructured data using natural language
processing methods to enhance the structured data. For instance in the medical
application of AI, ML techniques works on patients‟ traits to cluster them or deduce the
probability of any particular disease, whereas NLP strives at converting unstructured
data to structured data that is further studied using Machine Learning techniques.

Current Applications of Ai in Medical Diagnostics

A considerable lot of the present machine learning analytic applications seems to fall
under these classifications:

Chatbot:

Companies are utilizing AI-chatbots with speechrecognition feature that can recognize
patterns through symptoms as stated by the patient to frame a potential conclusion, to
avoid sickness and additionally suggest a suitable course of action.

Oncology: Scientists are trying to identify cancerous tissues using deep learning
technique at a comparable level to any trained doctor, which can trigger fast diagnosis
of cancer at its initial stages itself.

Pathology:
Pathology is an important area that if covered by AI systems can be of great help. It is
the science or study of origin, nature and course of diseases analysed by lab tests of
bodily fluids like sputum, blood and urine, and also through tissue analysis. The
traditional methods of diagnosis involve use of microscope which can be timetaking
and also at times can have error. The AI techniques like machine learning and machine
vision techniques tend to enhance the traditional methods used by pathologists.

Future of Ai in Medical Diagnosis:

There is a of diversion of doctor from traditional method to the use of AI chatbots that
is AI form of doctor and a UK based digital healthcare organisation is studying this
collaboration of patients with AI doctors. Ai is becoming popular in medical services
and is in the process of evolving the traditional method to a new way of diagnosing
and treating ailments through the fast-growing field of machine learning and big data
analytics.

Conclusion and Discussion:


An effective AI framework must have the ML component to handle structured dataset
(genetic information, EP information, images) and NLP segment for extracting
unstructured data’s. Advanced algorithms at that point should be prepared using
healthcare data so that it can help doctors with illness analysis and proposing
methods for treatment.

In spite of the fact that the AI innovations are drawing in generous considerations in
therapeutic research, implementation in real-life is yet confronting barriers. The very
first problem originates from regulations. The safety needs to be surveyed and the
adequacy of AI frameworks neds to be maintained which the current regulations lack.
US FDA has made the primary endeavour to give regulations to evaluate AI systems in
order to overcome the problems.

The second problem is information exchange. To function properly, AI frameworks


should be prepared (ceaselessly) by information from clinical examinations. After
initial raining when the AI framework is deployed, supply of information continuously
turns into a critical concern for advance advancement and change in the framework.
Incentives for sharing information related to framework are not given by current
healthcare condition. By the by, a healthcare revolution is yet to approach in order to
invigorate information that is being shared in the USA. While there is much chance, AI
in therapeutic diagnostics is still a moderately new approach, with numerous clinicians
still left to be persuaded of its unwavering quality, affectability and how it will be
basically coordinated into clinical practice without undermining clinical expertise.
Experiment 2

AIM: Write a program to implement Breadth First Search.

RESOURCES REQUIRED: Visual Studio Code, Python.

THEORY:

Breadth First Search:

Breadth-first search is a graph traversal algorithm that starts traversing the graph
from the root node and explores all the neighboring nodes. Then, it selects the
nearest node and explores all the unexplored nodes. While using BFS for traversal,
any node in the graph can be considered as the root node.

There are many ways to traverse the graph, but among them, BFS is the most
commonly used approach. It is a recursive algorithm to search all the vertices of a
tree or graph data structure. BFS puts every vertex of the graph into two categories -
visited and non-visited. It selects a single node in a graph and, after that, visits all the
nodes adjacent to the selected node.

Algorithm:

Step 1: SET STATUS = 1 (ready state) for each node in G

Step 2: Enqueue the starting node A and set its STATUS = 2 (waiting state)

Step 3: Repeat Steps 4 and 5 until QUEUE is empty

Step 4: Dequeue a node N. Process it and set its STATUS = 3 (processed state).

Step 5: Enqueue all the neighbours of N that are in the ready state (whose STATUS =
1) and set their STATUS = 2(waiting state)
[END OF LOOP]

Step 6: EXIT

IMPLEMENTATION: from collections import deque

# Define a class to represent a graph

class Graph:

def _init_(self):

[Link] = {}

# Function to add an edge to the


graph def add_edge(self, u, v):
if u in [Link]:

[Link][u].append(v)
else:

[Link][u] = [v]

# Breadth First Search function

def bfs(self, start):


visited = set()

queue =

deque([start])

[Link](start)

while queue:

node =

[Link]()

print(node, end=' ')

for neighbor in [Link](node, []):

if neighbor not in visited:

[Link](neighbor)

[Link](neighbor)

# Example usage

if _name_ == "_main_":

# Create a graph

graph = Graph()

# Add edges to the graph

graph.add_edge('A', 'B')
graph.add_edge('A', 'C')
graph.add_edge('C', 'F')

graph.add_edge('E', 'F')

# Perform Breadth First Search from node 'A'

print("BFS Traversal:")
[Link]('A')

OUTPUT:

CONCLUSION: Hence we have successfully implemented the Breadth First Search Algorithm.
Experiment 3

AIM: Write a program to implement Depth First Search.

RESOURCES REQUIRED: Visual Studio Code, Python.

THEORY:
Depth First Search:

Depth-first search is an algorithm for traversing or searching tree or graph data


structures. The algorithm starts at the root node (selecting some arbitrary node as
the root node in the case of a graph) and explores as far as possible along each
branch before backtracking. So the basic idea is to start from the root or any arbitrary
node and mark the node and move to the adjacent unmarked node and continue this
loop until there is no unmarked adjacent node. Then backtrack and check for other
unmarked nodes and traverse them. Finally, print the nodes in the path.

Algorithm:

Step 1: SET STATUS = 1 (ready state) for each node in G

Step 2: Push the starting node A on the stack and set its STATUS = 2 (waiting state)

Step 3: Repeat Steps 4 and 5 until STACK is empty


Step 4: Pop the top node N. Process it and set its STATUS = 3 (processed state)

Step 5: Push on the stack all the neighbours of N that are in the ready state (whose
STATUS = 1) and set their STATUS = 2 (waiting state)

[END OF LOOP]

Step 6: EXIT

IMPLEMENTATION # Define a graph using adjacency list representation

graph = {
'A': ['B', 'C'],

'B': ['D', 'E'],

'C': ['F'],

'D': [],

'E': ['F'],

'F': []
}

# DFS function

def dfs(graph, start, visited=None):


if visited is None:

visited = set()

[Link](start)

print(start, end=' ')

for neighbor in

graph[start]: if neighbor

not in visited:
dfs(graph, neighbor, visited)

# Starting DFS from node 'A'

print("DFS Traversal:")

dfs(graph, 'A')

OUTPUT:

CONCLUSION: Hence we have successfully implemented the Depth First Search Algorithm.
[Link] = {}

# Function to add an edge to the graph


def add_edge(self, u, v, cost):
if u in [Link]:
[Link][u].append((v, cost))
else:
[Link][u] = [(v, cost)]

# Uniform Cost Search function


def ucs(self, start, goal):
visited = set()
pq = [(0, start, [])] # Priority queue (cost, node, path)

while pq:
cost, node, path = [Link](pq)

if node not in visited:


[Link](node)
path = path + [node]

if node == goal:
return path, cost

for neighbor, edge_cost in [Link](node, []):


if neighbor not in visited:
[Link](pq, (cost + edge_cost, neighbor, path))

# Example usage
if _name_ == "_main_":
# Create a graph
graph = Graph()

# Add edges to the graph


graph.add_edge('A', 'B', 4)
graph.add_edge('A', 'C', 2)
graph.add_edge('B', 'C', 5)
graph.add_edge('B', 'D', 10)
graph.add_edge('C', 'D', 3)

# Perform Uniform Cost Search from node 'A' to 'D'


start_node = 'A'
goal_node = 'D'
path, cost = [Link](start_node, goal_node)

if path:
print(f"Optimal path from {start_node} to {goal_node}: {' -> '.join(path)}")
print(f"Total cost:
{cost}") else:
print(f"No path found from {start_node} to {goal_node}")

OUTPUT:

CONCLUSION: Hence we have successfully completed implementing Uniform Cost


Search Algorithm.
Disadvantages:
It can behave as an unguided depth-first search in the worstcase scenario. It can get
stuck in a loop as DFS. This algorithm is not optimal.

IMPLEMENTATION:
import heapq

# Define a class to represent a graph


class Graph:
def _init_(self):
[Link] = {}

# Function to add an edge to the graph


def add_edge(self, u, v, cost):
if u in [Link]:
[Link][u].append((v, cost))
else:
[Link][u] = [(v, cost)]

# Uniform Greedy Best-First Search function


def ugbfs(self, start, goal, heuristic):
visited = set()
pq = [(heuristic[start], start, [])] # Priority queue (heuristic value, node, path)

while pq:
_, node, path = [Link](pq)

if node not in visited:


[Link](node)
path = path + [node]

if node == goal:
return path

for neighbor, _ in [Link](node, []):


if neighbor not in visited:
[Link](pq, (heuristic[neighbor], neighbor, path))

# Example usage
if _name_ == "_main_":
# Create a graph
graph = Graph()
# Add edges to the graph
graph.add_edge('A', 'B', 4)
graph.add_edge('A', 'C', 2)
graph.add_edge('B', 'C', 5)
graph.add_edge('B', 'D', 10)
graph.add_edge('C', 'D', 3)

# Define a heuristic function (estimated cost from each node to the goal)
heuristic = {'A': 7, 'B': 6, 'C': 2, 'D': 0}

# Perform Uniform Greedy Best-First Search from node 'A' to 'D' start_node
= 'A'
goal_node = 'D'
path = [Link](start_node, goal_node, heuristic)

if path:
print(f"Optimal path from {start_node} to {goal_node}: {' -> '.join(path)}")
else:
print(f"No path found from {start_node} to {goal_node}")

OUTPUT:
Optimal: A* search algorithm is optimal if it follows below two conditions:

Admissible: the first condition requires for optimality is that h(n) should be an admissible
heuristic for A* tree search. An admissible heuristic is optimistic in nature.

Consistency: Second required condition is consistency for only A* graph-search.

Advantages:

A* search algorithm is the best algorithm than other search algorithms. A* search algorithm is
optimal and complete. This algorithm can solve very complex problems.

Disadvantages:

It does not always produce the shortest path as it mostly based on heuristics and
approximation. A* search algorithm has some complexity issues. The main drawback
of A* is memory requirement as it keeps all generated nodes in the memory, so it is not
practical for various large-scale problems.
IMPLEMENTATION:

import heapq

# Define a class to represent a graph


class Graph:
def _init_(self):
[Link] = {}

# Function to add an edge to the graph


def add_edge(self, u, v, cost):
if u in [Link]:
[Link][u].append((v, cost))
else:
[Link][u] = [(v, cost)]

# A* search function
def astar(self, start, goal, heuristic):
visited = set()
pq = [(heuristic[start], start, [])] # Priority queue (f-value, node, path)

while pq:
_, node, path = [Link](pq)

if node not in visited:


[Link](node)
path = path + [node]
if node == goal:
return path

for neighbor, edge_cost in [Link](node, []):


if neighbor not in visited:
[Link](pq, (heuristic[neighbor] + edge_cost, neighbor, path))

# Example usage
if _name_ == "_main_":
# Create a graph
graph = Graph()

# Add edges to the graph


graph.add_edge('A', 'B', 4)
graph.add_edge('A', 'C', 2)
graph.add_edge('B', 'C', 5)
graph.add_edge('B', 'D', 10)
graph.add_edge('C', 'D', 3)

# Define a heuristic function (estimated cost from each node to the goal)
heuristic = {'A': 7, 'B': 6, 'C': 2, 'D': 0}

# Perform A* search from node 'A' to 'D'


start_node = 'A'
goal_node = 'D'
path = [Link](start_node, goal_node, heuristic)

if path:
print(f"Optimal path from {start_node} to {goal_node}: {' -> '.join(path)}")
else:
print(f"No path found from {start_node} to {goal_node}")
OUTPUT:

CONCLUSION: Hence we have successfully completed implementing A* Algorithm.


:- Q.

P :- R.

If one clause is like :

P :- Q,R;S,T,U.

Is understood as

P :- (Q,R);(S,T,U).
Or can also be written as:

P :- Q,R.

P :- S,T,U.

Example: happy(lili) :- dances(lili). hungry(tom) :-


search_for_food(tom). friends(jack, bili) :-
lovesCricket(jack), lovesCricket(bili). goToPlay(ryan) :-
isClosed(school), free(ryan).

Queries: Queries are some questions on the relationships between objects and object
properties. So question can be anything, as given below:

• Is tom a cat?
• Does Kunal love to eat pasta?
• Is Lili happy?
• Will Ryan go to play?

So according to these queries, Logic programming language can find the answer and
return them.

IMPLEMENTATION:

Visit the website [Link] and download the SWI Prolog. Download
the Stable Version.

Install the SWI Prolog for Microsoft Windows of 64 bit.

Now accept the agreement and install the exe file.

Once the exe file is downloaded install the setup required for Prolog.
OUTPUT:

CONCLUSION: Hence we have successfully installed SWI prolog.


For Node F max(-3, -∞) => max(-3,-5) = -3

For node G max(0, -∞) = max(0, 7) = 7

Step3:

For node B= min(4,6) = 4 For

node C= min (-3, 7) = -3

Step4:

For node A max(4, -3)= 4


IMPLEMENTATION: find_max(X,

Y, X) :- X >= Y, !. find_max(X, Y,


Y) :- X < Y. find_min(X, Y, X) :- X

=< Y, !. find_min(X, Y, Y) :- X > Y.

find_max(100,200,Max).

OUTPUT:

CONCLUSION: Hence we have successfully implemented the MinMax algorithm using


SWI Prolog.
Experiment 9 AIM:

To deduce information from family tree.

RESOURCES REQUIRED: SWI Prolog.

THEORY:

Family Tree:

IMPLEMENTATION:

male(james1).
male(charles1).

male(charles2).

male(james2). male(george1).
female(catherine).
female(elizabeth).
female(sophia).
parent(charles1,
james1). parent(elizabeth,
james1). parent(charles2,
charles1). parent(catherine,
charles1). parent(james2,
charles1). parent(sophia,
elizabeth).

parent(george1, sophia).
Queries:

parent(charles1, george1).
parent(charles1,X). parent(X,charles1).

OUTPUT:

CONCLUSION: Hence we have successfully deduced the information from family tree
using SWI Prolog.
adjacent(3,2). adjacent(2,4). adjacent(4,2).
adjacent(3,4). adjacent(4,3). adjacent(4,5).
adjacent(5,4). Queries adjacent(2,3).
adjacent(5,3). adjacent(3,R).

Declare colorings for the regions in Prolog using unit clauses.


color(1,red,a). color(1,red,b). color(2,blue,a). color(2,blue,b).
color(3,green,a). color(3,green,b). color(4,yellow,a). color(4,blue,b).
color(5,blue,a). color(5,green,b).

To write a Prolog definition of a conflictive coloring, meaning that two adjacent regions
have the same color. For example, here is a Prolog clause, or rule to that effect.
conflict(Coloring) :- adjacent(X,Y), color(X,Color,Coloring), color(Y,Color,Coloring).

Queries:
conflict(a). conflict(b).

OUTPUT:

CONCLUSION: Hence we have successfully implemented Graph Coloring Algorithm


using SWI Prolog.
Experiment 11

AIM: Write a program to find factorial of a number using SWI Prolog.

RESOURCES REQUIRED: SWI Prolog.

THEORY:

Factorial:

The factorial (denoted or represented as n!) for a positive number or integer (which is
denoted by n) is the product of all the positive numbers preceding or equivalent to n
(the positive integer). The factorial function can be found in various areas of
mathematics, including algebra, mathematical analysis, and combinatorics.

In Mathematics, factorial is an important function, which is used to find how many


ways things can be arranged or the ordered set of numbers. The well known
interpolating function of the factorial function was discovered by Daniel Bernoulli. The
factorial concept is used in many mathematical concepts such as probability,
permutations and combinations, sequences and series, etc. In short, a factorial is a
function that multiplies a number by every number below it till 1. For example, the
factorial of 3 represents the multiplication of numbers 3, 2, 1, i.e. 3! = 3 × 2 × 1 and is
equal to 6. In this article, you will learn the mathematical definition of the factorial, its
notation, formula, examples and so on in detail.

The function of a factorial is defined by the product of all the positive integers before
and/or equal to n, that is:
n! = 1 2 3 (n-2) (n -1) n,

IMPLEMENTATION:

factorial(0,1). factorial(N,M)

:-

N>0, N1 is N-1, factorial(N1,


M1),

M is N*M1.

Queries: factorial(4,X).

OUTPUT:

CONCLUSION: Hence we have successfully implemented the program to find a factorial


of a number using SWI Prolog.

You might also like