- Data Structure & Algorithm Classes (Live)
- System Design (Live)
- DevOps(Live)
- Explore More Live Courses
- Interview Preparation Course
- Data Science (Live)

GATE CS & IT 2024
- Data Structure & Algorithm-Self Paced(C++/JAVA)
- Data Structures & Algorithms in Python
- Explore More Self-Paced Courses
- C++ Programming - Beginner to Advanced
- Java Programming - Beginner to Advanced
- C Programming - Beginner to Advanced
- Full Stack Development with React & Node JS(Live)
- Java Backend Development(Live)
- Android App Development with Kotlin(Live)
- Python Backend Development with Django(Live)
- Complete Data Science Program(Live)
Mastering Data Analytics
Devops engineering - planning to production, cbse class 12 computer science.
- School Guide
- All Courses
- Linked List
- Binary Tree
- Binary Search Tree
- Advanced Data Structure
- All Data Structures
- Asymptotic Analysis
- Worst, Average and Best Cases
- Asymptotic Notations
- Little o and little omega notations
- Lower and Upper Bound Theory
- Analysis of Loops
- Solving Recurrences
- Amortized Analysis
- What does 'Space Complexity' mean ?
- Pseudo-polynomial Algorithms
- Polynomial Time Approximation Scheme
- A Time Complexity Question
- Searching Algorithms
- Sorting Algorithms
- Graph Algorithms
- Pattern Searching
- Geometric Algorithms
- Mathematical
- Bitwise Algorithms
- Randomized Algorithms
- Greedy Algorithms
- Dynamic Programming
- Divide and Conquer
- Backtracking
- Branch and Bound
- All Algorithms
- Company Preparation
- Practice Company Questions
- Interview Experiences
- Experienced Interviews
- Internship Interviews
- Competitive Programming
- Design Patterns
- System Design Tutorial
- Multiple Choice Quizzes
- Go Language
- Tailwind CSS
- Foundation CSS
- Materialize CSS
- Semantic UI
- Angular PrimeNG
- Angular ngx Bootstrap
- jQuery Mobile
- jQuery EasyUI
- React Bootstrap
- React Rebass
- React Desktop
- React Suite
- ReactJS Evergreen
- ReactJS Reactstrap
- BlueprintJS
- TensorFlow.js
- English Grammar
- School Programming
- Number System
- Trigonometry
- Probability
- Mensuration
- Class 8 Syllabus
- Class 9 Syllabus
- Class 10 Syllabus
- Class 11 Syllabus
- Class 12 Syllabus
- Class 8 Notes
- Class 9 Notes
- Class 10 Notes
- Class 11 Notes
- Class 12 Notes
- Class 8 Formulas
- Class 9 Formulas
- Class 10 Formulas
- Class 11 Formulas
- Class 8 Maths Solution
- Class 9 Maths Solution
- Class 10 Maths Solution
- Class 11 Maths Solution
- Class 12 Maths Solution
- Class 7 SS Syllabus
- Class 8 SS Syllabus
- Class 9 SS Syllabus
- Class 10 SS Syllabus
- Class 7 Notes
- History Class 7
- History Class 8
- History Class 9
- Geo. Class 7
- Geo. Class 8
- Geo. Class 9
- Civics Class 7
- Civics Class 8
- Business Studies (Class 11th)
- Microeconomics (Class 11th)
- Statistics for Economics (Class 11th)
- Business Studies (Class 12th)
- Accountancy (Class 12th)
- Macroeconomics (Class 12th)
- Machine Learning
- Data Science
- Mathematics
- Operating System
- Computer Networks
- Computer Organization and Architecture
- Theory of Computation
- Compiler Design
- Digital Logic
- Software Engineering
- GATE 2024 Live Course
- GATE Computer Science Notes
- Last Minute Notes
- GATE CS Solved Papers
- GATE CS Original Papers and Official Keys
- GATE CS 2023 Syllabus
- Important Topics for GATE CS
- GATE 2023 Important Dates
- Software Design Patterns
- HTML Cheat Sheet
- CSS Cheat Sheet
- Bootstrap Cheat Sheet
- JS Cheat Sheet
- jQuery Cheat Sheet
- Angular Cheat Sheet
- Facebook SDE Sheet
- Amazon SDE Sheet
- Apple SDE Sheet
- Netflix SDE Sheet
- Google SDE Sheet
- Wipro Coding Sheet
- Infosys Coding Sheet
- TCS Coding Sheet
- Cognizant Coding Sheet
- HCL Coding Sheet
- FAANG Coding Sheet
- Love Babbar Sheet
- Mass Recruiter Sheet
- Product-Based Coding Sheet
- Company-Wise Preparation Sheet
- Array Sheet
- String Sheet
- Graph Sheet
- ISRO CS Original Papers and Official Keys
- ISRO CS Solved Papers
- ISRO CS Syllabus for Scientist/Engineer Exam
- UGC NET CS Notes Paper II
- UGC NET CS Notes Paper III
- UGC NET CS Solved Papers
- Campus Ambassador Program
- School Ambassador Program
- Geek of the Month
- Campus Geek of the Month
- Placement Course
- Testimonials
- Student Chapter
- Geek on the Top
- Geography Notes
- History Notes
- Science & Tech. Notes
- Ethics Notes
- Polity Notes
- Economics Notes
- UPSC Previous Year Papers
- SSC CGL Syllabus
- General Studies
- Subjectwise Practice Papers
- Previous Year Papers
- SBI Clerk Syllabus
- General Awareness
- Quantitative Aptitude
- Reasoning Ability
- SBI Clerk Practice Papers
- SBI PO Syllabus
- SBI PO Practice Papers
- IBPS PO 2022 Syllabus
- English Notes
- Reasoning Notes
- Mock Question Papers
- IBPS Clerk Syllabus
- Apply for a Job
- Apply through Jobathon
- Hire through Jobathon
- All DSA Problems
- Problem of the Day
- GFG SDE Sheet
- Top 50 Array Problems
- Top 50 String Problems
- Top 50 Tree Problems
- Top 50 Graph Problems
- Top 50 DP Problems
- Solving For India-Hackthon
- GFG Weekly Coding Contest
- Job-A-Thon: Hiring Challenge
- BiWizard School Contest
- All Contests and Events
- Saved Videos
- What's New ?
- Data Structures
- Interview Preparation
- Topic-wise Practice
- Latest Blogs
- Write & Earn
- Web Development
Related Articles
- Write Articles
- Pick Topics to write
- Guidelines to Write
- Get Technical Writing Internship
- Write an Interview Experience
Problem Solving in Artificial Intelligence
- Search Algorithms in AI
- A* Search Algorithm
- Uniform-Cost Search (Dijkstra for large Graphs)
- Introduction to Hill Climbing | Artificial Intelligence
- Agents in Artificial Intelligence
- Understanding PEAS in Artificial Intelligence
- Types of Environments in AI
- Difference between Informed and Uninformed Search in AI
- Difference between BFS and DFS
- N Queen Problem | Backtracking-3
- Printing all solutions in N-Queen Problem
- Warnsdorff’s algorithm for Knight’s tour problem
- The Knight’s tour problem
- Rat in a Maze
- Count number of ways to reach destination in a Maze
- Count all possible paths from top left to bottom right of a mXn matrix
- Print all possible paths from top left to bottom right of a mXn matrix
- Unique paths in a Grid with Obstacles
- Unique paths covering every non-obstacle block exactly once in a grid
- Depth First Search or DFS for a Graph
- Breadth First Search or BFS for a Graph
- Level Order Binary Tree Traversal
- Tree Traversals (Inorder, Preorder and Postorder)
- Inorder Tree Traversal without Recursion
- Naive Bayes Classifiers
- Removing stop words with NLTK in Python
- Linear Regression (Python Implementation)
- Decision Tree
- Difficulty Level : Easy
- Last Updated : 10 Jan, 2023
The reflex agent of AI directly maps states into action. Whenever these agents fail to operate in an environment where the state of mapping is too large and not easily performed by the agent, then the stated problem dissolves and sent to a problem-solving domain which breaks the large stored problem into the smaller storage area and resolves one by one. The final integrated action will be the desired outcomes.
On the basis of the problem and their working domain, different types of problem-solving agent defined and use at an atomic level without any internal state visible with a problem-solving algorithm. The problem-solving agent performs precisely by defining problems and several solutions. So we can say that problem solving is a part of artificial intelligence that encompasses a number of techniques such as a tree, B-tree, heuristic algorithms to solve a problem.
We can also say that a problem-solving agent is a result-driven agent and always focuses on satisfying the goals.
There are basically three types of problem in artificial intelligence:
1. Ignorable: In which solution steps can be ignored.
2. Recoverable: In which solution steps can be undone.
3. Irrecoverable: Solution steps cannot be undo.
Steps problem-solving in AI: The problem of AI is directly associated with the nature of humans and their activities. So we need a number of finite steps to solve a problem which makes human easy works.
These are the following steps which require to solve a problem :
- Problem definition: Detailed specification of inputs and acceptable system solutions.
- Problem analysis: Analyse the problem thoroughly.
- Knowledge Representation: collect detailed information about the problem and define all possible techniques.
- Problem-solving: Selection of best techniques.
Components to formulate the associated problem:
- Initial State: This state requires an initial state for the problem which starts the AI agent towards a specified goal. In this state new methods also initialize problem domain solving by a specific class.
- Action: This stage of problem formulation works with function with a specific class taken from the initial state and all possible actions done in this stage.
- Transition: This stage of problem formulation integrates the actual action done by the previous action stage and collects the final stage to forward it to their next stage.
- Goal test: This stage determines that the specified goal achieved by the integrated transition model or not, whenever the goal achieves stop the action and forward into the next stage to determines the cost to achieve the goal.
- Path costing: This component of problem-solving numerical assigned what will be the cost to achieve the goal. It requires all hardware software and human working cost.
Please Login to comment...
- shivammiglani09
- Artificial Intelligence
Complete Machine Learning & Data Science Program
Python programming foundation -self paced, javascript foundation - self paced, data structures & algorithms in python - self paced, master java programming - complete beginner to advanced, complete interview preparation - self paced, data structures and algorithms - self paced, master c++ programming - complete beginner to advanced, master c programming with data structures, system design - live, java backend development - live, full stack development with react & node js - live, improve your coding skills with practice, start your coding journey now.
Artificial Intelligence(AI)
CS6659 - AI Notes
- Lecture Videos - Collection 1
- Lecture Videos - Collection 2
- Lecture Videos - Collection 3
Problem Solving Agent
- Goal Formulation -Set of one or more (desirable) world states.(eg.Checkmate in Chess)
- Problem Formulation - What actions and states to consider given a goal and an initial state
- Search for solution - Given the problem, search for a solution-- a sequence of actions to achieve the goal starting from initial state
- Execution of the solution
Really helpful assets there

