0% found this document useful (0 votes)
21 views34 pages

AI Manual

The document is a laboratory manual for an Artificial Intelligence course in the Department of Computer Engineering, outlining the vision, mission, program outcomes, educational objectives, specific outcomes, and course outcomes. It includes a list of experiments related to AI applications and algorithms, detailing aims, theories, and implementation steps for various AI techniques. The manual serves as a guide for students to understand and apply AI concepts through practical experiments.
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)
21 views34 pages

AI Manual

The document is a laboratory manual for an Artificial Intelligence course in the Department of Computer Engineering, outlining the vision, mission, program outcomes, educational objectives, specific outcomes, and course outcomes. It includes a list of experiments related to AI applications and algorithms, detailing aims, theories, and implementation steps for various AI techniques. The manual serves as a guide for students to understand and apply AI concepts through practical experiments.
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
You are on page 1/ 34

Department of Computer Engineering

Laboratory Manual
Artificial Intelligence

Subject Code :- (CSC604)

Year Sem- (TE SEM-VI (R-2019))

AI(2021-2022) 1 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

VISION
To become a leading department committed to nurture student centric learning through
outcome and skill based transformative IT education to create Technocrats and leaders
for the service of society.
MISSION
M1: To shape ourselves into a learning community to flourish leadership, team spirit,
ethics, listen and respect each other.
M2: To provide computer educational experience that transforms student through
rigorous course work and by providing an understanding of the need of the society
and industry.
M3: To educate students to be professionally IT competent for industry and research
program by providing industry institute interaction.
M4: To strive for excellence among students by infusing a sense of excitement in
Computer innovation, invention, design, creation and entrepreneurship.
M5: To contribute in the service of society by participation of faculty, staff and

students in socio-economic and socio-cultural activities.

AI(2021-2022) 2 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

PROGRAM OUTCOMES (POs) OF UNDERGRADUATE PROGRAM

PO.1 Engineering knowledge: Apply the knowledge of mathematics, science, engineering

fundamentals, and an engineering specialization to the solution of complex engineering

problems.

PO.2 Problem analysis: Identify, formulate, review research literature, and analyze

complex engineering problems reaching substantiated conclusions using first principles of

mathematics, natural sciences, and engineering sciences.

PO.3 Design/development of solutions: Design solutions for complex engineering

problems and design system components or processes that meet the specified needs with

appropriate consideration for the public health and safety, and the cultural, societal, and

environmental considerations.

PO.4 Conduct investigations of complex problems: Use research-based knowledge and

research methods including design of experiments, analysis and interpretation of data, and

synthesis of the information to provide valid conclusions.

PO.5 Modern tool usage: Create, select, and apply appropriate techniques, resources, and

modern engineering and IT tools including prediction and modeling to complex engineering

activities with an understanding of the limitations.

PO.6 The engineer and society: Apply reasoning informed by the contextual knowledge

to assess societal, health, safety, legal and cultural issues and the consequent responsibilities

relevant to the professional engineering practice.

AI(2021-2022) 3 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

PO.7 Environment and sustainability: Understand the impact of the professional

engineering solutions in societal and environmental contexts, and demonstrate the knowledge

of, and need for sustainable development.

PO.8 Ethics: Apply ethical principles and commit to professional ethics and

responsibilities and norms of the engineering practice.

PO.9 Individual and team work: Function effectively as an individual, and as a member

or leader in diverse teams, and in multidisciplinary settings.

PO.10 Communication: Communicate effectively on complex engineering activities with

the engineering community and with society at large, such as, being able to comprehend and

write effective reports and design documentation, make effective presentations, and give and

receive clear instructions.

PO.11 Project management and finance: Demonstrate knowledge and understanding of

the engineering and management principles and apply these to one’s own work, as a member

and leader in a team, to manage projects and in multidisciplinary environments.

PO.12 Life-long learning: Recognize the need for, and have the preparation and ability to

engage in independent and life-long learning in the broadest context of technological change.

