When I started to learn artificial intelligence: knowledge representation method

Come on, come on, review and play before May Day, and you can go out to play on May Day


1. State Space Representation

There are two main aspects of problem solving techniques

  • problem expression
  • solution method

state space method

  • state
  • operator
  • state space method

1.1 Problem Status Description

definition

  • State : An ordered collection of a set of minimum variables q0, q1, ..., qn introduced to describe the difference between certain types of different things.
  • Operator : The means by which a problem changes from one state to another is called an operator or operators.
  • The state space of the problem : is a graph representing all possible states of the problem and their relationships, which contains a set of three descriptions, namely the ternary state (S, F, G).

insert image description here
insert image description here

1.2 State Diagram Method

Directed graph
Path
Cost
Graph display description
Graph implicit description

1.3 State Space Representation Example

1.3.1 The eight-digit puzzle

On a 3×3 chessboard, there are eight chess pieces, each marked with a number from 1 to 8. There is also a space on the board, and pieces adjacent to the space can be moved into the space.
How to change the chessboard from some initial state to the final goal state?
insert image description here
insert image description here

1.3.2 A name of a boy

Genetics Professor
Wanting to name her new baby boy
Using only the letters D,N & A
Search by writing down possibilities (states)
D,DN,DNNA,NA,AND,DNAN, etc.
Operators: add letters on to the end of already known states
(i) add a ‘D’ to an existing string
(ii) add an ‘N’ to an existing string and
(iii) add an ‘A’ to an existing string
Initial state is an empty string
Goal test
Look up state in a book of boys names
Good solution: DAN

Question
How many strings of 3 or fewer letters are there where the
letters are D, N or A?
Are you guaranteed to find all boys names with letters D,
N and A in this manner?
Answer
For strings of length 3, there are three choices for the first
letter (D, N and A), three choices for the second and three
choices for the third. Hence, there are 333 = 27 possible
three-letter names with D, N and A in. Similarly, there are
3*3 = 9 possible two-letter names and 3 possible one
letter names. Adding all the possibilities up, we get: 27 +
9 + 3 = 39 possible names.
Yes, all names will eventually be enumerated .

insert image description here

1.3.3 The missionaries and wildlings problem

There are three missionaries M and three savages C crossing the river, and there is only one boat that can hold two people. On one side of the river or on the boat, if the number of savages is greater than the number of missionaries, then the missionaries will be in danger. Can you Can't come up with a safe way to cross the river?

How to define state?
How many meaningful states are there?
What operations are available,
what are the execution conditions and actions of the operations?

State : the "position" and "situation" of the problem at a certain moment.
According to the factors concerned by the problem, it is generally expressed in vector form, and each bit represents a factor

insert image description here
insert image description here

insert image description here

2. Problem reduction method

insert image description here
Components of the problem reduction representation :

An initial problem description;
a set of operators that transform the problem into subproblems;
a set of primitive problem descriptions.

The essence of problem reduction :
starting from the target (problem to be solved), reverse reasoning, establishing sub-problems and sub-problems of sub-problems, until finally reducing the initial problem to a set of ordinary primitive problems.

2.1 Fanta problem

insert image description here

insert image description here

2.2 AND OR Graph

2.2.1 and figure, or figure, and or figure

insert image description here
insert image description here

insert image description here
insert image description here
General definition of unsolvable nodes

  • A non-terminal node with no descendants is an unsolvable node.
  • All descendants are unsolvable non-terminal nodes and contain or successor nodes,
  • It is this nonterminal node that is unsolvable.
  • The descendant has at least one non-terminal node that is unsolvable and contains a successor node, and this non-terminal node is unsolvable.

AND OR Graph Formation Rules

  • Each node corresponds to a question or a set of questions
  • The terminal leaf node corresponds to a primitive problem
  • Transform the problem into a set of sub-problems through operators
  • Connect the AND nodes of the same subproblem with connecting lines

2.3 Steps:

  1. Each node in the AND or graph represents a single problem or a set of problems to be solved, and the starting node corresponds to the original problem;
  2. The node corresponding to the original problem is called terminal leaf node, which has no descendants;
  3. Transform the problem into a set of sub-problems, pointing to subsequent nodes with directed arcs;
  4. Connect all arcs that share a common parent node with descendants of the node with small arcs;
  5. When only one operator is applied to a problem, intermediate or nodes representing sets of subproblems can be omitted.

Answer:
insert image description here

3. Predicate logic method

What is a predicate?

原子命题中刻画个体的性质或个体间关系的成分
  • Predicate logic is a formal language
  • It is the most precise language that can express the laws of human thinking activities so far
  • Close to natural language, and convenient to store in computer for processing
  • The earliest application in artificial intelligence to represent knowledge
  • It is suitable for expressing the state, attribute, concept, etc. of things, and it can also be used to express the definite causal relationship between things

3.1 Predicate formula

Terms (terms)
a. A constant is a term
b. A variable is a term
c. If f is an n-ary function symbol and t1,t2,…,tn are terms, then f(t1,t2,…,tn) is also a term d. All items are Atoms (atomic formulas)
produced by the rules (a)(b)©. If P is an n-ary predicate symbol, and t1,t2,…,tn are items, then P(t1,t2,…, tn) is an atomic formula or atomic predicate formula, and any other expression is not an atomic formula. The value is true T when the corresponding statement is true in the domain, otherwise it is false F.


insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

example

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/weixin_62529383/article/details/130164095