Geek Culture

Oct 30, 2021
Artificial Intelligence Series: Problem Solving Agents
In the previous articles of this series, we have discussed about various structures of agent programs.
Artificial Intelligence Series: Structure of agents
In this third article of ai series, we would be discussing about the structure and types of various intelligent agents..
In this article we are going to discuss about Problem Solving agents which is type of goal based agent . Since the direct mapping from states to actions of a simple reflex agent is too large to store for a complex environment, we use goal based agents that that can consider future actions and the desirability of outcomes.
Problem Solving Agents
Intelligent agents are supposed to maximize its performance measure . Achieving this can be simplified if the agent can adopt a goal and aim to satisfy it.
Setting goals help the agent organize its behavior by limiting the objectives that the agent is trying to achieve and hence the actions it needs to consider. This Goal formulation based on the current situation and the agent’s performance measure is the first step in problem solving.
We consider the agent’s goal to be a set of states. The agent’s task is to find out actions in the present and in the future that could reach the goal state from the present state. Problem formulation is the process of deciding what actions and states to consider, given a goal.
“ An agent with several immediate options of unknown value can decide what to do by first examining the future actions that eventually lead to states of known value ”
After Goal formulation and problem formulation, the agent has to look for a sequence of actions that reaches the goal. This process is called Search . A search algorithm takes a problem as input and returns a sequence of actions as output.
After the search phase, the agent has to carry out the actions that are recommended by the search algorithm. This final phase is called execution phase.
Formulate — Search — Execute
Thus the agent has a formulate, search and execute design to it.
Problems and Solutions
Before we get into more about problem formulating phase, we need to first understand what a problem is in terms of problem solving agents.
The problem can be defined formally in five components:
Initial State
Transition model.
The first component that describes the problem is the initial state that the agent starts in. For example, if a taxi agent needs to get to location(B) but the taxi is currently at location(A) then the initial state of the problem would be location(A).
The second component that describes the problem is a description of the possible actions available to the agent. Given a state s , Actions(s) returns the set of actions that can be executed in s. We say that each of these actions is applicable in s.
The third component is the description of what each action does which is called the transition model . It is specified by a function Result(s , a) that returns the state that results from doing action a in state s.
The initial state, actions and transition model together define the state space of a problem which is a set of all states reachable from the initial state by any sequence of actions. The state space forms a graph in which the nodes are states and the links between the nodes are actions.
The goal test determines whether a given state is a goal state or not. Sometimes there is an explicit set of possible goal states and the test simply checks whether the given state is one of them. Sometimes the goal is specified by an abstract property rather than an explicitly enumerated set of states.
The last component of the problem is the path cost which is a function that assigns a numeric cost to each path. The problem solving agent chooses a cost function that reflects its own performance measure.
The solution to the problem is an action sequence that leads from initial state to goal state and the solution quality is measured by the path cost function. An optimal solution has the lowest path cost among all the solutions.
An Example Problem Formulation
Let us take the example of vacuum world that was introduced in the starting of this series, There is a vacuum cleaner agent and it can move left or right and its jump is to suck up the dirt from the floor.
The problem for vacuum world can be formulated as follows:
States: The state is determined by both the agent location and the dirt location. The agent is in one of two locations, each of which might or might not contain dirt. Therefore, there are 2 x 2 ² = 8 possible world states.
A larger environment would have n x 2 to the power of n states.
Initial State: Any state can be assigned as the initial state in this case.
Action: In this environment there are three actions, Move Left , Move Right , Suck up the dirt.
Transition Model: All the actions have expected effects, except for when the agent is in leftmost square and the action is Left , when the agent is in rightmost square and the action is Right and the square is clean when the action is to Suck.
Goal Test: Goal test checks whether all the squares are clean.
Path Cost: Each step costs 1, so the path cost is the number of steps in the path.
The vacuum world problem is a toy problem and involves only discrete locations, discrete dirt etc. Therefore, this problem is a Toy Problem . There are many Real-World Problems like the automated taxi world. Try to formulate problems of real world and see what would be the states be and what actions could be chosen etc.
In this article we have discussed mainly about problem formulation. In the next article of this series we will be discussing about finding solutions using Searching Methods .
Artificial Intelligence: A Modern Approach , by Peter Norvig and Stuart J. Russell
More from Geek Culture
A new tech publication by Start it up (https://medium.com/swlh).
About Help Terms Privacy
Get the Medium app

I am just a being, striving to find the purpose of it all. Alas there is none!
Text to speech
Problem Solving
Definitions.
Searching is one of the classic areas of AI.
A problem is a tuple $(S, s, A, \rho, G, P)$ where
Example: A water jug problem
You have a two-gallon jug and a one-gallon jug; neither have any measuring marks on them at all. Initially both are empty. You need to get exactly one gallon into the two-gallon jug. Formally:
A graphical view of the transition function (initial state shaded, goal states outlined bold):

And a tabular view:
To solve this problem, an agent would start at the initial state and explore the state space by following links until it arrived in a goal state. A solution to the water jug problem is a path from the initial state to a goal state .
Example solutions
There are an infinite number of solutions. Sometimes we are interested in the solution with the smallest path cost; more on this later.
Awww Man.... Why are we studying this?
Even if they’re not completely right, there are still zillions of problems that can be formulated in problem spaces, e.g.
Problem Types
State finding vs. action sequence finding.
A fundamental distinction:
Offline vs. Online Problems
In an online problem, the agent doesn’t even know what the state space is, and has to build a model of it as it acts. In an offline problem, percepts don’t matter at all. An agent can figure out the entire action sequence before doing anything at all .
Offline Example : Vacuum World with two rooms, cleaning always works, a square once cleaned stays clean. States are 1 – 8, goal states are 1 and 5.

Sensorless (Conformant) Problems
The agent doesn’t know where it is. We can use belief states (sets of states that the agent might be in). Example from above deterministic, static, single-agent vacuum world:
Note the goal states are 1 and 5. If a state 15 was reachable, it would be a goal too.
Contingency Problems
Contingency Problem: The agent doesn’t know what effect its actions will have. This could be due to the environment being partially observable, or because of another agent. Ways to handle this:
Example: Partially observable vacuum world (meaning you don’t know the status of the other square) in which sucking in a clean square may make it dirty.
Can also model contingency problems is with "AND-OR graphs".
Example: find a winning strategy for Nim if there are only five stones in one row left. You are player square. You win if it is player circle’s turn with zero stones left.

In general then, a solution is a subtree in which
If the tree has only OR nodes, then the solution is just a path.
Search Algorithms
Hey, we know what a problem is, what a problem space is, and even what a solution is, but how exactly do we search the space ? Well there are zillions of approaches:
Types of Problem Solving Tasks
Agents may be asked to be
An algorithm is
Search Trees
Example: The water jug problem with 4 and 3 gallon jugs. Cost is 1 point per gallon used when filling, 1 point to make a transfer, 5 points per gallon emptied (since it makes a mess). The search tree might start off like this:

Search trees have
The complexity of most search algorithms can be written as a function of one or more of $b$, $d$ and $m$.
In general though there may be more states than there are fundamental particles in the universe. But we need to find a solution. Usually is helpful to
An Introduction to Problem-Solving using Search Algorithms for Beginners
This article was published as a part of the Data Science Blogathon
In computer science, problem-solving refers to artificial intelligence techniques, including various techniques such as forming efficient algorithms, heuristics, and performing root cause analysis to find desirable solutions.
The basic crux of artificial intelligence is to solve problems just like humans.
Examples of Problems in Artificial Intelligence
In today’s fast-paced digitized world, artificial intelligence techniques are used widely to automate systems that can use the resource and time efficiently. Some of the well-known problems experienced in everyday life are games and puzzles. Using AI techniques, we can solve these problems efficiently. In this sense, some of the most common problems resolved by AI are
- Travelling Salesman Problem
- Tower of Hanoi Problem
- Water-Jug Problem
- N-Queen Problem
- Crypt-arithmetic Problems
- Magic Squares
- Logical Puzzles and so on.
Table of Contents
Problem solving techniques.
- Properties of searching algorithms
Types of search algorithms
Uninformed search algorithms, comparison of various uninformed search algorithms, informed search algorithms, comparison of uninformed and informed search algorithms.
In artificial intelligence, problems can be solved by using searching algorithms, evolutionary computations, knowledge representations, etc.
In this article, I am going to discuss the various searching techniques that are used to solve a problem.
In general, searching is referred to as finding information one needs.
The process of problem-solving using searching consists of the following steps.
- Define the problem
- Analyze the problem
- Identification of possible solutions
- Choosing the optimal solution
- Implementation
Let’s discuss some of the essential properties of search algorithms.
Properties of search algorithms
Completeness.
A search algorithm is said to be complete when it gives a solution or returns any solution for a given random input.
If a solution found is best (lowest path cost) among all the solutions identified, then that solution is said to be an optimal one.
Time complexity
The time taken by an algorithm to complete its task is called time complexity. If the algorithm completes a task in a lesser amount of time, then it is an efficient one.
Space complexity
It is the maximum storage or memory taken by the algorithm at any time while searching.
These properties are also used to compare the efficiency of the different types of searching algorithms.
Now let’s see the types of the search algorithm.
Based on the search problems, we can classify the search algorithm as
- Uninformed search
- Informed search
The uninformed search algorithm does not have any domain knowledge such as closeness, location of the goal state, etc. it behaves in a brute-force way. It only knows the information about how to traverse the given tree and how to find the goal state. This algorithm is also known as the Blind search algorithm or Brute -Force algorithm.
The uninformed search strategies are of six types.
- Breadth-first search
- Depth-first search
- Depth-limited search
- Iterative deepening depth-first search
- Bidirectional search
- Uniform cost search
Let’s discuss these six strategies one by one.
1. Breadth-first search
It is of the most common search strategies. It generally starts from the root node and examines the neighbor nodes and then moves to the next level. It uses First-in First-out (FIFO) strategy as it gives the shortest path to achieving the solution.
BFS is used where the given problem is very small and space complexity is not considered.
Now, consider the following tree.
Source: Author
Here, let’s take node A as the start state and node F as the goal state.
The BFS algorithm starts with the start state and then goes to the next level and visits the node until it reaches the goal state.
In this example, it starts from A and then travel to the next level and visits B and C and then travel to the next level and visits D, E, F and G. Here, the goal state is defined as F. So, the traversal will stop at F.

The path of traversal is:
A —-> B —-> C —-> D —-> E —-> F
Let’s implement the same in python programming.
Python Code:
Advantages of BFS
- BFS will never be trapped in any unwanted nodes.
- If the graph has more than one solution, then BFS will return the optimal solution which provides the shortest path.
Disadvantages of BFS
- BFS stores all the nodes in the current level and then go to the next level. It requires a lot of memory to store the nodes.
- BFS takes more time to reach the goal state which is far away.
2. Depth-first search
The depth-first search uses Last-in, First-out (LIFO) strategy and hence it can be implemented by using stack. DFS uses backtracking. That is, it starts from the initial state and explores each path to its greatest depth before it moves to the next path.
DFS will follow
Root node —-> Left node —-> Right node
Now, consider the same example tree mentioned above.
Here, it starts from the start state A and then travels to B and then it goes to D. After reaching D, it backtracks to B. B is already visited, hence it goes to the next depth E and then backtracks to B. as it is already visited, it goes back to A. A is already visited. So, it goes to C and then to F. F is our goal state and it stops there.

A —-> B —-> D —-> E —-> C —-> F
The output path is as follows.
Advantages of DFS
- It takes lesser memory as compared to BFS.
- The time complexity is lesser when compared to BFS.
- DFS does not require much more search.
Disadvantages of DFS
- DFS does not always guarantee to give a solution.
- As DFS goes deep down, it may get trapped in an infinite loop.
3. Depth-limited search
Depth-limited works similarly to depth-first search. The difference here is that depth-limited search has a pre-defined limit up to which it can traverse the nodes. Depth-limited search solves one of the drawbacks of DFS as it does not go to an infinite path.
DLS ends its traversal if any of the following conditions exits.
Standard Failure
It denotes that the given problem does not have any solutions.
Cut off Failure Value
It indicates that there is no solution for the problem within the given limit.
Now, consider the same example.
Let’s take A as the start node and C as the goal state and limit as 1.
The traversal first starts with node A and then goes to the next level 1 and the goal state C is there. It stops the traversal.

A —-> C
If we give C as the goal node and the limit as 0, the algorithm will not return any path as the goal node is not available within the given limit.
If we give the goal node as F and limit as 2, the path will be A, C, F.
Let’s implement DLS.
When we give C as goal node and 1 as limit the path will be as follows.
Advantages of DLS
- It takes lesser memory when compared to other search techniques.
Disadvantages of DLS
- DLS may not offer an optimal solution if the problem has more than one solution.
- DLS also encounters incompleteness.

4. Iterative deepening depth-first search
Iterative deepening depth-first search is a combination of depth-first search and breadth-first search. IDDFS find the best depth limit by gradually adding the limit until the defined goal state is reached.
Let me try to explain this with the same example tree.
Consider, A as the start node and E as the goal node. Let the maximum depth be 2.
The algorithm starts with A and goes to the next level and searches for E. If not found, it goes to the next level and finds E.

The path of traversal is
A —-> B —-> E
Let’s try to implement this.
The path generated is as follows.
Advantages of IDDFS
- IDDFS has the advantages of both BFS and DFS.
- It offers fast search and uses memory efficiently.
Disadvantages of IDDFS
- It does all the works of the previous stage again and again.
5. Bidirectional search
The bidirectional search algorithm is completely different from all other search strategies. It executes two simultaneous searches called forward-search and backwards-search and reaches the goal state. Here, the graph is divided into two smaller sub-graphs. In one graph, the search is started from the initial start state and in the other graph, the search is started from the goal state. When these two nodes intersect each other, the search will be terminated.
Bidirectional search requires both start and goal start to be well defined and the branching factor to be the same in the two directions.
Consider the below graph.

Here, the start state is E and the goal state is G. In one sub-graph, the search starts from E and in the other, the search starts from G. E will go to B and then A. G will go to C and then A. Here, both the traversal meets at A and hence the traversal ends.

E —-> B —-> A —-> C —-> G
Let’s implement the same in Python.
The path is generated as follows.
Advantages of bidirectional search
- This algorithm searches the graph fast.
- It requires less memory to complete its action.
Disadvantages of bidirectional search
- The goal state should be pre-defined.
- The graph is quite difficult to implement.
6. Uniform cost search
Uniform cost search is considered the best search algorithm for a weighted graph or graph with costs. It searches the graph by giving maximum priority to the lowest cumulative cost. Uniform cost search can be implemented using a priority queue.
Consider the below graph where each node has a pre-defined cost.

Here, S is the start node and G is the goal node.
From S, G can be reached in the following ways.
S, A, E, F, G -> 19
S, B, E, F, G -> 18
S, B, D, F, G -> 19
S, C, D, F, G -> 23
Here, the path with the least cost is S, B, E, F, G.

Let’s implement UCS in Python.
The optimal output path is generated.
Advantages of UCS
- This algorithm is optimal as the selection of paths is based on the lowest cost.
Disadvantages of UCS
- The algorithm does not consider how many steps it goes to reach the lowest path. This may result in an infinite loop also.
Now, let me compare the six different uninformed search strategies based on the time complexity.
This is all about uninformed search algorithms.
Let’s take a look at informed search algorithms.
The informed search algorithm is also called heuristic search or directed search. In contrast to uninformed search algorithms, informed search algorithms require details such as distance to reach the goal, steps to reach the goal, cost of the paths which makes this algorithm more efficient.
Here, the goal state can be achieved by using the heuristic function.
The heuristic function is used to achieve the goal state with the lowest cost possible. This function estimates how close a state is to the goal.
Let’s discuss some of the informed search strategies.
1. Greedy best-first search algorithm
Greedy best-first search uses the properties of both depth-first search and breadth-first search. Greedy best-first search traverses the node by selecting the path which appears best at the moment. The closest path is selected by using the heuristic function.
Consider the below graph with the heuristic values.

Here, A is the start node and H is the goal node.
Greedy best-first search first starts with A and then examines the next neighbour B and C. Here, the heuristics of B is 12 and C is 4. The best path at the moment is C and hence it goes to C. From C, it explores the neighbours F and G. the heuristics of F is 8 and G is 2. Hence it goes to G. From G, it goes to H whose heuristic is 0 which is also our goal state.

A —-> C —-> G —-> H
Let’s try this with Python.
The output path with the lowest cost is generated.
The time complexity of Greedy best-first search is O(b m ) in worst cases.
Advantages of Greedy best-first search
- Greedy best-first search is more efficient compared with breadth-first search and depth-first search.
Disadvantages of Greedy best-first search
- In the worst-case scenario, the greedy best-first search algorithm may behave like an unguided DFS.
- There are some possibilities for greedy best-first to get trapped in an infinite loop.
- The algorithm is not an optimal one.
Next, let’s discuss the other informed search algorithm called the A* search algorithm.
2. A* search algorithm
A* search algorithm is a combination of both uniform cost search and greedy best-first search algorithms. It uses the advantages of both with better memory usage. It uses a heuristic function to find the shortest path. A* search algorithm uses the sum of both the cost and heuristic of the node to find the best path.
Consider the following graph with the heuristics values as follows.

Let A be the start node and H be the goal node.
First, the algorithm will start with A. From A, it can go to B, C, H.
Note the point that A* search uses the sum of path cost and heuristics value to determine the path.
Here, from A to B, the sum of cost and heuristics is 1 + 3 = 4.
From A to C, it is 2 + 4 = 6.
From A to H, it is 7 + 0 = 7.
Here, the lowest cost is 4 and the path A to B is chosen. The other paths will be on hold.
Now, from B, it can go to D or E.
From A to B to D, the cost is 1 + 4 + 2 = 7.
From A to B to E, it is 1 + 6 + 6 = 13.
The lowest cost is 7. Path A to B to D is chosen and compared with other paths which are on hold.
Here, path A to C is of less cost. That is 6.
Hence, A to C is chosen and other paths are kept on hold.
From C, it can now go to F or G.
From A to C to F, the cost is 2 + 3 + 3 = 8.
From A to C to G, the cost is 2 + 2 + 1 = 5.
The lowest cost is 5 which is also lesser than other paths which are on hold. Hence, path A to G is chosen.
From G, it can go to H whose cost is 2 + 2 + 2 + 0 = 6.
Here, 6 is lesser than other paths cost which is on hold.
Also, H is our goal state. The algorithm will terminate here.

Let’s try this in Python.
The output is given as
The time complexity of the A* search is O(b^d) where b is the branching factor.
Advantages of A* search algorithm
- This algorithm is best when compared with other algorithms.
- This algorithm can be used to solve very complex problems also it is an optimal one.
Disadvantages of A* search algorithm
- The A* search is based on heuristics and cost. It may not produce the shortest path.
- The usage of memory is more as it keeps all the nodes in the memory.
Now, let’s compare uninformed and informed search strategies.
Uninformed search is also known as blind search whereas informed search is also called heuristics search. Uniformed search does not require much information. Informed search requires domain-specific details. Compared to uninformed search, informed search strategies are more efficient and the time complexity of uninformed search strategies is more. Informed search handles the problem better than blind search.
Search algorithms are used in games, stored databases, virtual search spaces, quantum computers, and so on. In this article, we have discussed some of the important search strategies and how to use them to solve the problems in AI and this is not the end. There are several algorithms to solve any problem. Nowadays, AI is growing rapidly and applies to many real-life problems. Keep learning! Keep practicing!

About the Author
Dhanya thailappan.
Data Science and AI enthusiast
Our Top Authors

Download Analytics Vidhya App for the Latest blog/Article
Leave a reply your email address will not be published. required fields are marked *.
Notify me of follow-up comments by email.
Notify me of new posts by email.
Top Resources

How to Read and Write With CSV Files in Python:..

Understand Random Forest Algorithms With Examples (Updated 2023)

Understanding & Interpreting Confusion Matrices for Machine Learning (Updated 2023)

An Introduction to Large Language Models (LLMs)
Welcome to India's Largest Data Science Community
Back welcome back :), don't have an account yet register here, back start your journey here, already have an account login here.
A verification link has been sent to your email id
If you have not recieved the link please goto Sign Up page again
back Please enter the OTP that is sent to your registered email id
Back please enter the otp that is sent to your email id, back please enter your registered email id.
This email id is not registered with us. Please enter your registered email id.
back Please enter the OTP that is sent your registered email id
Please create the new password here, privacy overview.
We've updated our privacy policy. Click here to review the details. Tap here to review the details.
Activate your 30 day free trial to unlock unlimited reading.
Problem solving agents

