# Means-Ends Analysis in Artificial Intelligence

In this page we will learn about How means-ends analysis Works, Operator Subgoaling, Algorithm for Means-Ends Analysis, Example of Mean-Ends Analysis.

• We've looked at tactics that can reason in either forward or backward directions, but a combination of the two is best for addressing a complex and vast problem. This mixed technique allows you to solve the large component of a problem first, then go back and fix the minor issues that develop while merging the major elements of the problem. Means-Ends Analysis is one such technique.
• Means-Ends Analysis is a problem-solving method used in artificial intelligence programs to limit search.
• It's a hybrid of backward and forward searching methods.
• The MEA technique was originally used in a problem-solving computer software called General Problem Solver by Allen Newell and Herbert A. Simon in 1961. (GPS).
• The discrepancy between the existing state and the goal state was evaluated during the MEA analysis procedure.

## How means-ends analysis Works:

The discrepancy between the existing state and the goal state was evaluated during the MEA analysis procedure.

The means-ends analysis approach can be used to solve a problem in a recursive manner. It's a problem-solving method for controlling search. The following are the main steps that describe how the MEA technique for problem solving works.

• To proceed, assess the difference between the initial and end states.
• Choose from a variety of operators to apply to each difference.
• Applying the operator to each difference lowers the gap between the current and desired states.

## Operator Subgoaling

We detect disparities between the existing state and the goal state during the MEA process. Once these discrepancies have occurred, we can use an operator to decrease them. However, there are situations when an operator cannot be applied to the existing state. So we build a subproblem of the current state in which an operator can be applied; this sort of backward chaining, in which operators are chosen and then sub goals are established to define the operator's preconditions, is known as Operator Subgoaling.

## Algorithm for Means-Ends Analysis:

Let's take Current state as CURRENT and Goal State as GOAL, then the steps for the MEA algorithm are following.

Step 1: Compare CURRENT and GOAL, and if there are no discrepancies, return Success and Exit.

Step 2: If not, choose the most significant difference and lessen it by following the steps below until success or failure is achieved.

1. Choose a new operator O that applies to the current difference, and if no such operator exists, signal failure.
2. Try to apply operator O to CURRENT. Make description of two states.
• O-Start, a state in which O?s preconditions are satisfied.
• O-Result, the state that would result if O were applied In O-start.
3. If
(First-Part <------ MEA (CURRENT, O-START)
And
(LAST-Part <----- MEA (O-Result, GOAL), are successful, then signal Success and return the result of combination of FIRST-PART, O, and LAST-PART.

The algorithm described above is better suited to tackling simple problems than it is to solving complex problems.

## Example of Mean-Ends Analysis:

Let's look at an example where we know the starting state and the desired state. In this issue, we must detect differences between the beginning state and the goal state and apply operators to obtain the goal state.

## Solution:

To solve the problem, we will first identify the differences between starting and goal states, then construct a new state and apply the operators to each difference. For this problem, we have the following operators:

• Move
• Delete
• Expand

1. Evaluating the initial state: In the first step, we'll evaluate the initial state and compare it to the Goal state to see what the differences Evaluating the initial state: In the first step, we'll evaluate the initial state and compare it to the Goal state to see what the differences are.

2. Applying the Delete operator: As you can see, the first difference is that there's no dot symbol in the Goal state, whereas there is in the initial state, so we'll use the Delete operator to remove it.

3. Applying the Move Operator: After using the Delete operator, a new state appears, which we will compare to the objective state again. After comparing these states, we notice that the square is outside the circle, so we'll use the Move Operator to fix it.

4. Applying the Expand Operator: In the third phase, a new state is created, and we will compare it to the desired state. There is still one difference between the states, which is the size of the square, so we will use the Expand operator to construct the desired state.