Thursday, March 5, 2026
Home Blog Page 14

Step wise Explanation of Applying rules and Introduction to Production System

Applying rules and Introduction to Production System

Here in this case I have applied only one rule (among four i.e., moving right, left, up and down) which is closer to goal. In practical, all the rules are applied and selects the best outcome which is closer to the goal and continues the generation of new state till the goal state is achieved. 

283
164
7 5
Intial state

                  ↓                   

283
1 4
765
Moved the empty tile to up .Therefore 6 comes to down position

                 

2 3
184
765
Here the empty tile is moved up. Therefore 8 comes down

                 ↓

 23
184
765
Here the empty tile moved left. therefore 2 comes to right

                 ↓

123
 84
765
Here the empty tile moves down .Therefore 1 comes up

                 ↓

123
8 4
765
Here the empty tile moves right. Therefore 8 comes left.


Here my goal position is achieved. Starting from a start position and which was part of a space of the problem state which we have seen is a factorial 9. We could go and look at different configurations on the way generating lot of them and arrived at the goal position ‘D’ from a start position ‘s’. This paradigm of working like this is problem solving as state space search.

Production Systems and AI:

A production system consists of

1. Database

2. Operations

3. Control components.

Here this database is different from data based systems. Here database refers to set of rules and facts. Operations and Control components are the building blocks for constructing lucid descriptions of AI systems. Several AI systems exhibit little or high rigid isolation among the computational components of data, operations and control.

Production system involves an isolation of these computational components and thus seem to capture the essence of operation of most  AI systems. Selecting rules and monitoring of those sequences of rules constitute the control strategy for production systems.

What does production systems of AI?

1) Database 2) Operations 3) Control System

Description Of a Problem in AI (Artificial Intelligence)

Description of Problems in AI consists of 4 states as below

1) State Space

2) Initial State

3) Final State

4) Operators

State Space

State space: The state space is defined as the set of all possible configurations of a relevant object.

Initial State

Initial state: Initial state specifies one or more states within that space as a possible situations from which the problem solving starts.

Final State


Final state: Final state specify one or more states that could be acceptable as solutions to the given problem.

Operators


Operators: Operators are the set of rules that describe how we are going to move from one state to other.

The above is the formal description of problem solving a state space search First we have to define state space i.e., all the possible configurations. We then identify one or more states within the space as possible situations from which we can start. This is the initial state from which one or more states from the problem space that are acceptable as solutions to the given problem is referred as final state operators have two portions one is right and the other is left.

As we know that operators are the set of rules which describes how we are moving from one state to other This information regarding the move must be true. For suppose in the above example of 3*3 matrix. In this case we have 8 tiles with information and one with empty space this empty space is a problem state. Some rules are specified to this problem state like move right or left or up or down.

Here if we apply any one among the rules lets say like to move right. It can be done and by this action new state space is generated. The second rule is to move left here in this case the second rule is not applicable. So when we specify the rules that describes actions it must be true for the action to take place needs to be looked at first and then the action can take place and generates new state space.

Example:

Start ‘S’
2 8 3
1 6 4
7 5
Destination ‘D’
1 2 3
8 4
7 6 5

Example For Problem AS State Space & Description Of A Problem


Playing Chess

  1. Initial state as an 8*8 array. 2 legal moves as set of rules; each rule consisting of two parts.
  2. A left side serves as pattern that has to be matched.
  3. A right side that describes the change to reflect the move.
  4. Destination state as any board position where opponent does not have a legal move. Therefore its a win. When we start playing chess by starting at an initial state using a set of rules to move from one state to another we end up in one of the set of final states. This state space representation seems natural for games such as chess, 8 puzzle because of the state problems with the use of more complex structures than a matrix. Here for a 8 puzzle game we used 33 matrix and for chess a 8*8 matrix comes into mind immediately. This kind of state space representation also used for other similar problems with less structures. But in case of small structures to use state space representation for this type of structures we require more complex structures than a matrix.

Description Of a Problem

General description of problem involve the following.

1) State space

2) Initial states

3) Destination or final state 4. operator

Problem As State Space Search

State space consists of all the problem solving tasks.

State space: A state space consists of all the states ,set of operators that shifts  from one state to another.

States are also known as nodes in a connected graph and the edges are denoted as operators. Problem solving can be formulated as search in state space. For example to find the solution of an 8 puzzle game which is represented as 3*3 matrix.             

123
 45
678


 One of the tile is unoccupied by moving this tile to other positions we can create new states. For example if I move this unoccupied block to right then it becomes

123
4 5
678

            New state    

Here we can create ‘n’ number of states. The number of new states generated all together constitutes to a state space.

All of these states of the domain and all of these operators. In this case it could be 4 operators they are the tile can move towards right, left ,up and down. All these operators together constitute to asset of operators. Once the set of operators and actions are defined then move on to finding solution.