You are reading a preview.
Activate your 30 day free trial to continue reading.

Check these out next

Download to read offline
Problem solving agents in A.I
Recommended

More Related Content
Slideshows for you (20).

Similar to Problem solving agents (20)

More from Megha Sharma (20)

Recently uploaded (20)

- 1. problem solving agents 9
- 2. Problem Solving An import application of Artificial Intelligence is Problem Solving. Define problem statement first. Generating the solution by keeping the different condition in mind. Searching is the most commonly used technique of problem solving in artificial intelligence.
- 3. Problem Solving Agents: A problem-solving agent is a goal-driven agent and focuses on satisfying the goal. Goal formulation, based on the current situation and the agent’s performance measure. It organizes steps required to achieve that goal. Goal Formulation Problem Formulation Problem formulation is the process of deciding what actions should be taken to achieve the formulated goal. Components involved in Problem Formulation Initial State Actions Transition model Goal test Path cost Steps performed by Problem-solving agent
- 4. Well Defined Problems And Solutions A problem can be defined formally by five components: The initial state that the agent starts in. A description of the possible actions available to the agent. A description of what each action does; the formal name for this is the transition model. The goal test, which determines whether a given state is a goal state. Sometimes there is an explicit set of possible goal states, and the test simply checks whether the given state is one of them. A path cost function that assigns a numeric cost to each path. The problem-solving agent chooses a cost function that reflects its own performance measure. State Space
- 5. 8 Puzzle Problem States: A state description specifies the location of each of the eight tiles and the blank in one of the nine squares. Initial state: Any state can be designated as the initial state. Actions: The simplest formulation defines the actions as movements of the blank space Left, Right, Up, or Down. Different subsets of these are possible depending on where the blank is. Goal State Initial State
- 6. Example: 8 Puzzle Problem Transition model: Given a state and action, this returns the resulting state. Goal test: This check whether the state matches the goal configuration. (Other goal configurations are possible.) Path cost: Each step costs 1, so the path cost is the number of steps in the path. Goal State Initial State
- 7. 8-Queens Problem The goal of the 8-queens problem is to place eight queens on a chess-board such that no queen attacks any other. • States: Any arrangement of 0 to 8 queens on the board is a state. • Initial state: No queens on the board. • Actions: Add a queen to any empty square. • Transition model: Returns the board with a queen added to the specified square. • Goal test: 8 queens are on the board, none attacked.
- 8. Thanks For Watching Reference: Artificial Intelligence A Modern Approach Third Edition Peter Norvig and Stuart J. Russell Next Topic: Uninformed Search. Subscribe Like Share
- 9. OMega TechEd About the Channel This channel helps you to prepare for BSc IT and BSc computer science subjects. In this channel we will learn Business Intelligence ,Artificial Intelligence, Digital Electronics, Internet OF Things Python programming , Data-Structure etc. Which is useful for upcoming university exams. Gmail: [email protected] Social Media Handles: omega.teched megha_with Subscribe
Share Clipboard
Public clipboards featuring this slide, select another clipboard.
Looks like you’ve clipped this slide to already.
You just clipped your first slide!
Create a clipboard
Get slideshare without ads, special offer to slideshare readers, just for you: free 60-day trial to the world’s largest digital library..
The SlideShare family just got bigger. Enjoy access to millions of ebooks, audiobooks, magazines, and more from Scribd.
You have now unlocked unlimited access to 20M+ documents!
Unlimited Reading
Learn faster and smarter from top experts
Unlimited Downloading
Download to take your learnings offline and on the go
Instant access to millions of ebooks, audiobooks, magazines, podcasts and more.
Read and listen offline with any device.
Free access to premium services like Tuneln, Mubi and more.
Help us keep SlideShare free
It appears that you have an ad-blocker running. By whitelisting SlideShare on your ad-blocker, you are supporting our community of content creators.
We've updated our privacy policy.
We’ve updated our privacy policy so that we are compliant with changing global privacy regulations and to provide you with insight into the limited ways in which we use your data.
You can read the details below. By accepting, you agree to the updated privacy policy.

