ARTIFICIAL INTELLIGENCE
MODULE 5
Planning in AI
Sushma D
AI Classical planning:
AI Classical planning is a key area in Artificial Intelligence to find a sequence of actions that
will fulfil a specific goal from an exact beginning point.
This process creates methods and algorithms that allow smart systems to explore systematically
various actions and their outcomes which eventually lead to the desired result occasionally
from the starting place.
There are many different areas in which classical planning methods are used such as: robotics
or other industries related to manufacturing, transportation services like supply chain
management or project management.
Planning based on logical reasoning forms the basis for all current methodologies that deal
with automated decision making as well as enhancing efficiency for resource allocation.
Importance of Classical Planning in AI
• its wide range of features that can be applied to solving problems in different domains.
• It’s an allowance for handling complex situations in a logically coherent manner.
Through the replication of the problem area, stipulation of initial and final states, and
specifying how these states may be reached, classical planning algorithms may search for a
viable solution by systematically going through the space of possible solutions.
Domain-Independent Planning
The essential feature of classical reasoning is domain independence.
The classical algorithms of the planning and technique are designed to apply to different
problems without having to learn domain knowledge or heuristics.
Such domain-independent planning enables the creation of general-purpose planners that can
solve problems and machines for different domains increasing the power and versatility of
classical planning.
The main objective of domain-independent or multi-domain planning is to develop planning
algorithms and systems that can reason about and solve problems in many different domains,
without having to make several adjustments or change parameters. This is done by
concentrating on the elementary fundamentals of planning that are: state representations, action
models and a strategy of search, and not the domain-specific rules or the heuristics.
The feature of independence concerning domains in the field of classical planning can be
elaborated by the use of domain-independent modelling languages like PDDL (Planning
Domain Definition Language) and STRIPS (Stanford Research Institute Problem Solver).
Planning Domain Modelling Languages
The domain modelling languages are applied for depicting planning problems. Such languages
provide a form for the goal state, initial state, and actions or operators that are permissible for
transiting between the states.
1. PDDL (Planning Domain Definition Language):
PDDL (Planning Domain Description Language) is a DeFacto standard for application
of the planning domains and problems. It is a language of extension that helps to
identify objects, their properties, and the relationships between them, as well as specify
preconditions and consequences of any actions. The development of PDDL has
essentially gone through many different versions each including more and more
features and capabilities.
2. STRIPS (Stanford Research Institute Problem Solver):
STRIPS is the earlier and notable complex domain modelling language that served as
the base for the base of many other planning languages. It suggested the notion of a set
of logical propositions for states representation, and operators for mimicking actions
that actually modify the propositions.
Classical Planning Techniques
Classical planning stands for the assumption of a static world, where the transition between the
states is deterministic, and the observable environment is fully observable. The purpose is to
search for a series of actions (i.e., a plan) which will take the current state and move it until the
goal state is reached, while satisfying the given conditions and limitations.
Classical planning algorithms can be broadly categorized into two main approaches:
1. State-SpaceSearch:
These algorithms make use of the state space by producing and concerning the
successive states recurrently until reaching a goal state.
For instance, there are breadth-first search, depth-first search and more as A* and
greedy best-first search.
The part of the state-space search collective is usually maintained with a frontier
unexplored state and then these states systematically expanded until a solution is found
or the space in the search is exhausted.
2. Plan-SpaceSearch:
Such algorithms are applied in the operational plan space, where the emphasis is on
developing and fine-tuning the partial maps. Segments mentioned herein include
partial-order planning, hierarchical task network planning, and search algorithms like
UCPOP and VHPOP that can search the plan space.
Form-space search algorithms work by continuously growing and changing these
partial plans, using the constraints and dealing with the inconsistencies until there is a
complete and consistent plan.
Applications of Classical Planning:
Classical planning techniques have been successfully applied in various real-world
scenarios, demonstrating their practical utility and impact. Some notable applications
include:
1. Robotics: Involving robot motions and motions planning for tasks such as assembly,
navigation, and manipulation. Both classical and modern approaches to planning create
sequences of actions that enable the robot to complete the required task while following
a predefined geometric and temporal structure.
2. Manufacturing: Production process flow arrangement and labor organization in
factories and workshops. Classical planning is adopted to develop more efficient plans
for the way in which resources are allocated, tasks are assigned, and workflow
coordination among production to increase the speed of production and resource
utilization.
3. Logistics: Getting transportation and delivery of goods and materials organized.
Besides, the classic planning algorithms in logistics are used for determining the best
routes, schedules and resource allocation for logistics operations with consideration of
diversified factors such as time, load capacity and delivery requirements.
4. Space Exploration: Designing mission schedules and giving orders for spacecraft and
rovers. For the purpose of classical planning generation of a sequence of actions is
extremely significant for spacecraft and rovers that must be able to perform their
scientific missions and comply with specific needs e.g., powering, data transmission
and terrain navigation.
Language of planning problems
Definition: Planning in AI refers to the process of generating a sequence of actions to achieve
a specific goal, starting from an initial state.
Goal: Find a valid plan (sequence of actions) that transitions from the initial state to the desired
goal state.
Planning problems are formally expressed using specific representations that include:
1. Initial State:
o The starting condition of the system.
o Represented as a set of facts or conditions (e.g., At(A), Clear(B)).
2. Goal State:
o The desired final condition.
o Represented as a condition that must be satisfied (e.g., At(G)).
3. Actions (Operators):
o Defined by:
▪ Preconditions: Conditions that must hold before the action is executed.
▪ Effects: Changes in the state caused by the action.
4. Domain:
o The environment or the set of objects and rules governing the problem.
Representing Planning Problems
Planning problems are expressed using formal languages to ensure clear and unambiguous
problem definitions.
STRIPS (Stanford Research Institute Problem Solver)
• Overview: A popular language for representing planning problems.
• Components:
o Initial State: Represented as a set of logical predicates (facts).
o Goal State: Defined as a logical expression.
o Operators (Actions): Defined with preconditions and effects.
PDDL (Planning Domain Definition Language)
• Overview: A more advanced and flexible language used in modern planning systems.
• Features:
o Supports typed variables, conditional effects, and quantifiers.
o Allows complex representations of real-world problems.
Propositional Logic
• Use: Represents states and actions using logical formulas.
• Example:
o State: At(A) ∧ Clear(B)
o Action: Move(A, B)
o Result: At(B) ∧ ¬At(A)
State-Space Representation
• Overview: Represents states as nodes and actions as transitions in a graph.
• Goal: Use graph search algorithms to find the optimal path to the goal state.
• Example:
o Nodes: {At(A), At(B), At(C)}
o Edges: Actions like Move(A, B).
Types of Planning Problems
• Classical Planning:
o Assumes a fully observable, deterministic environment.
o Represented using STRIPS or PDDL.
• Hierarchical Task Network (HTN) Planning:
o Decomposes problems into smaller subproblems (tasks).
• Probabilistic Planning:
o Accounts for uncertainty in the effects of actions.
oUses stochastic models.
• Temporal Planning:
o Incorporates time constraints and durations for actions.
What is a Plan?
We require domain description, task specification, and goal description for any planning
system. A plan is considered a sequence of actions, and each action has its preconditions that
must be satisfied before it can act and some effects that can be positive or negative.
So, we have Forward State Space Planning (FSSP) and Backward State Space Planning
(BSSP) at the basic level.
1. Forward State Space Planning (FSSP)
FSSP behaves in the same way as forwarding state-space search. It says that given an initial
state S in any domain, we perform some necessary actions and obtain a new state S' (which
also contains some new terms), called a progression. It continues until we reach the target
position. Action should be taken in this matter.
o Disadvantage: Large branching factor
o Advantage: The algorithm is Sound
2. Backward State Space Planning (BSSP)
BSSP behaves similarly to backward state-space search. In this, we move from the target state
g to the sub-goal g, tracing the previous action to achieve that goal. This process is called
regression (going back to the previous goal or sub-goal). These sub-goals should also be
checked for consistency. The action should be relevant in this case.
o Disadvantages: not sound algorithm (sometimes inconsistency can be found)
o Advantage: Small branching factor (much smaller than FSSP)
So, for an efficient planning system, we need to combine the features of FSSP and BSSP, which
gives rise to target stack planning which will be discussed in the next article.
What is planning in AI?
Planning in artificial intelligence is about decision-making actions performed by robots or
computer programs to achieve a specific goal.
Execution of the plan is about choosing a sequence of tasks with a high probability of
accomplishing a specific task.
Block-world planning problem
• The block-world problem is known as the Sussmann anomaly.
• The non-interlaced planners of the early 1970s were unable to solve this problem.
Therefore, it is considered odd.
• When two sub-goals, G1 and G2, are given, a non-interleaved planner either produces
a plan for G1 that is combined with a plan for G2 or vice versa.
• In the block-world problem, three blocks labeled 'A', 'B', and 'C' are allowed to rest on
a flat surface. The given condition is that only one block can be moved at a time to
achieve the target.
The start position and target position are shown in the following diagram.
Components of the planning system
The plan includes the following important steps:
o Choose the best rule to apply the next rule based on the best available guess.
o Apply the chosen rule to calculate the new problem condition.
o Find out when a solution has been found.
o Detect dead ends so they can be discarded and direct system effort in more useful
directions.
o Find out when a near-perfect solution is found.
Target stack plan
• It is one of the most important planning algorithms used by STRIPS.
• Stacks are used in algorithms to capture the action and complete the target. A
knowledge base is used to hold the current situation and actions.
• A target stack is similar to a node in a search tree, where branches are created with
a choice of action.
The important steps of the algorithm are mentioned below:
1. Start by pushing the original target onto the stack. Repeat this until the pile is empty. If
the stack top is a mixed target, push its unsatisfied sub-targets onto the stack.
2. If the stack top is a single unsatisfied target, replace it with action and push the action
precondition to the stack to satisfy the condition.
Partial-order planning Graph:
Partial-order planning (POP) is an AI technique for automated planning that specifies the
actions needed to achieve a goal, but only orders actions when necessary:
• Partial ordering
POP maintains a partial ordering between actions, meaning it doesn't specify a total order for
all actions at every stage of planning.
• Flexibility
POP's flexible ordering makes it easier to combine smaller plans into larger ones.
• Execution
POP plans are executed by repeatedly choosing any of the possible next actions.
Here are some examples of partial-order planning:
• Obstacle course
If a person needs to travel through a bridge, see-saw, and swing-set, the bridge must be
traversed first, but the order of the see-saw and swing-set can be reversed.
• Action instances
If the same action is used multiple times in a plan, the partial ordering is between action
instances. An action instance is a pair of an action and an integer.
POP has been applied to a number of realistic tasks, including Logistics planning for Desert
Storm, Scheduling for the Hubble Space Telescope, Planning ground operations for the Space
Shuttle, Semiconductor manufacturing, and cleaning oil spills
With partial ordered planning, problem can be decomposed, so it can work well in case the
environment is non-cooperative.
It combines two action sequence:
i. First branch covers left sock and left shoe.
ii. In case, to wear a left shoe, wearing left sock is precondition, similarly.
iii. Second branch covers right shock and right shoe.
v. Here, wearing a right shock is precondition for wearing the right shoe.
Once these actions are taken we achieve our goal and reach the finish state.
E.g. Partial order planning of Wearing Shoe
Pop as search problem:
Set of actions:
These are the steps of plan.
For e.g.: Set of Actions = {Start, Rightsock, Rightshoe ,Leftsock, Leftshoe, Finish}
Set of ordering constraints/preconditions:
i. Preconditions are considered as ordering constraints.(i.e. without performing action “x” we
cannot perform action “y”)
ii. For e.g.: Set of ordering = {Right-sock <right-shoe; left-sock<left-shoe}="" that="" is=""
in="" order="" to="" wear="" shoe,="" first="" we="" should="" wear="" a="" sock.<=""
p="">
Set of causal links:
Action A achieves effect “E” for action B
Planning Graphs in AI :
A Planning Graph is a data structure primarily used in automated planning and artificial
intelligence to find solutions to planning problems. It represents a planning problem's
progression through a series of levels that describe states of the world and the actions that can
be taken. Here's a breakdown of its main components and how it functions:
1. Levels: A Planning graph has two alternating types of levels: action levels and state
levels. The first level is always a state level, representing the initial state of the planning
problem.
2. State Levels: These levels consist of nodes representing logical propositions or facts
about the world. Each successive state level contains all the propositions of the previous
level plus any that can be derived by the actions of the intervening action levels.
3. Action Levels: These levels contain nodes representing actions. An action node
connects to a state level if the state contains all the preconditions necessary for that
action. Actions in turn can create new state conditions, influencing the subsequent state
level.
4. Edges: The graph has two types of edges: one connecting state nodes to action
nodes (indicating that the state meets the preconditions for the action), and another
connecting action nodes to state nodes (indicating the effects of the action).
5. Mutual Exclusion (Mutex) Relationships: At each level, certain pairs of actions or
states might be mutually exclusive, meaning they cannot coexist or occur together
due to conflicting conditions or effects. These mutex relationships are critical for
reducing the complexity of the planning problem by limiting the combinations of
actions and states that need to be considered.
Levels in Planning Graphs
• Level S0: It is the initial state of the planning graph that consists of nodes each
representing the state or conditions that can be true.
• Level A0: Level A0 consists of nodes that are responsible for taking all specific
actions in terms of the initial condition described in the S0.
o Si: It represents the state or condition which could hold at a time i, it may be
both P and ¬P.
o Ai: It contains the actions that could have their preconditions satisfied at i
Working of Planning Graph
The planning graph has a single proposition level that contains all the initial conditions. The
planning graph runs in stages, each stage and its key workings are described below:
1. Extending the Planning Graph: At stage i (the current level), the graph plan takes
the planning graph from stage i-1 (the previous stage) and extends it by one time step.
This adds the next action level representing all possible actions given the propositions
(states) in the previous level, followed by the proposition level representing the
resulting states after actions have been performed.
2. Valid Plan Found: If the graph plan finds a valid plan, it halts the planning process.
3. Proceeding to the Next Stage: If no valid plan is found, the algorithm determines
that the goals are not all achievable in time i and moves to the next stage.
Mutual Exclusion in Planning Graph
Mutual exclusion in graph planning refers to the principle that certain actions or propositions
cannot coexist or occur simultaneously due to inherent constraints or dependencies within
the planning problem. Mutex relations can hold between actions and literals under various
conditions.
Mutex Conditions Between Actions
• Inconsistent Effects: One action negates the effect of another.
• Interference: One action deletes a precondition or creates an add-effect of another.
• Competing Needs: Precondition of action a and precondition of action b cannot be
true simultaneously.
Learning:
Learning is one of the fundamental building blocks of artificial intelligence (AI) solutions.
From a conceptual standpoint, learning is a process that improves the knowledge of an AI
program by making observations about its environment. From a technical/mathematical
standpoint, AI learning processes focused on processing a collection of input-output pairs for
a specific function and predicts the outputs for new inputs. Most of the artificial intelligence
(AI) basic literature identifies two main groups of learning models: supervised and
unsupervised.
AI Learning Models: Knowledge-Based Classification
Factoring its representation of knowledge, AI learning models can be classified in two main
types: inductive and deductive.
Inductive Learning: This type of AI learning model is based on inferring a general rule from
datasets of input-output pairs.. Algorithms such as knowledge based inductive
learning(KBIL) are a great example of this type of AI learning technique. KBIL focused on
finding inductive hypotheses on a dataset with the help of background information.
— Deductive Learning: This type of AI learning technique starts with te series of rules nad
infers new rules that are more efficient in the context of a specific AI algorithm. Explanation-
Based Learning(EBL) and Relevance-0Based Learning(RBL) are examples examples o f
deductive techniques. EBL extracts general rules from examples by “generalizing” the
explanation. RBL focuses on identifying attributes and deductive generalizations from simple
example.
AI learning models can be classified as supervised, unsupervised, semi-supervised or
reinforced:
1. Unsupervised Learning: The model is trained on data without explicit labels; it identifies
hidden patterns or structures in the data.
Objective: Group or organize data based on similarities or differences.
Example:
• Clustering customers based on purchasing behavior.
Algorithms:
• K-Means, Hierarchical Clustering, Principal Component Analysis (PCA).
2.Supervised Learning: The model is trained using labeled data, where input-output pairs
are provided.
• Objective: Learn a mapping function from inputs to outputs.
• Example:
o Inputs: Images of animals.
o Outputs: Labels like "cat" or "dog."
• Algorithms:
o Linear Regression, Decision Trees, Support Vector Machines (SVM), Neural
Networks.
3.Semi-supervised Learning: Combines a small amount of labeled data with a large amount
of unlabeled data to improve learning efficiency.
Objective: Leverage both labeled and unlabeled data to train better models.
Example: Using a small set of labeled images and a large set of unlabeled images to train a
classifier.
Use Case: Web page classification, where labeling every page is impractical.
4.Reinforcement Learning: Reinforcement learning models use opposite dynamics such as
rewards and punishment to “reinforce” different types of knowledge. This type of learning
technique is becoming really popular in modern AI solutions.
The model learns by interacting with the environment and receiving feedback in the form of
rewards or penalties.
Objective: Learn a policy to maximize cumulative rewards.
Example:
• Training a robot to navigate a maze using rewards for reaching the goal and penalties
for hitting walls.
Key Concepts:
• Agent, Environment, Actions, Rewards, Policy.
Algorithms: Q-Learning, Deep Q-Networks (DQN).
Inductive Learning in AI
Definition: Inductive learning is a machine learning approach where a model generalizes
patterns from specific examples to form broader rules.
• Example: Learning the rule "if it's sunny, play tennis" from a dataset of weather
conditions and playing decisions.
It is a key part of supervised learning.
Key Concepts
• Training Data: Input examples with known outcomes or labels.
• Generalization: Deriving rules from specific instances to apply to new data.
• Hypothesis Space: The set of all possible rules/models the system can explore.
• Bias: Assumptions made by the algorithm to make predictions for unseen data.
o Example: Inductive Bias: Preferring simpler models (Occam’s Razor).
Inductive Learning Process
1. Data Collection: Collect labeled examples.
2. Feature Selection: Identify relevant features for learning.
3. Model Building: Use algorithms (e.g., decision trees, neural networks) to learn
patterns.
4. Evaluation: Test the model's accuracy on new data.
Types of Inductive Learning
• Concept Learning: Categorizing examples (e.g., "cat" vs. "not cat").
• Classification: Assigning labels to inputs based on learned rules.
• Regression: Predicting a continuous output based on input data.
•
Algorithms Used
• Decision Trees: Split data based on feature values to form a tree-like structure.
• Support Vector Machines (SVMs): Identify a hyperplane to separate data classes.
• Neural Networks: Learn patterns using layers of interconnected nodes.
Advantages of Inductive Learning
• Can adapt to new and unseen data.
• Handles problems where explicit rules are unknown.
• Widely applicable across domains (e.g., speech recognition, image classification)
Applications
• Natural Language Processing (NLP): Sentiment analysis, machine translation.
• Computer Vision: Object detection, image classification.
• Healthcare: Diagnosing diseases using medical data.
Learning Decision Trees.
What are the benefits of using an AI decision tree?
In the AI world, "explainability" is becoming more and more important to reduce bias and
improve transparency. That's why decision trees are a valuable tool for organizations looking
to adopt AI and ML
Some benefits of decision trees include:
• Transparency
• Predictiveness
• Resistance to overfitting
The first point, transparency, is particularly important for businesses that want to explain
their AI decisions to stakeholders. The tree can be used to show how the scoring system
works, and why certain applicants were deemed high-risk.
Even for someone without any experience in data science or programming, decision trees are
easy to understand and visualize.
In addition to transparency, decision trees also have strong predictive capabilities. They can
handle both linear and nonlinear relationships, and they're resistant to overfitting (a common
problem with machine learning models).
This is because they have fewer parameters than other types of models (such as neural
networks). That also means they can be trained on smaller data sets, which is often an
important consideration for businesses with limited resources.