For suppose there are two states start state and end state. If the path from start state to end state is found then the problem is solved. State space is defined as the set of all possible configurations that one get from the relevant objects. This is also referred to problem space.

Let us take previous example 3*3 matrix having 8 elements and one empty space. This empty space is a problem state. Suppose the first matrix is start and the second is destination, the path from ‘S’ to ’D’ the total number of configurations is 9!.

123
45
678

       Start state ‘S’       

123
84
765

    Destination State ‘D’

MatLab operators

0

An operator is an image that tells the compiler to carry out numerous numerical or logical manipulations. MATLAB is designed to perform especially on complete matrices and arrays.

Arithmetic Operation:

There are specific form of mathematics operators in matlab they are:

  • Matrix mathematics operation.
    • Array mathematics operation.

 Arithmetic operator are used to carry out matrix manipulation, it used for performing smooth mathematics operation which is probably together with numbers, subtraction, division, Array mathematics operations are executed detail via way of way of detail, and may be used with multidimensional arrays, each operands need to be the identical size.

Matrix operations observe the rules of linear algebra. By contrast, array operations execute detail via way of way of detail operations and help multidimensional arrays. The character (.) defines the array operations from the matrix operations.

+     Addition. A+B adds A and BA and B must have the identical size, except one is a scalar. A scalar may be added to a matrix of any size.

-     Subtraction or unary minus. A-B subtracts B and AA and B must have the identical size, except one is a scalar. A scalar can perform multiplication of a matrix of different or same size.

*   The matrix multiplication of fabricated from matrices may be calculated with the formula, C = A*B.

For nonscalar A and B, the fashion of columns of A want to identical to the fashion of rows of B.

.*    Array multiplication or Element-sensible multiplication, A.*B is the detail-via way of way of-detail fabricated from the arrays A and B.A and B want to have the identical size.

 /       Matrix right division, B/A is quite same as B*inv(A). they will more precisely, B/A = (A'\B')'.

./      Array right division. A./B is the matrix with elements A(i,j)/B(i,j). Aand B must have the identical size, except truly considered one in every of them is a scalar.

.\Array left division. A.\B is the matrix with elements B(i,j)/A(i,j). A and B must have the identical size, except truly considered one in every of them is a scalar. .\

.\   Array left division. A.\B is the matrix with elements B (i,j)/A(i,j)A and B must have the identical size, except truly considered one in every of them is a scalar.

    '       Matrix transpose. A'is the linear algebraic transpose of A. For complicated matrices, that is the complex conjugate transpose.

   .'     Array transposeA.' is the array transpose of A. For complicated matrices, this does not comprise conjugation.

Logical Operators

Logical operator performs logical operation and provides it output in the form of boolean i.e., true or false. Matlab has three types of logical operators they are:

  • Element-wise operator.
  • Bit- wise operator.
  • Short-circuit.

Element wise operator performs element wise logical operation on the input same sized output array.

&   Logical AND It returns 1 for every element location that is true (notzero) in both arrays and 0 for all other elements. For example.

A = [0 1 1 0 1];
B = [1 1 0 0 1];

A & B = 01001

|    Logical OR It returns 1 for each detail area this is real (nonzero) in every one or the wonderful, or each arrays, and zero for all wonderful elements. For example

A = [0 1 1 0 1];
B = [1 1 0 0 1];

A| B=11101

   ~     Logical NOT It complements the input array of each given element, A.

A = [0 1 1 0 1];
B = [1 1 0 0 1];

~A = 10010

Xor   It returns 1 for every element location that is true (notzero) in only one array, and 0 for all other elements.

A = [0 1 1 0 1];
B = [1 1 0 0 1];

Xor (A, B)=10100

Data Types in Matlab

0

Class require different storage amounts logical value or 8-bit integer is the smallest of all and it require 1byte.

INTEGER:

  • Use for signed and unsigned whole numbers.
  • Most efficiently use of memory.
  • intmin and intmax useful to show the range of values.
  • Chooses from 4 different sizes (8, 16, 32, and 64 bits).

       Example: int8, uint8, int16, uint16, int32, uint32, int64, uint64

In matlab it as four signed and unsigned integer classes. Signed work for positive and negative values but wide range of numbers cannot represented as unsigned type.

LOGICAL OPERATIONS:

  • Itconsist of two values i.e., true or false.
  • It is used to test state or for relational condition.
  • It useful for array indexing.
  • Inefficiency of two dimensional arrays.

CHARACTER AND STRING:

  • Data type into text.
  • Native or Unicode.
  • Which is used to convert to/from numeric.
  • For multiple strings.

FLOATING POINT NUMBER:

  • It is default numerical type in matlab.
  • To show range of values it uses realmin and realmax.
  • Two-dimensional array can sparse.
  • Floating point number is represented in Double and single precision in matlab.