Problem Solving Agents in Artificial Intelligence
In this post, we will talk about Problem Solving agents in Artificial Intelligence, which are sort of goal-based agents. Because the straight mapping from states to actions of a basic reflex agent is too vast to retain for a complex environment, we utilize goal-based agents that may consider future actions and the desirability of outcomes.
You Will Learn
Problem Solving Agents
Problem Solving Agents decide what to do by finding a sequence of actions that leads to a desirable state or solution.
An agent may need to plan when the best course of action is not immediately visible. They may need to think through a series of moves that will lead them to their goal state. Such an agent is known as a problem solving agent , and the computation it does is known as a search .
The problem solving agent follows this four phase problem solving process:
- Goal Formulation: This is the first and most basic phase in problem solving. It arranges specific steps to establish a target/goal that demands some activity to reach it. AI agents are now used to formulate goals.
- Problem Formulation: It is one of the fundamental steps in problem-solving that determines what action should be taken to reach the goal.
- Search: After the Goal and Problem Formulation, the agent simulates sequences of actions and has to look for a sequence of actions that reaches the goal. This process is called search, and the sequence is called a solution . The agent might have to simulate multiple sequences that do not reach the goal, but eventually, it will find a solution, or it will find that no solution is possible. A search algorithm takes a problem as input and outputs a sequence of actions.
- Execution: After the search phase, the agent can now execute the actions that are recommended by the search algorithm, one at a time. This final stage is known as the execution phase.
Problems and Solution
Before we move into the problem formulation phase, we must first define a problem in terms of problem solving agents.
A formal definition of a problem consists of five components:
Initial State
Transition model.
It is the agent’s starting state or initial step towards its goal. For example, if a taxi agent needs to travel to a location(B), but the taxi is already at location(A), the problem’s initial state would be the location (A).
It is a description of the possible actions that the agent can take. Given a state s, Actions ( s ) returns the actions that can be executed in s. Each of these actions is said to be appropriate in s.
It describes what each action does. It is specified by a function Result ( s, a ) that returns the state that results from doing action an in state s.
The initial state, actions, and transition model together define the state space of a problem, a set of all states reachable from the initial state by any sequence of actions. The state space forms a graph in which the nodes are states, and the links between the nodes are actions.
It determines if the given state is a goal state. Sometimes there is an explicit list of potential goal states, and the test merely verifies whether the provided state is one of them. The goal is sometimes expressed via an abstract attribute rather than an explicitly enumerated set of conditions.
It assigns a numerical cost to each path that leads to the goal. The problem solving agents choose a cost function that matches its performance measure. Remember that the optimal solution has the lowest path cost of all the solutions .
Example Problems
The problem solving approach has been used in a wide range of work contexts. There are two kinds of problem approaches
- Standardized/ Toy Problem: Its purpose is to demonstrate or practice various problem solving techniques. It can be described concisely and precisely, making it appropriate as a benchmark for academics to compare the performance of algorithms.
- Real-world Problems: It is real-world problems that need solutions. It does not rely on descriptions, unlike a toy problem, yet we can have a basic description of the issue.
Some Standardized/Toy Problems
Vacuum world problem.
Let us take a vacuum cleaner agent and it can move left or right and its jump is to suck up the dirt from the floor.