AI(2021-2022) 4 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Program Educational Objectives (PEOs)


PEO 1. To prepare the Learner with a sound foundation in the mathematical, scientific
and engineering fundamentals.
PEO 2. To motivate the Learner in the art of self-learning and to use modern tools for
solving real life problems.

PEO 3. To equip the Learner with broad education necessary to understand the impact

of Computer Science and Engineering in a global and social context.

PEO 4. To encourage, motivate and prepare the Learners for Life long learning.

PEO 5. To inculcate professional and ethical attitude, good leadership qualities and
commitment to social responsibilities in the Learners thought process.

Program Specific Outcomes (PSOs)


1. An ability to apply the knowledge of computer engineering for the design and
development of IoT system.
2. An ability to solve complex computer Engineering problems using latest
technical tools to achieve optimized solutions.

AI(2021-2022) 5 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

COURSE OUTCOMES:

Outcomes: Learner will be able to

1. Ability to develop a basic understanding of AI building blocks presented in

intelligent agents.

2. Ability to choose an appropriate problem solving method and knowledge

representation technique.

3. Ability to analyze the strength and weaknesses of AI approaches to knowledge–

intensive problem solving.

4. Ability to design models for reasoning with uncertainty as well as the use of

unreliable information.

5. Ability to design and develop AI applications in real world scenarios.

AI(2021-2022) 6 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

LIST OF EXPERIMENTS

Sr.No Title of Experiment CO PO


Case study on AI applications published in
1. 1 1,3
IEEE/ACM/Springer journal
2. Assignments on state space formulation and
PEAS representation for various AI 1 1-5
Applications.
3. Implementation of BFS/DFS 2 1-5
4. Implementation of greedy Best First Search 2,3 1-5
5. Implementation of A* algorithm 2,3 1-5
6. Implementation of Hill climbing 2,3 1-5
7. Implementation of Min-Max algorithm 2,3 2-5
8.
To implement Alpha-Beta algorithm 2,3 2-5
9.
Study and implement genetic algorithm 3 1-5

AI(2021-2022) 7 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

EXPERIMENT NUMBER: 1
Name:-
Div & Roll No.:-
Date:-

AIM: Case Study on Expert System.

THEORY:
1. Title of Technical paper
2. Literature Review Summery

3. System Architecture

4. Methods and technology

CONCLUSION:

AI(2021-2022) 8 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

EXPERIMENT N0: 2

Name:-
Div & Roll No.:-
Date:-

AIM: Assignments on state space formulation and PEAS representation for various AI
Applications.

Design of intelligent system Using PEAS

1. Automated Taxi Driver

Explanation with suitable example.

2. An Aircraft Auto lander


Explanation with suitable example.

3. An Essay Evaluator

Explanation with suitable example.

4. Medical Diagnosis system

Explanation with suitable example.

Conclusion:

AI(2021-2022) 9 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

EXPERIMENT N0: 3

AIM: Implementation of DFS using Python

Theory:
Depth First Search(DFS)

Depth-first search (DFS) is an algorithm for traversing or searching a tree, tree structure, or graph.
One starts at the root (selecting some node as the root in the graph case) and explores as far as
possible along each branch before backtracking.

The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of
agraph) 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 then odeandmove to the adjacent unmark
ednode and continue this loop until there is no unmarked adjacent node. Then backtrack and check
for other unmark ednode sand traverse them. Finally print then odesin the path.

Time Complexity of DFS:O(V+E)


Tree diagram:

Intheabovetreethenodeswillbevisitedinthefollowingorder:

1.

AI(2021-2022) 10 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

2.

3.

4.

5.

AI(2021-2022) 11 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Program:

graph = {
'A': ['B', 'C', "D"],
'B': ['E', "F"],
'C': ['G', "I"],
'D': ["I"],
'E': [],
"F": [],
'G': [],
"I": []
}

def bfs(visit_complete, graph, current_node):


visit_complete.append(current_node)
queue = []
queue.append(current_node)