In matlab default is double but using some techniques we convert into single precision with simple conversion.

STRUCTURES:

  • It require more memory for overhead.
  • Method of passing function arguments.
  • It can access one or all fields in single operation.

CELL ARRAYS:

  • Cells useful for storing varying classes and size of array.
  • It requires more memory for overhead.
  • In order to handle elements similarly as numeric or logical arrays.
  • To package data as you want it allows you the freedom.

TABLES:

  • Rectangular container will manipulate the mixed-type and column-oriented data.
  • Row names and variable names will identify contents.
  • We can use Table Properties in order to store metadata such as variable units.
  • In order to handle elements similarly as numeric or logical arrays.
  • We can access data in numeric or named index form.

FUNCTION HANDLES:

  • Pointer to a function.
  • Enables passing a function to another function.
  • It used to call functions outside for usual scope.

Commands in Matlab session

0
  • Command                   Description
  • CLC                           clearing of command window.
  • CLOSE ALL             Closes all plots.
  • CLEAR                       variables removed from the memory.
  • HELP                         Searches for a topic you need.
  • EXIST                        command used to check for the availability of file or variable.
  • GLOBAL                   Declaration of variables as global.
  • QUIT                          Stops MATLAB session.
  • EPS                                Defining accuracy of floating-point precision.
  • INF                              defined for Infinity.
  • NAN                           not defining a numerical result (not a number).
  • Pi                                The number p.
  • Cd                               useful for changing the current directory.
  • DATE                         present day date is displayed.
  • DELETE                         useful for deleting a File.
  • PRINT                             Prints a plot.
  • AXIS                                Sets axis limits.
  • GRID                         Gridlines will be displayed.
  • PLOT                         plots of x and y axis will be displayed.
  • PRINT                        Prints the plots and saved it to file.
  • TITLE                        To provide text on top of plot.
  • X-LABEL                  x-axis is added with labels.
  • Y-LABEL                  y-axis is added with labels.
  • HOLD                             fix the current plot.
  • FIGURE                    new figure window is created.
  • SUBPLOT                 shows plots in subwindows.
  • STEM                         shows stem plot
  • ONES                          Creates an array of ones.
  • ZEROS                        A zero array is created.
  • %s                                Format as a string.
  • %d                               Format as an integer.
  • %f                                Format as a floating point value.
  • \n                                     enter a new line in the output string.
  • \t                                      In order to insert a tab in the output string.
  •  [ ]                                     Brackets; enclosures array elements.
  •  .                                               Symbol is used to define decimal point.
  • +                                      Addition operation
  • –                                               Subtraction operation.
  • *                                              performs Scalar and matrix multiplication.
  • INPUT                            Waits for input by displaying prompt.
  • RESHAPE                      used to change size.
  • DET                                perform determinant of an array.
  • INV                                 perform inverse of a matrix.
  • RAND                           Distributed random elements uniformly.
  • RANDN                         Random elements will be distributed normally.

DELETING ROWS AND COLUMNS:

              Pair of square brackets useful for performing deleting row and column operation. Let begin with

 A = D;

 In order to delete the second column of A, let use the equation as shown

 A (:, 2) = []

This changes A to A = 16    2    13

                                      5     11    8

                                       9     7     12

                                      4     14     1

If you will delete any one element from a matrix, the result will not anymore a matrix. So, expressions like

A (1, 2) = []

 Result in an error. From the above operation we know how to delete a single element, or sequence of elements, and how to change the remaining shape of the elements into a row vector.

So A(2:2:10) = []

Results in X = 1   6   9   2   7    13   12   1

DATA TYPES IN MATLAB:

With the help of different types of data types or classes you can work with you code by creating arrays, table, matrices, floating-point and so on. Matlab combines integers, floats and booleans into one thing: doubles or floating point number.

 Example: >> a = 1.54 % this is a double

                  >> b = a > 1 % Logical (Boolean) double.

Strings. Character arrays will be treated as string matlab.

>>b = ‘abcd’ % NOTE that matlab uses single quotes

>>b (2:3)

Arrays/Matrices of numbers. In order to separate rows we use this operator ‘;‘, or same goes with blank space to separate columns ‘,’.

a= [4 5 6; 1, 2, 3].

Cell array is way to store mixed data or several strings.