The vacuum world’s problem can be stated as follows:
States: A world state specifies which objects are housed in which cells. The objects in the vacuum world are the agent and any dirt. The agent can be in either of the two cells in the simple two-cell version, and each call can include dirt or not, therefore there are 2×2×2 = 8 states. A vacuum environment with n cells has n×2 n states in general.
Initial State: Any state can be specified as the starting point.
Actions: We defined three actions in the two-cell world: sucking, moving left, and moving right. More movement activities are required in a two-dimensional multi-cell world.
Transition Model: Suck cleans the agent’s cell of any filth; Forward moves the agent one cell forward in the direction it is facing unless it meets a wall, in which case the action has no effect. Backward moves the agent in the opposite direction, whilst TurnRight and TurnLeft rotate it by 90°.
Goal States: The states in which every cell is clean.
Action Cost: Each action costs 1.
8 Puzzle Problem
In a sliding-tile puzzle , a number of tiles (sometimes called blocks or pieces) are arranged in a grid with one or more blank spaces so that some of the tiles can slide into the blank space. One variant is the Rush Hour puzzle, in which cars and trucks slide around a 6 x 6 grid in an attempt to free a car from the traffic jam. Perhaps the best-known variant is the 8- puzzle (see Figure below ), which consists of a 3 x 3 grid with eight numbered tiles and one blank space, and the 15-puzzle on a 4 x 4 grid. The object is to reach a specified goal state, such as the one shown on the right of the figure. The standard formulation of the 8 puzzles is as follows:
STATES : A state description specifies the location of each of the tiles.
INITIAL STATE : Any state can be designated as the initial state. (Note that a parity property partitions the state space—any given goal can be reached from exactly half of the possible initial states.)
ACTIONS : While in the physical world it is a tile that slides, the simplest way of describing action is to think of the blank space moving Left , Right , Up , or Down . If the blank is at an edge or corner then not all actions will be applicable.
TRANSITION MODEL : Maps a state and action to a resulting state; for example, if we apply Left to the start state in the Figure below, the resulting state has the 5 and the blank switched.