while queue:
s = queue.pop(0)
print(s)

for neighbour in graph[s]:


if neighbour not in visit_complete:
visit_complete.append(neighbour)
queue.append(neighbour)

bfs([], graph, 'A')

Output:

Conclusion:

AI(2021-2022) 12 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

EXPERIMENT NUMBER: 4
Name:-
Div & Roll No.:-
Date:-

AIM: Implementation of Greedy Best First Search

Theory:

Best-first Search Algorithm (Greedy Search):


Greedy best-first search algorithm always selects the path which appears best at that moment. It is the
combination of depth-first search and breadth-first search algorithms. It uses the heuristic function and
search. Best-first search allows us to take the advantages of both algorithms. With the help of best-first
search, at each step, we can choose the most promising node. In the best first search algorithm, we expand
the node which is closest to the goal node and the closest cost is estimated by heuristic function, i.e.

1. f(n)= g(n).

Were, h(n)= estimated cost from node n to the goal.

The greedy best first algorithm is implemented by the priority queue.

Best first search algorithm:


o Step 1: Place the starting node into the OPEN list.
o Step 2: If the OPEN list is empty, Stop and return failure.
o Step 3: Remove the node n, from the OPEN list which has the lowest value of h(n), and places it in
the CLOSED list.
o Step 4: Expand the node n, and generate the successors of node n.
o Step 5: Check each successor of node n, and find whether any node is a goal node or not. If any
successor node is goal node, then return success and terminate the search, else proceed to Step 6.
o Step 6: For each successor node, algorithm checks for evaluation function f(n), and then check if
the node has been in either OPEN or CLOSED list. If the node has not been in both list, then add it
to the OPEN list.

AI(2021-2022) 13 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

o Step 7: Return to Step 2.

Advantages:
o Best first search can switch between BFS and DFS by gaining the advantages of both the
algorithms.
o This algorithm is more efficient than BFS and DFS algorithms.

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

Example:
Consider the below search problem, and we will traverse it using greedy best-first search. At each iteration,
each node is expanded using evaluation function f(n)=h(n) , which is given in the below table.

AI(2021-2022) 14 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

In this search example, we are using two lists which are OPEN and CLOSED Lists. Following are the
iteration for traversing the above example.

AI(2021-2022) 15 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Expand the nodes of S and put in the CLOSED list

Initialization: Open [A, B], Closed [S]

Iteration 1: Open [A], Closed [S, B]

Iteration 2: Open [E, F, A], Closed [S, B]


: Open [E, A], Closed [S, B, F]

Iteration 3: Open [I, G, E, A], Closed [S, B, F]


: Open [I, E, A], Closed [S, B, F, G]

Hence the final solution path will be: S----> B----->F----> G

Time Complexity: The worst case time complexity of Greedy best first search is O(bm).

Space Complexity: The worst case space complexity of Greedy best first search is O(bm). Where,
m is the maximum depth of the search space.

Complete: Greedy best-first search is also incomplete, even if the given state space is finite.

Optimal: Greedy best first search algorithm is not optimal.

AI(2021-2022) 16 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Program:

Output:

Conclusion:

EXPERIMENT NUMBER: 5
Name:-
Div & Roll No.:-
AI(2021-2022) 17 Subject Incharge: Prof. D.S.Kale/Dr.
S.N.Rathod
Department of Computer Engineering

Date:-

AIM: Implementation of A* algorithm

Theory:

A* search is the most commonly known form of best-first search. It uses heuristic function h(n),
and cost to reach the node n from the start state g(n). It has combined features of UCS and
greedy best-first search, by which it solve the problem efficiently. A* search algorithm finds the
shortest path through the search space using the heuristic function. This search algorithm
expands less search tree and provides optimal result faster. A* algorithm is similar to UCS
except that it uses g(n)+h(n) instead of g(n).

In A* search algorithm, we use search heuristic as well as the cost to reach the node. Hence
we can combine both costs as following, and this sum is called as a fitness number.

