Unit 1
Unit 1
UNIT-I
INTRODUCTION
ARTIFICIAL INTELLIGENCE
PROBLEM DEFINITION:
Problem definition in artificial intelligence (AI) is the process of clearly and
precisely defining a task or challenge that an AI system is intended to address.
This step is crucial for the successful development and deployment of AI
solutions. Here is a more detailed breakdown of the components involved in
problem definition:
**Understanding the Problem:**
- Begin by gaining a thorough understanding of the problem domain. This
involves identifying the key issues, challenges, and goals associated with the
problem. Engage with domain experts and stakeholders to gather insights.
**Problem Scope:**
- Clearly define the boundaries and limitations of the problem. Determine
what aspects will be included and excluded from the problem-solving process.
This helps in managing expectations and focusing efforts on a specific area.
**Stakeholder Requirements:**
- Identify the needs and requirements of the stakeholders who will benefit
from or be affected by the AI solution. Understanding their perspectives is
crucial for tailoring the solution to meet their expectations.
**Data Requirements:**
- Determine the type and quality of data needed for solving the problem.
Define the sources of data, data formats, and any preprocessing steps required to
make the data suitable for AI models.
**Formalization of the Problem:**
- Express the problem in a formal or mathematical framework. This involves
defining the inputs, outputs, and relationships between them. Formulating the
problem in a structured manner makes it amenable to computational
approaches.
**Success Criteria:**
- Establish clear criteria for evaluating the success of the AI solution. This
could involve defining performance metrics, accuracy thresholds, or other
relevant measures based on the goals of the project.
**Constraints:**
- Identify any constraints that need to be considered during the development
of the AI system. This could include resource constraints, ethical
considerations, legal requirements, or specific technical limitations.
**Risk Analysis:**
- Conduct a risk analysis to identify potential challenges, uncertainties, or
obstacles that may arise during the project. Understanding and addressing risks
early in the process can contribute to more effective problem-solving.
**Iterative Refinement:**
- Problem definition is often an iterative process. Refine and adjust the
problem definition as more information becomes available or as the project
progresses.
**Communication:**
- Clearly communicate the problem definition to all stakeholders, including
developers, domain experts, and end-users. Effective communication ensures
that everyone involved has a shared understanding of the problem and its
requirements.
By thoroughly defining the problem, AI practitioners can pave the way for the
development of effective and targeted solutions that align with the goals and
expectations of the stakeholders.
PRODUCTION SYSTEM:
Production system or production rule system is a computer program typically
used to provide some form of artificial intelligence, which consists primarily of
a set of rules about behavior but it also includes the mechanism necessary to
follow those rules as the system responds to states of the world.
Components of Production System
Global Database: The global database is the central data structure used
by the production system in Artificial Intelligence.
Set of Production Rules: The production rules operate on the global
database. Each rule usually has a precondition that is either satisfied or
not by the global database. If the precondition is satisfied, the rule is
usually be applied. The application of the rule changes the database.
A Control System: The control system then chooses which applicable
rule should be applied and ceases computation when a termination
condition on the database is satisfied. If multiple rules are to fire at the
same time, the control system resolves the conflicts.
2. Modularity: This means the production rule code the knowledge available in
discrete pieces. Information can be treated as a collection of independent facts
which may be added or deleted from the system with essentially no deleterious
side effects.
3. Modifiability: This means the facility for modifying rules. It allows the
development of production rules in a skeletal form first and then it is accurate to
suit a specific application.
CONTROL STRATEGIES:
GAME PLAYING:
MINI-MAX ALGORITHM
Step-1: In the first step, the algorithm generates the entire game-tree and apply
the utility function to get the utility values for the terminal states. In the below
tree diagram, let's take A is the initial state of the tree. Suppose maximizer takes
first turn which has worst-case initial value =- infinity, and minimizer will take
next turn which has worst-case initial value = +infinity.
Step 2: Now, first we find the utilities value for the Maximizer, its initial value
is -∞, so we will compare each value in terminal state with initial value of
Maximizer and determines the higher nodes values. It will find the maximum
among the all.
o For node D max(-1,- -∞) => max(-1,4)= 4
o For Node E max(2, -∞) => max(2, 6)= 6
o For Node F max(-3, -∞) => max(-3,-5) = -3
o For node G max(0, -∞) = max(0, 7) = 7
Step 3: In the next step, it's a turn for minimizer, so it will compare all nodes
value with +∞, and will find the 3rd layer node values.
o For node B= min(4,6) = 4
o For node C= min (-3, 7) = -3
Step 4: Now it's a turn for Maximizer, and it will again choose the maximum of
all nodes value and find the maximum value for the root node. In this game tree,
there are only 4 layers, hence we reach immediately to the root node, but in real
games, there will be more than 4 layers.
ALPHA-BETA PRUNING:
α>=β
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.
Step 1: At the first step the, Max player will start first move from node A where
α= -∞ and β= +∞, these value of alpha and beta passed down to node B where
again α= -∞ and β= +∞, and Node B passes the same value to its child D.
Step 2: At Node D, the value of α will be calculated as its turn for Max. The
value of α is compared with firstly 2 and then 3, and the max (2, 3) = 3 will be
the value of α at node D and node value will also 3.
Step 3: Now algorithm backtrack to node B, where the value of β will change as
this is a turn of Min, Now β= +∞, will compare with the available subsequent
nodes value, i.e. min (∞, 3) = 3, hence at node B now α= -∞, and β= 3
In the next step, algorithm traverse the next successor of Node B which is node
E, and the values of α= -∞, and β= 3 will also be passed.
Step 4: At node E, Max will take its turn, and the value of alpha will change.
The current value of alpha will be compared with 5, so max (-∞, 5) = 5, hence at
node E α= 5 and β= 3, where α>=β, so the right successor of E will be pruned,
and algorithm will not traverse it, and the value at node E will be 5.
Step 5: At next step, algorithm again backtrack the tree, from node B to node A. At
node A, the value of alpha will be changed the maximum available value is 3 as max
(-∞, 3)= 3, and β= +∞, these two values now passes to right successor of A which is
Node C.
At node C, α=3 and β= +∞, and the same values will be passed on to node F.
Step 6: At node F, again the value of α will be compared with left child which is 0,
and max(3,0)= 3, and then compared with right child which is 1, and max(3,1)= 3
still α remains 3, but the node value of F will become 1
Step 7: Node F returns the node value 1 to node C, at C α= 3 and β= +∞, here
the value of beta will be changed, it will compare with 1 so min (∞, 1) = 1. Now
at C, α=3 and β= 1, and again it satisfies the condition α>=β, so the next child of
C which is G will be pruned, and the algorithm will not compute the entire sub-
tree G.
Step 8: C now returns the value of 1 to A here the best value for A is max (3, 1)
= 3. Following is the final game tree which is the showing the nodes which are
computed and nodes which has never computed. Hence the optimal value for
the maximizer is 3 for this example.
HILL CLIMIBING:
Current State: Current State is the state where the agent is present
currently
Flat Local Maximum: This region is depicted by a straight line where all
neighbouring states have the same value so every node is local maximum
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:
o Step 1: Evaluate the initial state, if it is goal state then return success and
stop, else make current state as initial state.
o Step 2: Loop until a solution is found or the current state does not
change.
a. Let SUCC be a state such that any successor of the current state
will be better than it.
b. For each operator that applies to the current state:
2. Simulated Annealing:
Simulated annealing is a probabilistic variation of Hill Climbing
that allows the algorithm to occasionally accept worse moves in
order to avoid getting stuck in local maxima.
Simulated Annealing is a probabilistic optimization algorithm that
simulates the metallurgical annealing process in order to discover
the best solution in a given search area by accepting less-than-
ideal solutions with a predetermined probability.
Simulated annealing seeks the global optimum in a given search
space by accepting poorer answers with a predetermined
probability. This allows it to bypass local optimum conditions.
Simulated annealing explores the search space and avoids local
optimum by employing a probabilistic method to accept a worse
solution with a given probability. As the algorithm advances, the
likelihood of accepting an inferior answer diminishes.
Simulated annealing has a chance of escaping the local optimum
and locating the global optimum.
When the temperature hits a predetermined level or the maximum
number of repetitions, simulated annealing comes to an end.
Simulated annealing is more efficient at locating the global
optimum than Hill Climbing, particularly for complicated
situations with numerous local optima. Simulated annealing is
slower than Hill Climbing.
The beginning temperature, cooling schedule, and acceptance
probability function are only a few of the tuning factors for
Simulated Annealing.
Several fields, including logistics, scheduling, and circuit design,
use simulated annealing.
Below is the block diagram that represents the working of an expert system:
o User Interface
o Inference Engine
o Knowledge Base
1. User Interface
With the help of a user interface, the expert system interacts with the user, takes
queries as an input in a readable format, and passes it to the inference engine.
After getting the response from the inference engine, it displays the output to
the user. In other words, it is an interface that helps a non-expert user to
communicate with the expert system to find a solution.
o Forward Chaining: It starts from the known facts and rules, and applies
the inference rules to add their conclusion to the known facts.
o Backward Chaining: It is a backward reasoning method that starts from
the goal and works backward to prove the known facts.
3. Knowledge Base
Inference rules:
Inference rules are the templates for generating valid arguments. Inference rules
are applied to derive proofs in artificial intelligence, and the proof is a sequence
of the conclusion that leads to the desired goal.
In inference rules, the implication among all the connectives plays an important
role. Following are some terminologies related to inference rules:
2. Modus Tollens:
The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then ¬ P will also
true. It can be represented as:
4. Disjunctive Syllogism:
The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true, then Q will be
true. It can be represented as:
5. Addition:
The Addition rule is one the common inference rule, and it states that If P is true,
then P∨Q will be true.