d = {‘abcd’, 1, [123], ‘def’

There are 16 fundamental classes in MATLAB. Most of the classes are in the form of an array or a matrix. With the exception of function handles, this matrix or array starts with a minimum of zero in size and it will grow to an n-dimensional array of maximum size. A function will always handle in scalar matrix.

AI Technique:

AI technique is a method that exploits the knowledge and represented in  such a way that

 knowledge captures generalization. Here generalization states that whenever we are talking of a technique that exploits AI we are interested in capturing the general information of the problem instead of specific information.

2.  Another important characteristic of AI is that the knowledge that is captured should be understood by people who provide it.

3. Another characteristic is that the knowledge that is provided should be easily modified.

AI technique such that used to help overcome its own sheer bulk.

What is an AI technique?

The main aim of AI is to build a system to solve a particular problem. In order to build a system we need to do four things

  1.  Problem definition: We need to define the problem precisely. Problem definition is as important as what knowledge we capture for a problem.

 2.  Analysis of the problem: One needs to understand what type of problem that we are trying to tackle about.

 3. Isolate and represent task knowledge.

4. Choose the best problem- solving techniques.

Traditional programming Vs Programming with AI

Traditional ProgrammingProgramming with AI
Program can answer only the specific questions that it is meant to solve.Program with AI can solve all the generic questions that is designed to solve
Modification in the program leads to change in its structureModifications in program do not change the structure.
Modification may lead to affecting the program adversely.Modification in program is made easy and quick.

AREAS CONTRIBUTE TO THE GROWTH OF AI

4.ECONOMICS:

Economics also has a great impact on AI in theories like theories of utility and decision theory.

5.NEUROSCIENCE:

The other area is neuroscience which involves neurons as the information processing units.

6.PSYCHOLOGY:

Psychology involves how people behave ,perceive and process.

7.COGNITIVE SCIENCE:

Cognitive science involves cognitive information and represent knowledge.

8.COMPUTER ENGINEERING:

Computer Engineering is involved with building fast computers.

9.CONTROL THEORY:

Control Theory involves designing the systems that maximize an objective function over time.

10.LINGUISTICS:

The area that made huge impact in a way AI developed over years is linguistics. It involves knowledge representation.

A Brief History of AI and developments made in each year.

  1943:

McCulloch and pits developed Boolean circuit model of brain which is a neural model.

  1950’s:

1. Turing’s “computing machinery and Intelligence”.

             2.Samuel’s checkers program

            3. First program of ML

             4. This Samuels checkers program running on IBM machine could defeat the human.

             5.Early AI programs by Newell and Simon’s logic Theorist.

1955-1965:

1.With the Dartmouth meeting the term ‘AI’ was named.

                     2. Newell and Simon developed general problem solver. 

                     3.Gelertner developed geometry theorem prover.

                     4. McCarthy invented LISP (programming language).

1966-1973:

In this year people realized that many AI problems are intractable and identified the limitations of existing neural network methods.

1969-1985: 

   1.Development of knowledge based systems.

2.Success of rule based expert systems such as DENDRAL, MYCIN. But these did not scale                                                                                         

                     Well in practice.

1986 onwards:

1.Rise of ML

                         2.Network returned to popularity.

                        3.Major advances in ML both in algorithms and applications.

Beginning of 1990:

Role of uncertainty, In this age people began to start think about uncertainty. They came towards Bayesian networks for knowledge representation.

Beginning 1995:

AI as science.

During this age, there was integration of learning, reasoning , knowledge representation.

AI methods began to use in vision, language and data mining.

Early days of AI:

In late 1995, Alen Newell and Herbert Simon developed the logic theorist. This was the first AI program representing each problem in form of tree and can be solved by selecting the branch that would most likely result in the correct conclusion.

In 1956,John McCarthy organized a conference on artificial intelligence. John McCarthy is one of the founding fathers of AI together with Marvin Minsky, Allen Newell and Herbert A. Simon. In 1985,Charniak and Mc Dermott stated that” the ultimate goal of AI is to build a person”.

            Later, it was summed up by Haugland that “don’t say that the ultimate goal of AI is to build something that appears to be a person”. The fundamental goal of AI according to Haugland is machines  with minds not merely to mimic intelligence or to produce some cleaver fake .

            Nilsson’s definition of AI  is that AI is to build machines that perform tasks normally requiring human intelligence. To perform the same task  that humans require intelligence by machines the following should be involved in machines:

 Interaction with real world:

 This means that the machine should be able to perceive, understand and act .It involves things such as speech recognition and image understanding.

Reasoning and planning:

This involves modeling the external world, planning and decision making and deals with unexpected problems and uncertainties.

Learning and Adaptation:

Any intelligent system should be able to learn and adapt. It should have internal models  which should be always updated for example a baby learning to categorize and recognize the things example: Animal.

The areas that contributed to the growth of AI:

A huge number of disciplines contributed to growth of AI. The following are the list of areas that made huge impact on the growth of AI

1.PHILOSOPHY:

 In philosophy It involves logic and methods of reasoning

2.MATHEMATICS:

One of the major contributions to growth of AI is mathematics. It involves format representation and proof Theory algorithms: computation – Decidability and tractability.

3.STATISTICS AND PROBABILITY:

The third area that contributed to growth of AI is Probability and Statistics, It involves uncertainty and learning from the data.