Uploaded by Rittika Mitra

ai unit 1

advertisement
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
Artificial Intelligence (21CSC206T)
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:
• The knowledge captures generalizations.
Situations that share important properties are grouped together. If knowledge does not have this
property, inordinate amounts of memory and updating will be required.
• It can be understood by people who must provide it.
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
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
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.
3. Choosing the Right Technique:
•
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
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
•
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.
•
Knowledge Graphs: Represent information in the form of entities and relationships.
They encode semantic meaning by connecting entities through relationships, allowing
for sophisticated queries and inference.
•
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.
•
Probabilistic Models: Represent uncertainty and probability distributions. Bayesian
networks and probabilistic graphical models are used to model complex systems where
uncertainty is inherent.
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.
Data Acquisition and Learning Aspect in AI
1. Knowledge discovery
Data Mining: Analyzing large datasets to identify patterns, correlations, and valuable insights.
3
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
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.
Problem Solving Process in AI
Problem solving may be characterized as a systematic search through a range of possible actions to
reach some predefined goal or solution. Problem-solving methods are categorized as :
1. General purpose – Applicable to wide variety of problems - General AI
2. Special purpose – Modeled specific to a problem - Narrow AI
4
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
Problem solving technique involves
1. Problem definition
2. Problem analysis and representation
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.
A problem can be defined formally by four components:
1. Initial state
The starting state which agent knows itself.
2. Successor function
A description of the possible actions available to the agent.
State x, successor – FN (x) returns a set of < action, successor> ordered pairs,
where
each action is a legal action in a state x and each successor is a state that can be reached from x
by applying that action.
State Space
The set of all possible states reachable from the initial state by any sequence of actions. The
initial state and successor function defines the state space. The state space forms a graph in
which nodes are state and axis between the nodes are action.
Path
A path in the state space is a sequence of state connected by a sequence of actions.
3. Goal test
Test to determine whether the given state is the goal state. If there is an explicit set of possible goal
states, then we can whether any one of the goal state is reached or not.
5
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
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 nondeterministic 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
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
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?
➢ Can the solution step be ignored or undone?
➢ Is the problem universally predictable?
➢ Is a good solution to the problem obvious without comparison to all the possible solutions?
➢ Is the desire solution a state of world or a path to a state?
➢ Is a large amount of knowledge absolutely required to solve the problem?
➢ 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.
PROBLEM SPACE & SEARCH
Building a system to solve a problem requires the following steps:
1. Define the problem precisely including detailed specifications and what constitutes an
acceptable solution.
2. Analyze the problem thoroughly for some features may have a dominant affect on the chosen
method of solution.
3. Isolate and represent the background knowledge needed in the solution of the problem
4. Choose the best problem-solving techniques in the solution.
Formal description of a problem
- 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;
7
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
- 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
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
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
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
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:
(p+q)<=B : a boat can carry at most B people.
(p=0 OR (p>0 AND p>=q)): cannibals can’t outnumber the missionaries on the boat if there is any
missionary.
NOT (p=0 AND q=0): the boat cannot cross the river by itself with no people.
So, we get following actions table for river crossing:
(p, q)
0
1
2
0
(0, 0)
(0, 1)
(0, 2)
1
(1,0)
(1,1)
(1,2)
2
(2,0)
(2,1)
(2,2)
10
21CSC206T
ARTIFICIAL INTELLIGENCE
NEHA G
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
Travelling Salesman Problem states-
•
•
•
A salesman has to visit every city exactly once.
He has to come back to the city from where he starts his journey.
What is the shortest possible route that the salesman must follow to complete his tour?
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
Download