GOAL STATE : It identifies whether we have reached the correct goal state. Although any state could be the goal, we typically specify a state with the numbers in order, as in the Figure above.
ACTION COST : Each action costs 1.
You Might Like:
- Agents in Artificial Intelligence
Types of Environments in Artificial Intelligence
- Understanding PEAS in Artificial Intelligence
- River Crossing Puzzle | Farmer, Wolf, Goat and Cabbage
Share Article:
Digital image processing: all you need to know.

Ads Blocker Detected!!!
We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

IMAGES
VIDEO
COMMENTS
The problem-solving agent performs precisely by defining problems and several solutions. So we can say that problem solving is a part of
Problem Solving Agent ... Example: Vacuum world, The effect of a suck action is random. There is no action sequence that can be calculated at planning time and is
Let us take the example of vacuum world that was introduced in the starting of this series, There is a vacuum cleaner agent and it can move left
Slide 6 of 27.
An agent that tries to come up with a sequence of actions that will bring the environment into a desired state. Search: The process of looking for such a
The basic crux of artificial intelligence is to solve problems just like humans. Examples of Problems in Artificial Intelligence.
Define problem. Problem Solving Agents: A problem-solving agent is a goal-driven agent and. Well Defined Problems And Solutions A problem can be defined
Artificial Intelligence – Intelligent Agents. Problem-Solving Agents. Subclass of goal-based agents goal formulation problem formulation example problems.
Initial State. It is the agent's starting state or initial step towards its goal. For example, if a taxi agent needs to travel to a location(B)
Artificial_intelligence #problem_solving_agents Hello Friends, In this video you are going to learn about : problem solving agents.