Download artifical intelligence and more Schemes and Mind Maps Artificial Intelligence in PDF only on Docsity!
UNIT IV
Planning with state space search
State-space search is an essential concept in classical AI planning. It provides a formal structure for generating and evaluating plans by exploring all possible states and actions in a problem domain. State-space search is a method of finding a sequence of actions that lead from an initial state to a goal state. State-space search is a fundamental method in AI for planning and problem-solving. By representing a problem as a series of states, actions, and transitions, state-space search enables agents to explore possible solutions and find the best path from an initial state to a goal state. Key Concepts: - State: Represents a configuration of the world at a given time. Action: A transition between two states. State-Space: The set of all possible states that can be reached by applying actions from the initial state. Goal State: The desired configuration of the world. Initial State: The starting configuration of the world. Plan: A sequence of actions that transforms the initial state to the goal state.
Basic Elements of State-Space Planning
1. States - A state in a planning problem represents a particular configuration of the world.
For example, in a robot navigation task, a state could represent the robot's position on a grid. States can be represented in various ways:- ⮚ Propositional Logic: States are represented as a set of propositions, where each proposition indicates whether a certain fact holds in the world. ⮚ First-Order Logic: More complex states can be represented with predicates and functions. ⮚ Factored State Representations: States are represented as a set of variables (e.g., the position of the robot, the load of the robot, etc.).
2. Actions- An action describes a transition between two states.
It is typically defined by: ⮚ Preconditions: The conditions that must be true for the action to be executed. ⮚ Effects: The changes that the action makes to the state. For example, in a robot navigation problem, an action might be "move forward," with the precondition that the robot must not be at the edge of the grid and the effect being the robot’s new position on the grid. Artificial Intelligence [CST-022]
3. State-Space- The state space is the set of all possible states that can be reached by applying a
sequence of actions. Each action leads to a new state, and the entire collection of states, along with the transitions between them, forms the state-space. ⮚ Graph Representation: State-space is often represented as a graph, where each node is a state, and edges represent actions that transition from one state to another. ⮚ Search Space: The search space is the subset of the state space that is explored during the planning process.
4. Goals- A goal state is the desired end configuration of the world. The task is to find a sequence
of actions that will transform the initial state into a goal state. ⮚ Single Goal: The goal is a single state. ⮚ Multiple Goals: The goal may consist of several conditions that must be satisfied simultaneously. ⮚ Partial Goals: The goal is specified by a subset of conditions, and the planner has flexibility in achieving them. Search Algorithms for Planning Planning problems are typically solved using search algorithms that explore the state space to find a path from the initial state to the goal state. Several search algorithms are commonly used in planning:
1. Uninformed Search Algorithms- Uninformed search algorithms do not use any domain
specific knowledge (other than the definition of the state space). These algorithms explore the state space blindly. ⮚ Breadth-First Search (BFS) ⮚ Depth-First Search (DFS) ⮚ Uniform Cost Search (UCS)
2. Informed (Heuristic) Search Algorithms - Informed search algorithms use heuristics
(domain-specific knowledge) to guide the search. This helps the search focus on more promising areas of the state space. ⮚ A* Search ⮚ Greedy Best-First Search ⮚ Iterative Deepening Search Challenges in State-Space Planning While state-space search is a powerful method, it comes with several challenges:
- State Explosion Problem- The state-space can grow exponentially, especially in problems with many possible states and actions. This makes searching the state-space infeasible for large problems.
- Contingencies: The planner must be able to choose between different courses of action depending on the outcomes of previous actions. These are often modeled as decision points in the plan.
- Conditional Actions: Actions in a conditional plan are linked to specific conditions. For example, "if condition X holds, do action A; otherwise, do action B.
- Branches in the Plan: The plan may involve different branches or sub-plans, depending on the state of the world after each action. Frameworks and Techniques
- STRIPS: While STRIPS (Stanford Research Institute Problem Solver) is a classical planning formalism, it can be extended to handle conditional planning by including conditional effects —where an effect of an action is contingent on the current state.
- Non-deterministic Planning: This involves dealing with actions that have non-deterministic outcomes. For example, a robot may have a 70% chance of reaching its goal but a 30% chance of failing. Planning under uncertainty requires branching and reasoning about possible outcomes at each step.
- Plan Revision: In conditional planning, a plan is not fixed but can be revised as new information becomes available during execution.
- Partial-Order Planning: A technique that allows for flexibility in the order of actions. It is often used in conjunction with conditional planning because the planner can delay certain decisions until more information is available about the world state. Structure of a Conditional Plan A conditional plan can be visualized as a tree structure where: ⮚ The root represents the initial state. ⮚ The nodes represent actions or conditions (decision points). ⮚ The edges represent the possible outcomes of an action or condition. A key feature of a conditional plan is that it includes branches that specify different sets of actions depending on the state of the world. Plan Representation and Execution Conditional plans are typically represented using contingency trees or decision graphs. These structures help to visualize the branching of actions based on observed conditions.
Example Plan Representation (contingency tree):
Start - > Check item detection
/ \
Detected Not Detected | | Pick Item Move and Check Again
Example
Consider a robot in a warehouse trying to retrieve an item. The robot has several possible actions: - Move forward.
- Turn left or right.
- Pick up an item. The robot has sensors to detect if it’s near the item, but these sensors are not always reliable, so there are contingencies:
- If the robot detects the item, it picks it up.
- If the robot does not detect the item, it tries moving in a different direction. A conditional plan would branch at the point where the robot checks for the item, with different actions based on the outcome of the sensor reading.
Introduction to Continuous Planning
Continuous planning involves the ongoing process of generating, updating, and executing plans in dynamic and unpredictable environments. Unlike traditional planning, where a complete plan is generated upfront, continuous planning focuses on the need for real-time re-planning and adaptation to changes during the execution of the plan. Continuous planning is a powerful tool in AI, enabling agents to function in dynamic and unpredictable environments. By incorporating real-time decision-making, ongoing adaptation, and the ability to handle uncertainty, continuous planning allows agents to complete complex tasks in real- time.
Key Characteristics:
⮚ Incremental Execution: Actions are executed as soon as they are planned, with the plan being updated incrementally. ⮚ Real-time Re-planning: The plan is continuously modified during execution as the agent interacts with the environment and receives feedback. ⮚ Adaptability: The ability to adapt to unexpected changes, sensor failures, or new information during the planning and execution process.
2. Deliberative and Reactive Planning: In continuous planning, both deliberative and reactive
approaches are combined: ⮚ Deliberative Planning: Involves thoughtful, long-term planning where the agent considers its goals, environment, and future actions in a broader context. ⮚ Reactive Planning: Involves immediate, short-term reactions to environmental changes. The agent may modify the plan on the fly in response to real-time feedback. For example, an autonomous vehicle might have a high-level route planned (deliberative planning) but react immediately to avoid an obstacle on the road (reactive planning).
3. Hierarchical Task Network (HTN) Planning
In complex domains, continuous planning can benefit from Hierarchical Task Networks (HTNs). HTNs break down high-level goals into smaller sub-goals or tasks, which can be planned incrementally. HTNs are particularly useful for managing complex tasks with multiple levels of abstraction. ⮚ High-Level Task: The robot needs to clean a room. ⮚ Sub-Task 1: The robot needs to move to the first corner. ⮚ Sub-Task 2: The robot needs to vacuum the floor in the corner. The plan is executed incrementally, starting with the first sub-task and continuously refining the remaining plan.
4. Real-Time Planning Algorithms
Real-time planning algorithms are designed to operate under strict time constraints. These algorithms ensure that a valid plan can be produced in a timely manner, even when there is limited time for computation. Some examples include: ⮚ Real-Time Dynamic Programming: Used in settings like robotics or autonomous vehicles, where real-time decisions are made based on the most current state of the environment. ⮚ Monte Carlo Tree Search (MCTS): A popular algorithm used in real-time planning problems, especially in games and robotics, where it simulates possible future states and picks the best action based on simulations. Challenges in Continuous Planning Continuous planning faces several challenges, particularly in dynamic and uncertain environments: ⮚ Uncertainty in the Environment: The agent must deal with partial observability (where the agent cannot observe the entire state of the environment) and action uncertainty (where the outcome of actions is not always deterministic). ⮚ Real-time Constraints: In many domains, the agent must act quickly and adapt to new conditions without having the luxury of waiting for a complete plan to be generated. ⮚ Execution Failures: Actions might not have the expected outcomes, requiring the agent to quickly revise its plan and recover from failure.
⮚ Resource Constraints: The agent may have limited resources (e.g., time, energy, computational power), making it essential to optimize the planning process. Continuous Planning in Autonomous Systems Autonomous systems, such as self-driving cars, robotic assistants, and drones, heavily rely on continuous planning due to the need for real-time adaptation to dynamic environments.
1. Self-Driving Cars: Self-driving cars need to plan their route and make decisions about how
to navigate, considering obstacles, traffic, road signs, and pedestrians. The planning system continuously adjusts the route and actions as new information (e.g., traffic updates, road conditions) becomes available. For instance: ⮚ The car may start with a high-level plan to drive from point A to point B. ⮚ As the car moves, it encounters traffic or pedestrians, requiring real-time adjustments to the path. ⮚ If the weather changes (e.g., it starts raining), the car adjusts its driving speed and route.
- Robots in Dynamic Environments: Robots, such as warehouse robots or home assistants, need continuous planning to navigate around obstacles, interact with humans, and perform tasks like object manipulation or cleaning. These robots must continually assess their environment and adjust their actions in real time. Example: A robot vacuum cleaner needs to clean a room. During execution, it may detect objects that block its path, requiring it to revise its plan and avoid the obstacles while still achieving its goal of cleaning the entire room. Plan Representation in Continuous Planning Continuous planning systems require effective representations for maintaining and modifying plans over time. These representations often include: ⮚ State-Action Graphs: Nodes represent possible states, and edges represent actions that transition from one state to another. Continuous planners update the graph incrementally as new states are encountered. ⮚ Plan Trees: A tree structure where each branch represents a potential action or decision path. The planner can add or remove branches as new information comes in. ⮚ Decision Trees: A tree used for making decisions based on observations and actions. Decision trees are particularly useful when the outcomes of actions are uncertain. Applications of Continuous Planning Continuous planning has a wide range of applications, including:
- Robotics: Continuous planning enables robots to adapt to changing environments, avoid obstacles, and carry out complex tasks like navigation and object manipulation.
⮚ Indirect Communication: Agents infer each other's intentions by observing their actions or behavior, which is common in systems like swarms or market based systems.
- Negotiation: In multi-agent planning, negotiation is often used when agents have conflicting goals or resources. Agents negotiate to reach an agreement on how to allocate resources or tasks. ⮚ Bargaining: Agent's exchange offers and counteroffers until they agree on a solution. ⮚ Contract-Net Protocol: One agent (the contractor) seeks bids from other agents (subcontractors) to perform a task.
- Task Allocation and Scheduling: Task allocation is the process of distributing tasks among agents in an efficient and fair way. This involves finding the best assignment of tasks to agents based on their capabilities, availability, and preferences. ⮚ Centralized Scheduling: A single agent or central system decides the assignment. ⮚ Distributed Scheduling: Agents coordinate among themselves to determine how tasks are allocated.
- Conflict Resolution: In multi-agent systems, conflicts may arise when agents have competing goals or when resources are limited. Conflict resolution mechanisms include: ⮚ Game Theory: Agents make decisions that consider the likely decisions of others, aiming for mutually beneficial outcomes (e.g., Nash equilibrium). ⮚ Mediation: A third-party agent or a mechanism helps resolve conflicts between agents. Techniques for Multi-Agent Planning
- Plan Merging: Plan merging is used when agents have independent plans that need to be integrated into a single coordinated plan. This is particularly important in cooperative multi agent systems.
- Sequential Plan Merging: Each agent has a sequential plan, and the plans are merged by integrating their individual actions step by step.
- Parallel Plan Merging: Plans are merged to allow parallel execution of actions. This is more complex and requires considering constraints such as resource sharing or agent synchronization.
- Joint Plan Generation: In cooperative settings, agents might work together to generate a joint plan —a single plan that coordinates the actions of all agents. Joint planning often involves creating a shared representation of the environment, goals, and actions. It requires:
- Goal Decomposition: The shared goal is broken down into sub-goals that agents can address individually.
- Constraint Propagation: The effects of an agent’s actions must be shared and coordinated to ensure that each agent's plan does not interfere with the others.
- Distributed Planning Algorithms: In distributed planning, no single agent has complete control over the entire planning process. Instead, the agents work together to solve the problem without centralized control.
- Decentralized POMDPs (Partially Observable Markov Decision Processes): In environments with uncertainty, agents plan based on incomplete information. Decentralized POMDPs enable agents to work together, considering partial observability and uncertain outcomes.
- Multi-Agent STRIPS: STRIPS (Stanford Research Institute Problem Solver) is a formalism used for representing planning problems. In multi-agent STRIPS, agents operate under the same framework, but their actions and goals must be coordinated to ensure consistency and avoid conflicts. Challenges in Multi-Agent Planning
- Scalability: As the number of agents increases, the complexity of multi-agent planning grows significantly. Efficient algorithms are needed to handle large-scale problems where many agents must coordinate their actions.
- Communication Overhead: In decentralized systems, the need for agents to communicate increases the overall system's overhead. This can become a bottleneck, especially if agents need to frequently share updates or plans.
- Uncertainty: Uncertainty can arise due to incomplete information about other agents’ states, actions, or goals. Agents must plan while considering the potential actions and strategies of other agents.
- Dynamic Environments: In dynamic environments, where the conditions change continuously, multi-agent systems must adjust their plans in real-time. This adds another layer of complexity to coordination and communication.
- Fairness: In systems with multiple agents, ensuring that all agents are treated fairly can be challenging, especially in competitive environments where resources are scarce. Applications of Multi-Agent Planning
- Autonomous Vehicles: In a fleet of autonomous vehicles, each vehicle must plan its route while coordinating with others to avoid collisions, optimize traffic flow, and share road resources efficiently. Task allocation: Each vehicle is assigned a task, such as driving to a specific location, while considering the positions and goals of other vehicles.
- Multi-Robot Systems: In multi-robot systems, robots must collaborate to complete tasks such as search-and-rescue missions, warehouse automation, or surveillance. Robots need to plan their movements, share tasks, and synchronize their actions to achieve common goals.
Example: Email → Spam or Not Spam
- Regression – Predict a continuous value Example: Predicting house prices based on size and location Unsupervised Learning Definition: Unsupervised learning is a type of machine learning where the model is trained on unlabeled data—meaning the algorithm tries to find patterns, groupings, or structures in the data without any predefined labels. Key Concepts of Unsupervised Learning: ⮚ No Labels: Only input data is provided—no output/target values. ⮚ Objective: Discover hidden patterns, group similar data points, or reduce dimensionality. Types of Unsupervised Learning:
- Clustering – Group similar data points together Example: Customer segmentation in marketing
- Dimensionality Reduction – Reduce number of input variables Example: Visualizing high-dimensional data in 2D using PCA Semi-Supervised Learning Definition: Semi-supervised learning is a type of machine learning that lies between supervised and unsupervised learning. It uses a small amount of labeled data and a large amount of unlabeled data to train a model. Key Concepts of Semi-Supervised Learning: ⮚ Combination of labeled and unlabeled data ⮚ Labeled data guides the model; unlabeled data helps it generalize better ⮚ Useful when labeling data is expensive or time-consuming Why Use It? ⮚ Labeled data is often scarce or costly ⮚ Unlabeled data is abundant and easier to collect ⮚ Helps improve accuracy when only a small portion of labeled data is available Real-World Examples: ⮚ Medical Diagnosis: Only some images are labeled by experts, the rest are unlabeled
⮚ Speech Recognition: A few transcribed audio clips, many raw recordings ⮚ Text Classification: A few labeled reviews, many unlabeled ones Reinforcement Learning (RL) Definition: Reinforcement Learning (RL) is a type of machine learning where an agent learns to make decisions by interacting with an environment. The agent receives rewards or penalties based on its actions and learns to maximize the total reward over time. Key Concepts of Reinforcement Learning: ⮚ Agent: The learner or decision-maker ⮚ Environment: Where the agent operates ⮚ Action: What the agent can do ⮚ State: The current situation of the agent ⮚ Reward: Feedback from the environment (positive or negative) Learning Process:
- The agent observes the state of the environment
- It takes an action
- The environment returns a new state and a reward
- The agent updates its policy to maximize future rewards Goal: Learn a policy that maps states to the best actions for long-term rewards Real-World Examples: ⮚ Game playing: AlphaGo, Atari games ⮚ Robotics: Teaching a robot to walk or grab objects ⮚ Finance: Automated trading systems ⮚ Self-driving cars: Navigating while avoiding obstacles Inductive Learning Inductive Learning is the process of learning a general function or rule from a set of specific observed examples. The learner induces a generalization that maps inputs to outputs based on the provided labeled data. In other words, Inductive learning in AI is a method where a machine learns general rules or patterns from specific examples or data instances. It involves inferring broader generalizations or predictions from observed data, a process crucial in machine learning. Key aspects of Inductive Learning:
Types of Inductive Learning Models a) Decision Trees ⮚ Learn classification rules in a tree form (ID3, C4.5) ⮚ Use entropy and information gain. b) Rule-Based Systems ⮚ Learn if-then rules from data (e.g., RIPPER) c) Bayesian Learners ⮚ Probabilistic methods like Naive Bayes ⮚ Instance-Based Learners ⮚ k-Nearest Neighbors (k-NN): no explicit model, uses raw data d) Neural Networks ⮚ Learn complex patterns by adjusting weights using gradient descent Advantages of Inductive Learning ⮚ No need for explicit programming ⮚ Learns patterns and trends automatically ⮚ Can generalize to unseen data ⮚ Flexible and data-driven Limitations of Inductive Learning ⮚ Needs many representative examples ⮚ May overfit or underfit ⮚ Cannot guarantee correct predictions for all unseen cases ⮚ Sensitive to noise and outliers Deductive vs Inductive Learning Aspect Inductive Learning Deductive Learning Direction Specific → General General → Specific Input Examples Rules/axioms Output General hypothesis Specific conclusion Example Machine learning models Logic-based inference Example: Imagine training a system to recognize dog breeds from images. You would provide the system
with a set of labeled images (e.g., "Labrador," "Poodle," "Beagle"). The system would then learn to Artificial Intelligence [CST-022] identify features that distinguish these breeds (e.g., fur length, ear shape, body size). This learned knowledge can then be used to classify new, unseen images of dogs.
Introduction to Statistical Learning
Statistical learning refers to a framework for building predictive models using data, integrating concepts from statistics, probability theory, and decision theory. The key goal is to estimate a function f(X)≈Y that maps input variables (features) to output variables (labels) while minimizing error or loss.
Statistical Learning Methods:
- Handling Uncertainty: ⮚ Agents can handle uncertainty using probabilistic methods and decision theory. ⮚ Agents must learn these probabilistic theories from experience, as they don't have perfect knowledge of the world. ⮚ The learning task can be formulated as probabilistic inference, where the agent learns to predict outcomes based on observed data.
- Bayesian View of Learning: ⮚ A Bayesian approach is highly effective in dealing with noise, overfitting, and optimizing predictions. ⮚ In Bayesian learning, probabilities are used to represent uncertain knowledge about the world. The agent uses this information to make decisions. ⮚ Bayes' theorem helps update beliefs considering new evidence. A Bayesian agent is aware that it can never be fully certain about its model of the world and must make decisions based on probabilistic theories.
- Probabilistic Inference: Statistical learning utilizes probabilistic inference to learn from data. Given some observations, the agent calculates the likelihood of different hypotheses and updates its belief accordingly.
- Noise & Overfitting The agent can handle noisy data and mitigate overfitting by using probabilistic methods. Overfitting is when a model performs well on training data but poorly on new, unseen data. A Bayesian framework often helps prevent overfitting by integrating prior knowledge and regularization techniques.
⮚ Task: The agent’s task is to infer the most likely hypothesis (the type of the candy bag) based on the data (the candy flavors observed). Artificial Intelligence [CST-022] ⮚ The hypothesis H represents the type of candy bag, and the data D are the individual candy observations. The agent must learn which hypothesis is most likely given the observed data, using probabilistic inference.
Reinforcement Learning
Definition: Reinforcement Learning (RL) is a type of learning where an agent learns to make decisions by performing actions and receiving feedback in the form of rewards or penalties. The goal is to learn a policy that maximizes cumulative reward. Key Concepts: ⮚ Agent, Environment, Actions, States, Rewards ⮚ Policy: Mapping from state to action ⮚ Value Function: Expected return from a state Reinforcement is feedback from which the agent comes to know that something good has happened when it wins and that something bad has happened when it loses. This is also called as reward. For Examples: - ∙ In chess game, the reinforcement is received only at the end of the game. ∙ In ping-pong, each point scored can be considered a reward; when learning to crawl, any forward motion is an achievement. Rewards served to define optimal policies in Markov decision processes. An optimal policy is a policy that maximizes the expected total reward. The task of reinforcement learning is to use observed rewards to learn an optimal policy for the environment. Learning from these enforcements or rewards is known as reinforcement learning In reinforcement learning an agent is placed in an environment, the following are the agents ⮚ Utility-based agent ⮚ Q-Learning agent ⮚ Reflex agent
Process:
- The agent observes the current state
- Chooses an action based on policy
- Receives reward and new state from the environment Artificial Intelligence [CST-022]
- Updates policy using reward signal
Example: In a game environment:
⮚ State: current board position ⮚ Action: move a piece ⮚ Reward: +1 for winning, 0 for draw, - 1 for losing In Reinforcement Learning (RL), an agent learns to take actions in an environment to maximize a reward. Based on how the agent behaves during learning, RL can be categorized into:
- Passive Reinforcement Learning
- Active Reinforcement Learning
1. Passive Reinforcement Learning: The agent follows a fixed policy (someone gave it) and
just evaluates how good that policy is. What the agent does: It does not choose its own actions. It only learns how good the policy is (i.e., it estimates values like V(s) – the value of a state). Goal: Policy evaluation, not improvement. Example: A self-driving car given a fixed route. It keeps driving that route and learns how safe or rewarding it is.
2. Active Reinforcement Learning: The agent learns the optimal policy on its own by
exploring and trying different actions. What the agent does: It chooses actions, explores the environment, and improves its policy based on rewards. Goal: Learn the best policy (i.e., what action to take in each state to get the highest reward). Example: A self-driving car that tries different routes to learn which is fastest or safest.