Ai Unit 1
Ai Unit 1
UNIT-1
Artificial Intelligence
Artificial intelligence is the simulation of human intelligence processes by machines,especially computer
systems.
Artificial intelligence (AI) refers to computer systems capable of performing complextasks that historically
only a human could do, such as reasoning, making decisions, orsolving problems.
AI is the study of how to make computers do things which at the moment people dobetter.
AI currently encompasses a huge variety of subfields, from general-purpose areas suchas perception and
logical reasoning, to specific tasks such as playing chess, provingmathematical theorems, writing poetry,
and diagnosing diseases.
AI Technique
AI technique is a method that exploits knowledge that should be represented in such a way that:
Situations that share important properties are grouped together. If knowledge does not have this
property, inordinate amounts of memory and updating will be required.
Most of the knowledge a program has must ultimately be provided by people in terms they understand,
as bulk of the data for many programs can be acquired automatically
• It can easily be modified to correct errors and to reflect changes in the world and in our world view.
• It can be used in a great many situations even if it is not totally accurate or complete.
• It can be used to help overcome its own sheer bulk by helping to narrow the range of possibilities
that must usually be considered.
Problem-solving using AI
Problem-solving using AI involves applying various techniques to address complex issues. Here's a
breakdown of how AI can be used for problem-solving:
1. Defining the Problem: Clearly define the problem you want to solve. Whether it's optimizing a
process, making predictions, or automating tasks, understanding the problem is crucial.
1
2. Data Collection and Preparation: Gather relevant data that can help in solving the problem. This
could involve structured data (tables, databases) or unstructured data (text, images). Clean and
preprocess the data to ensure its quality and relevance.
● Machine Learning Models: If you have labeled data and want predictions/classifications,
choose suitable algorithms (like regression, decision trees, SVMs, or deep learning
models).
● Optimization Algorithms: For problems involving finding the best solution among many
options (like in logistics or resource allocation), optimization algorithms (genetic
algorithms, simulated annealing) might be useful.
● Natural Language Processing or Computer Vision: If dealing with text or visual data, use
NLP or computer vision techniques respectively to extract insights or patterns.
4. Model Training and Validation: Train your AI model on a portion of the data and validate its
performance on another part (testing dataset). This step ensures your model generalizes well to
new, unseen data.
5. Iterate and Refine: AI-based problem-solving often involves an iterative process. Analyze the
results, fine-tune the model parameters or algorithms, and retrain if necessary to improve
performance.
6. Deployment and Integration: Once satisfied with the model's performance, deploy it into the
operational environment. Integrate it into existing systems or workflows to solve the problem in
real-time.
7. Monitoring and Maintenance: Continuously monitor the AI system's performance. Over time,
data patterns might change, requiring retraining or updating the model to maintain its
effectiveness.
8. Ethical Considerations: Consider the ethical implications of the AI solution, such as bias, fairness,
privacy, and transparency. Ensure that the solution aligns with ethical standards.
AI Models
There are two fundamental approaches—semantic and statistical—underpin various models and
methodologies used in AI:
1. Semantic Models:
2
● Symbolic AI: Focuses on symbolic reasoning and knowledge representation. These
models use explicit rules and representations to understand and manipulate symbols,
often through logic-based approaches.
● Semantic Web Technologies (RDF, OWL): Standards and technologies used to represent
and link data on the web. RDF (Resource Description Framework) and OWL (Web
Ontology Language) enable structured and semantically rich data representation.
2. Statistical Models:
● Machine Learning: These models learn patterns and relationships from data. They don't
explicitly encode human-defined rules but instead learn them from the input-output
pairs.
● Deep Learning: A subset of machine learning utilizing neural networks with multiple
layers. Deep learning models can automatically learn representations from data,
enabling them to tackle complex tasks such as image recognition, language translation,
and more.
These two approaches are not mutually exclusive; often, they complement each other in AI
systems. For instance:
● Hybrid Models: Combine aspects of both semantic and statistical approaches. For example, a
system might use knowledge graphs (semantic) and machine learning algorithms (statistical) to
enhance recommendation systems or question answering.
Each approach has its strengths and weaknesses. Semantic models excel in explicit knowledge
representation and reasoning, making them interpretable but potentially limited by the
knowledge explicitly encoded. Statistical models, on the other hand, excel in learning complex
patterns from data but might lack interpretability and struggle with reasoning based on explicit
rules.
3
Machine Learning: Utilizing algorithms that enable systems to learn from data and improve over
time without explicit programming.
2. Computational Learning Theory:
Focuses on understanding the nature of learning from a computational perspective.
Involves studying the capabilities and limitations of learning algorithms.
3. Neural and Evolutionary Computation:
Deep Learning, Neural Networks: Mimic the workings of the human brain to process data and
identify patterns, using multiple layers of neural networks.
Evolutionary Algorithms: Problem-solving techniques inspired by principles of natural evolution
and genetics.
4. Intelligent Agents and Multi-Agent Systems:
Intelligent Agents: Programs designed to perform specific tasks autonomously and adaptively.
Multi-Agent Systems: Collections of multiple intelligent agents that interact to solve complex
problems collaboratively.
5. Multi-Perspective Integrated Intelligence:
Involves leveraging various AI methodologies and perspectives to address complex problems.
Integrating multiple AI techniques to gain a comprehensive understanding and solve intricate
challenges.
4
Problem solving technique involves
1. Problem definition
3. Planning
4. Execution
5. Evaluating solution
6. Consolidating gains
FORMULATING PROBLEMS
Problem formulation is the process of deciding what actions and states to consider, givena goal.
5
4. Path cost
A function that assigns a numeric cost to each path. The cost of a path can be described as the sum of
the costs of the individual actions along that path.
Step cost of taking an action ‗a‘ to go from one state ‗x‘ to state ‗y‘ is denoted by C(x,a,y)
C-Cost , x,y- states , Action , Step costs are non-negative
An optimal solution has lowest path cost among all solutions.
Total cost = Path cost + Search cost
PROBLEM TYPES
In AI and problem-solving, problems can be categorized based on their deterministic or
non-deterministic nature:
1. Deterministic Problems:
These problems have outcomes that are entirely determined by the initial state and subsequent actions
taken.
Examples:
Puzzle Solving: Problems with well-defined rules and clear paths from the initial state to the goal state
(e.g., Sudoku, Rubik's Cube).
Search Algorithms: Finding the shortest path between two points in a maze where the result depends
solely on the sequence of actions taken.
2. Non-Deterministic Problems:
Outcomes are influenced by randomness, uncertainty, or incomplete information.
Examples:
Uncertain Environments: Problems where the outcomes depend on factors beyond the agent's control,
leading to probabilistic results (e.g., stock market prediction, weather forecasting).
Adversarial Environments: Problems involving competition or conflict with an adversary, where the
opponent's actions are not entirely predictable (e.g., game playing against an opponent, like chess or
poker).
3. Stochastic Problems:
Problems that involve both deterministic and non-deterministic elements, with some randomness
involved in the outcomes.
Examples:
6
Stochastic Optimization: Problems that involve finding optimal solutions in the presence of randomness
or uncertainty (e.g., certain types of scheduling problems, Markov Decision Processes in reinforcement
learning).
4. Partially Observable Problems:
Problems where the agent does not have complete information about the current state of the
environment.
Examples:
Partial Information Environments: Situations where the agent's sensors provide incomplete or noisy
information about the environment, making decision-making more challenging (e.g., robotics in
environments with obscured vision or limited sensors).
PROBLEM CHARACTERISTICS
To choose the mostappropriate method for a particular problem, it is necessary to analyze the problem
along several keydimensions.
Some of the main key features of a problem are given below:
Is the problem decomposable into set of sub problems?
Is a good solution to the problem obvious without comparison to all the possible solutions?
Will the solution of the problem have required interaction between the computer and the
person?
The above characteristics of a problem are called as 7-problem characteristics under which the solution
must take place.
7
- Define a state space that contains all possible configurations of the relevant objects, without
enumerating all the states in it.
A state space represents a problem in terms of states and operators that change states.
- Define some of these states as possible initial states;
- Specify one or more as acceptable solutions, these are goal states;
- Specify a set of rules as the possible actions allowed. This involves thinking about the generality of the
rules, the assumptions made in the informal presentation and how much work can be anticipated by
inclusion in the rules.
The control strategy is again not fully discussed but the AI program needs a structure to facilitate the
search which is a characteristic of this type of program.
TOY PROBLEM:
E.G.,8-puzzle Problem
The 8-puzzle problem consists of a 3 x 3 board with eight numbered tiles and a blank space. A tile
adjacent to the blank space can slide into the space. The object is to reach a specified goalstate.
State-Space Representation:
States: A state description specifies the location of each of the eight tiles and the blank in one ofthe nine
squares.
Initial state: Any state can be designated as the initial state.
Successor function: This generates the legal states that result from trying the four actions (blankmoves
Left, Right, Up, or Down).
Goal test: This checks whether the state matches the goal configuration (Other goalconfigurations are
possible.)
Path cost: Each step costs 1, so the path cost is the number of steps in the path.
8
2. MISSIONARIES & CANNIBALS PROBLEM
In the missionaries and cannibals’ problem, three missionaries and three cannibals must cross a river
using a boat which can carry at most two people, under the constraint that, for both banks, if there are
missionaries present on the bank, they cannot be outnumbered by cannibals (if they were, the cannibals
would eat the missionaries). The boat cannot cross the river by itself with no people on board.
State-Space Representation:
Define the state as the number of missionaries and cannibals on each side of the river, boat's location,
and its capacity.
The initial state: 3 missionaries, 3 cannibals, boat on the original side, and the boat empty (3,3,1).
The goal state: 3 missionaries, 3 cannibals on the opposite side, boat on the opposite side (0,0,0).
Path Cost: Number of crossings.
Operators: Putting missionary and cannibals in boat such that missionary cannot be outnumbered by
cannibals and there may be one or 2 people in the boat.
Solution:
9
1. The primary argument for the system is the number of Missionaries (M), the number of
Cannibals (C) and the capacity of the boat (B). For the upper problem, the M=3, C=3 and B=2.
2. The system state can be uniquely defined by the state of missionaries, cannibals and the boat on
the left bank. In other words, [m=3, c=3, b=1] indicates there are 3 missionaries, 3 cannibals and
a one-person boat on the left bank. For the state of the other bank, it’s uniquely determined by
the left bank after crossing. Both banks need to always abide by the game's rules for all [m, c, b],
m>=0, c>=0, m>=c if m>0.
3. The number of valid crossing actions depends on the capacity of the boat and the state of the
departure ferry. If the capacity of a boat is 2, the possible states of the boat need to meet all of
the following conditions of the rules defined in #2:
10
3. Travelling Salesman problem
The problem involves finding the shortest possible route that visits a given set of cities and returns to the
original city, with the constraint that the salesperson must visit each city exactly once.
Given
● A set of some cities
● Distance between every pair of cities
State space –
for City C1 - { (C1—A ), ( C1 – B ), ( C1-- D) }
Solution :
● Optimal path is: A → C → D → B → A
● Cost of Optimal path = 25 units
11