Algorithm of A* search:
Step1: Place the starting node in the OPEN list.

Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure and stops.

Step 3: Select the node from the OPEN list which has the smallest value of evaluation function
(g+h), if node n is goal node then return success and stop, otherwise

Step 4: Expand node n and generate all of its successors, and put n into the closed list. For each
successor n', check whether n' is already in the OPEN or CLOSED list, if not then compute
evaluation function for n' and place into Open list.

Step 5: Else if node n' is already in OPEN and CLOSED, then it should be attached to the back
pointer which reflects the lowest g(n') value.

Step 6: Return to Step 2.

AI(2021-2022) 18 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

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

Disadvantages:
o It does not always produce the shortest path as it mostly based on heuristics and approximation.
o A* search algorithm has some complexity issues.
o 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.

Example:
In this example, we will traverse the given graph using the A* algorithm. The heuristic value of all states is
given in the below table so we will calculate the f(n) of each state using the formula f(n)= g(n) + h(n), where
g(n) is the cost to reach any node from start state.
Here we will use OPEN and CLOSED list.

Solution:

AI(2021-2022) 19 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Initialization: {(S, 5)}

Iteration1: {(S--> A, 4), (S-->G, 10)}

Iteration2: {(S--> A-->C, 4), (S--> A-->B, 7), (S-->G, 10)}

Iteration3: {(S--> A-->C--->G, 6), (S--> A-->C--->D, 11), (S--> A-->B, 7), (S-->G, 10)}

Iteration 4 will give the final result, as S--->A--->C--->G it provides the optimal path with cost 6.

Points to remember:

o A* algorithm returns the path which occurred first, and it does not search for all remaining paths.
o The efficiency of A* algorithm depends on the quality of heuristic.
o A* algorithm expands all nodes which satisfy the condition f(n)<="" li="">

Complete: A* algorithm is complete as long as:

o Branching factor is finite.

AI(2021-2022) 20 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

o Cost at every action is fixed.

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

o 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.
o Consistency: Second required condition is consistency for only A* graph-search.

If the heuristic function is admissible, then A* tree search will always find the least cost path.

Time Complexity: The time complexity of A* search algorithm depends on heuristic function, and
the number of nodes expanded is exponential to the depth of solution d. So the time complexity is
O(b^d), where b is the branching factor.

Space Complexity: The space complexity of A* search algorithm is O(b^d)

Program:

Output:

Conclusion:

EXPERIMENT NUMBER: 6
Name:-
Div & Roll No.:-
Date:-
AI(2021-2022) 21 Subject Incharge: Prof. D.S.Kale/Dr.
S.N.Rathod
Department of Computer Engineering

AIM: Implementation of Hill climbing

Theory:

 Hill climbing algorithm is a local search algorithm which continuously moves in the direction of
increasing elevation/value to find the peak of the mountain or best solution to the problem. It
terminates when it reaches a peak value where no neighbor has a higher value.
 Hill climbing algorithm is a technique which is used for optimizing the mathematical problems.
One of the widely discussed examples of Hill climbing algorithm is Traveling-salesman Problem
in which we need to minimize the distance traveled by the salesman.
 It is also called greedy local search as it only looks to its good immediate neighbor state and not
beyond that.
 A node of hill climbing algorithm has two components which are state and value.
 Hill Climbing is mostly used when a good heuristic is available.
 In this algorithm, we don't need to maintain and handle the search tree or graph as it only keeps a
single current state.

Features of Hill Climbing:


Following are some main features of Hill Climbing Algorithm:

o Generate and Test variant: Hill Climbing is the variant of Generate and Test method. The
Generate and Test method produce feedback which helps to decide which direction to move in the
search space.
o Greedy approach: Hill-climbing algorithm search moves in the direction which optimizes the cost.
o No backtracking: It does not backtrack the search space, as it does not remember the previous
states.

State-space Diagram for Hill Climbing:

AI(2021-2022) 22 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

The state-space landscape is a graphical representation of the hill-climbing algorithm which is


showing a graph between various states of algorithm and Objective function/Cost.

On Y-axis we have taken the function which can be an objective function or cost function, and
state-space on the x-axis. If the function on Y-axis is cost then, the goal of search is to find the
global minimum and local minimum. If the function of Y-axis is Objective function, then the goal of
the search is to find the global maximum and local maximum.

Different regions in the state space landscape:

Local Maximum: Local maximum is a state which is better than its neighbor states, but there is
also another state which is higher than it.

Global Maximum: Global maximum is the best possible state of state space landscape. It has the
highest value of objective function.

Current state: It is a state in a landscape diagram where an agent is currently present.

Flat local maximum: It is a flat space in the landscape where all the neighbor states of current
states have the same value.

Shoulder: It is a plateau region which has an uphill edge.

Types of Hill Climbing Algorithm:


o Simple hill Climbing:

AI(2021-2022) 23 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

o Steepest-Ascent hill-climbing:
o Stochastic hill Climbing:

Algorithm for Simple Hill Climbing:


o Step 1: Evaluate the initial state, if it is goal state then return success and Stop.
o Step 2: Loop Until a solution is found or there is no new operator left to apply.
o Step 3: Select and apply an operator to the current state.
o Step 4: Check new state:

1. If it is goal state, then return success and quit.


2. Else if it is better than the current state then assign new state as a current state.
3. Else if not better than the current state, then return to step2.
o Step 5: Exit.

Program:

Output:

Conclusion:

EXPERIMENT NUMBER: 7

AI(2021-2022) 24 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Name:-
Div & Roll No.:-
Date:-

AIM: Implementation of Min-Max algorithm

Theory:

 Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-


making and game theory. It provides an optimal move for the player assuming that
opponent is also playing optimally.
 Mini-Max algorithm uses recursion to search through the game-tree.
 Min-Max algorithm is mostly used for game playing in AI. Such as Chess, Checkers, tic-
tac-toe, go, and various tow-players game. This Algorithm computes the minimax
decision for the current state.
 In this algorithm two players play the game, one is called MAX and other is called MIN.
 Both the players fight it as the opponent player gets the minimum benefit while they get
the maximum benefit.
 Both Players of the game are opponent of each other, where MAX will select the
maximized value and MIN will select the minimized value.
 The minimax algorithm performs a depth-first search algorithm for the exploration of the
complete game tree.
 The minimax algorithm proceeds all the way down to the terminal node of the tree, then
backtrack the tree as the recursion.

Pseudo-code for MinMax Algorithm:


1. function minimax(node, depth, maximizingPlayer) is
2. if depth ==0 or node is a terminal node then
AI(2021-2022) 25 Subject Incharge: Prof. D.S.Kale/Dr.
S.N.Rathod
Department of Computer Engineering

3. return static evaluation of node


4.
5. if MaximizingPlayer then // for Maximizer Player
6. maxEva= -infinity
7. for each child of node do
8. eva= minimax(child, depth-1, false)
9. maxEva= max(maxEva,eva) //gives Maximum of the values
10. return maxEva
11.
12. else // for Minimizer player
13. minEva= +infinity
14. for each child of node do
15. eva= minimax(child, depth-1, true)
16. minEva= min(minEva, eva) //gives minimum of the values
17. return minEva

AI(2021-2022) 26 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Program:

Output

Conclusion:

AI(2021-2022) 27 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

EXPERIMENT NUMBER: 8
Name:-
Div & Roll No.:-
Date:-

AIM: To implement Alpha-Beta algorithm

Theory:

Alpha-Beta Pruning
o Alpha-beta pruning is a modified version of the minimax algorithm. It is an optimization
technique for the minimax algorithm.
o As we have seen in the minimax search algorithm that the number of game states it has
to examine are exponential in depth of the tree. Since we cannot eliminate the exponent,
but we can cut it to half. Hence there is a technique by which without checking each node
of the game tree we can compute the correct minimax decision, and this technique is
called pruning. This involves two threshold parameter Alpha and beta for future
expansion, so it is called alpha-beta pruning. It is also called as Alpha-Beta Algorithm.
o Alpha-beta pruning can be applied at any depth of a tree, and sometimes it not only prune
the tree leaves but also entire sub-tree.
o The two-parameter can be defined as:

 Alpha: The best (highest-value) choice we have found so far at any point
along the path of Maximizer. The initial value of alpha is -∞.
 Beta: The best (lowest-value) choice we have found so far at any point
along the path of Minimizer. The initial value of beta is +∞.

o The Alpha-beta pruning to a standard minimax algorithm returns the same move as the
standard algorithm does, but it removes all the nodes which are not really affecting the
final decision but making algorithm slow. Hence by pruning these nodes, it makes the
algorithm fast.

AI(2021-2022) 28 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Condition for Alpha-beta pruning:

The main condition which required for alpha-beta pruning is:

α>=β

Key points about alpha-beta pruning:


o The Max player will only update the value of alpha.

o The Min player will only update the value of beta.

o While backtracking the tree, the node values will be passed to upper nodes instead of values of
alpha and beta.
o We will only pass the alpha, beta values to the child nodes.

Pseudo-code for Alpha-beta Pruning:

1. function minimax(node, depth, alpha, beta, maximizingPlayer) is


2. if depth ==0 or node is a terminal node then
3. return static evaluation of node
4.
5. if MaximizingPlayer then // for Maximizer Player
6. maxEva= -infinity
7. for each child of node do
8. eva= minimax(child, depth-1, alpha, beta, False)
9. maxEva= max(maxEva, eva)
10. alpha= max(alpha, maxEva)
11. if beta<=alpha
12. break
13. return maxEva
14.
15. else // for Minimizer player
16. minEva= +infinity

AI(2021-2022) 29 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

17. for each child of node do


18. eva= minimax(child, depth-1, alpha, beta, true)
19. minEva= min(minEva, eva)
20. beta= min(beta, eva)
21. if beta<=alpha
22. break
23. return minEva

Program:

Output:

AI(2021-2022) 30 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Conclusion:

EXPERIMENT NUMBER: 9
Name:-
Div & Roll No.:-
Date:-

AIM: To implement Genetic algorithm

Theory:

Genetic algorithms (GAs) are a class of search algorithms designed on the natural evolution
process. Genetic Algorithms are based on the principles of survival of the fittest.

A Genetic Algorithm method inspired in the world of Biology, particularly, the Evolution Theory
by Charles Darwin, is taken as the basis of its working. John Holland introduced the Genetic
Algorithm in 1975. Genetic Algorithms are utilized to tackle optimization problems by copying
the evolutionary behavior of species. From an initial random population of solutions, this
population is advanced through selection, mutation, and crossover operators, inspired in
natural evolution. By implementing the given set of operations, the population goes through an
iterative procedure in which it reaches various states, and each one is called generation. As a
result of this procedure, the population is expected to reach a generation in which it contains a
decent solution to the problem. In the Genetic Algorithm, the solution of the problem is coded
as a string of bits or real numbers.

They have been shown in practice to be very efficient at functional optimization. It is used in
searching for huge and sophisticated spaces. Genetic algorithms (GAs) are algorithms that are
used for optimization and machine learning based on various features of biological evolution.

They need the given components:


o A process of coding solutions to solve the problem of chromosomes.
o An evaluation function that recovers a rating for each chromosome given to it.
o Operators that may be implemented to parents when they reproduce to alter their genetic
composition. The standard operators are mutation and crossover.
o Operators that may be implemented to parents when they reproduce to modify their genetic
composition. The standard operators are mutation and crossover.

AI(2021-2022) 31 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

AI(2021-2022) 32 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

Program:

Output:

Conclusion:

AI(2021-2022) 33 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod
Department of Computer Engineering

AI(2021-2022) 34 Subject Incharge: Prof. D.S.Kale/Dr.


S.N.Rathod

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy