JPS60134349A - System for executing inferring process at high speed - Google Patents

System for executing inferring process at high speed

Info

Publication number
JPS60134349A
JPS60134349A JP58239760A JP23976083A JPS60134349A JP S60134349 A JPS60134349 A JP S60134349A JP 58239760 A JP58239760 A JP 58239760A JP 23976083 A JP23976083 A JP 23976083A JP S60134349 A JPS60134349 A JP S60134349A
Authority
JP
Japan
Prior art keywords
rule
condition
stack
inference
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP58239760A
Other languages
Japanese (ja)
Inventor
Shiyouichi Masui
増位 庄一
Seiju Funabashi
舩橋 誠寿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP58239760A priority Critical patent/JPS60134349A/en
Publication of JPS60134349A publication Critical patent/JPS60134349A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To execute an inferring process at high speed without requiring an overall coincidence collation, when collating a premise part of each inference rule and a present condition knowledge, by holding to which condition each present condition knowledge coincides. CONSTITUTION:A discriminating net part 2 is an m-ary tree for executing a lot of branch judgment at each node. Matching of an initial element of a working memory and a condition is executed, and a condition stack is set to a condition stack part 3. An interpreter checks the contents of its condition stack part 3 at every rule, and in case when no variable is contained in the rule, an element of the uppermost part of each condition stack becomes a matching element group of its rule, and its group is inputted to a rule stack part 4. The new one of the element of the highest rank of each rule stack of the rule stack part 4 becomes an execution rule.

Description

【発明の詳細な説明】 〔発明の利用分野〕 本発明は、予め設定された推論知識により、現在の状況
から予想される将来の状況又は現在の状況を現出した要
因に関する推定を計算機を用いて行わせる方法に係シ、
特に推論知識が数多くの推論ルールから成る場合に好適
な推論過程の高速化方式に関する。
[Detailed Description of the Invention] [Field of Application of the Invention] The present invention uses a computer to estimate the future situation expected from the current situation or the factors that brought about the current situation, based on preset inferential knowledge. Regarding the method of making
In particular, the present invention relates to a method for speeding up the inference process, which is suitable when the inference knowledge consists of many inference rules.

〔発明の背景〕[Background of the invention]

従来、推論知識を、前提と結論の対として表現し、その
推論知識の前提部と現在の状況から結論を導出し、その
導出された結論と、その結論を前提部にもつ別の推論知
識から新しい結論を導くという形式により、計算機に推
論能力を与える方法が人工知能の一方法論として案出さ
れている。この推論方法は、例えば、小林重信:知識工
学;計測と制御、VoL、22 AX pI)146〜
152 (昭和58年1月)でプロダクションシステム
と呼ばれ、数多くの計算機による推論を要する応用に用
いられティる(例えば3hortliff、 E、 H
:Computer −J3ased Medical
 CoHsul tatiolls −MYCIN ;
 AmericaHElsevier、New Yor
l(1976)。
Conventionally, inferential knowledge is expressed as a pair of premises and conclusion, a conclusion is derived from the premise of the inferential knowledge and the current situation, and the derived conclusion is expressed as a pair of premises and a conclusion from another inferential knowledge that has the conclusion as the premise. A method of giving computers reasoning ability by drawing new conclusions has been devised as a methodology for artificial intelligence. This reasoning method is used, for example, in Shigenobu Kobayashi: Knowledge Engineering; Measurement and Control, VoL, 22 AX pI) 146~
152 (January 1982), it is called a production system and is used for applications that require reasoning by numerous computers (for example, 3hortliff, E, H
:Computer-J3ased Medical
CoHsul tatiolls -MYCIN;
AmericaHelsevier, New York
l (1976).

′!!、た、プロダクションシステムの一般的概説は、
例えば、知識ペースシステム用ツール:平井成典。
′! ! ,The general overview of the production system is as follows.
For example, tools for knowledge pace systems: Shigenori Hirai.

計測と制御 voL、22A9pp761〜766(1
983,9)で述べられている。
Measurement and Control vol, 22A9pp761-766 (1
983, 9).

ところで、この推論方法を大量の推論知識を侠する推論
に用いる場合、前述の小林:知識工学で指摘されている
様に、「組み合せ爆発」の問題が生じ、推論知識を構成
する推論ルール(前提と結論の対)の数及び現況知識(
現在の状況及び推論ルールから導かれる結論)の数の増
加に伴い、推論時間が延び、遂には使用に耐えなくなる
という状況に陥ることがある。これは、推論機構が推論
知識を適用するにあたって、1回毎に推論ルールと現況
知識の一致性を、各推論ルール毎にしらみつぶし的に調
べるという方法を用いているところに帰因し、1回の推
論当シの計算量が、推論ルール数と現況知識の数の積に
比例し、推論ルール数や現況知識の増加が飛躍的な一致
照合時間の増加をもたらすために他ならない。
By the way, when this inference method is used for inference involving a large amount of inference knowledge, the problem of ``combinatorial explosion'' occurs, as pointed out in the aforementioned Kobayashi: Knowledge Engineering, and the inference rules (premises) that make up the inference knowledge and conclusion pairs) and the number of current knowledge (
As the number of conclusions drawn from the current situation and the inference rules increases, the inference time increases, and it may eventually become unusable. This is due to the fact that when the inference mechanism applies inference knowledge, it uses a method of exhaustively checking the consistency between the inference rule and the current knowledge for each inference rule. This is because the amount of calculation required for inference is proportional to the product of the number of inference rules and the number of current state knowledge, and an increase in the number of inference rules and current state knowledge results in a dramatic increase in matching time.

これを回避する方法として、推論ルールをいくつかの知
識ソースに分割し、(1)知識ソースの選択と、(2)
選択された知識ソースに係る推論ルールのみをアクティ
ブ推論ルールとして一致照合するという二段階で、推論
を進める方式が案出されておシ、 (AGEReチer
efice Manual 、AGE−1:Qcl 1
981 Heuristic programHypr
ojeCt、C0nputer 5eieHce ])
epartmeHt+5taHford Univer
sity )効果を上げている。
As a way to avoid this, the inference rules are divided into several knowledge sources, and (1) knowledge source selection and (2)
A method has been devised to proceed with inference in two steps, in which only inference rules related to the selected knowledge source are matched as active inference rules.
efice Manual, AGE-1:Qcl 1
981 Heuristic programHypr
ojeCt, C0nputer 5eieHce ])
epartmeHt+5taHford Univer
city) has been effective.

しかし、この方法にしても、一つの知識ソース内のルー
ルが大きくなった場合にはやは9時間消費的になシ、ま
た現況知識の増大に関しては無力でおる等の問題がある
However, even with this method, there are problems, such as when the rules within one knowledge source become large, it becomes consuming 9 hours, and it is powerless to increase the current state of knowledge.

〔発明の目的〕[Purpose of the invention]

本発明の目的は、上記問題を解決するためになされたも
ので、大量の推論知識及び現況知識を有する推論過程に
おいて、その推論ルールと現況知識の一致照合が推論ル
ール数及び現況知識数に依存しない推論方法をとる推論
過程の高速化方式を提供することに敷る。
The purpose of the present invention was to solve the above problem, and in an inference process that has a large amount of inference knowledge and current state knowledge, matching of the inference rules and current state knowledge depends on the number of inference rules and the number of current state knowledge. The purpose of this invention is to provide a method for speeding up the inference process that uses a non-intrusive inference method.

〔発明の概要〕[Summary of the invention]

上記目的を達成するため、本発明は、次の一般的事項に
着目する。
In order to achieve the above object, the present invention focuses on the following general points.

(1)推論ルールは、その前提部に複数個の条件をもち
、全ての条件が満された時、その推論ルールの前提が満
足される。
(1) An inference rule has a plurality of conditions in its premise, and when all the conditions are met, the premise of the inference rule is satisfied.

(2)各推論ルールは、互いに独立でおるが、各推論ル
ールの条件は必ずしも排反ではなく、各推論ルールの条
件のうちのいくつかは他の推論ルールの条件と等しい。
(2) Each inference rule is independent of each other, but the conditions of each inference rule are not necessarily mutually exclusive, and some of the conditions of each inference rule are equal to the conditions of other inference rules.

この2つの事項から、各現況知識がどの条件に一致する
かを保持すれば、各推論ルールの前提部と現況知識の照
合に際して、しらみつぶし的一致性判定をしなくてよい
From these two points, if it is maintained which condition each current state knowledge matches, there is no need to perform an exhaustive consistency determination when comparing the premise of each inference rule with the current state knowledge.

上記の考察の下に、本発明は、次の推論方法を特徴とす
るものである。
Based on the above consideration, the present invention is characterized by the following inference method.

(1)推論ルールの前提部の各条件を本構造の形で蓄え
る。この木の節ノードは、条件内の各要素(条件は要素
列から成る)の一致性判定を行う手順であシ、最下端の
葉ノードには、この葉ノードに達する経路上の節ノード
列に対応する各条件が員する推論ルールの名が記されて
いる。
(1) Store each condition of the premise of the inference rule in the form of this structure. The node node of this tree is a procedure for determining the consistency of each element in the condition (the condition consists of a string of elements), and the lowest leaf node contains a string of node nodes on the route that reaches this leaf node. The name of the inference rule that each condition corresponding to is a member of is written.

(2)各現況知識は、それが生成された時点で、この木
構造の各節ノードの一致性判定により、この現況知識が
推論ルールの条件のいずれに一致するかが決められる。
(2) When each piece of current state knowledge is generated, it is determined which of the conditions of the inference rule this current state knowledge matches by checking the consistency of each node of this tree structure.

(3)各現況知識は、それが一致した推論ルール及び条
件に対応するスタックに格納される。
(3) Each piece of current state knowledge is stored in a stack corresponding to the inference rule and condition with which it is matched.

〔発明の実施例〕[Embodiments of the invention]

以下、本発明の一笑施例を、図面(第1図〜第15図)
を用いて詳細に説明する。ここで、実施例の説明に先立
ち、プロダクションシステムの一般的用語に従い、下記
の様な言いかえを行う。
Hereinafter, the drawings (Fig. 1 to Fig. 15) will show a simple embodiment of the present invention.
This will be explained in detail using . Here, prior to explaining the embodiment, the following paraphrases will be made in accordance with the general terminology of production systems.

ルール:推論ルール。Rule: Inference rule.

ワーキングメモIJ 1%L素(又は単に要素):現況
知識。
Working Memo IJ 1%L element (or simply element): Current knowledge.

インタプリタ:推論機構。Interpreter: Reasoning mechanism.

マツチング:照合又は−散性判定。Matching: Matching or dispersion judgment.

発火可能:推論ルールの前提が満たされること。Fireable: The premise of the inference rule is satisfied.

また、本実施例において、ルールの構文形式、ワーキン
グメモリの要素形式、マツチング方式およびいくつかの
ルールが同時に前提を満した時の実行ルールの選択規則
として以下のものを設定する。この設定は、汎用のプロ
ダクションシステムに準拠したものであシ、−膜性を失
うことはない。
In addition, in this embodiment, the following are set as rule syntax formats, working memory element formats, matching methods, and execution rule selection rules when several rules simultaneously satisfy the prerequisites. This setting is compatible with general-purpose production systems and does not result in loss of film quality.

(1) ルールの構文形式 (a) ルールは、次の形のリストである。(1) Rule syntax format (a) A rule is a list of the form:

(p<プロダクション名〉く条件1〉く条件2〉・・・
<条件m>→〈アクションi><アクション2〉・・・
くアクションm>) (b)<プロダクション名〉は、任意のアトムである。
(p<production name> condition 1> condition 2>...
<Condition m> → <Action i><Action2>...
Action m>) (b) <Production name> is an arbitrary atom.

(C)<条件i〉は、任意のリストである。(C) <Condition i> is an arbitrary list.

(d)<アクションJ〉は、システム関数である。(d) <Action J> is a system function.

(e)<条件i><アクションj〉は、変数を含んでよ
い。一つのルール内の同一変数は、同じ値をもたねばな
らない。
(e) <Condition i><Actionj> may include variables. Identical variables within one rule must have the same value.

(2) ワーキングメモリの要素形式 (a) 要素は、次の形のリストである。ワーキングメ
モリは、要素の集合として定義される。
(2) Element format of working memory (a) Elements are lists of the following form. Working memory is defined as a collection of elements.

(く時間タグ〉くパターン〉) (b)〈時間タグ〉は、この要素がワーキングメモリに
付は加えられた順番を表わす数で、要素毎にユニークで
ある。
(time tag>pattern) (b) The <time tag> is a number representing the order in which this element was added to the working memory, and is unique for each element.

(C)<パターン〉ハ、条件と同じ任意のリストである
。但し変数は許されない。
(C) <Pattern> C. Any list that is the same as the condition. However, variables are not allowed.

(3)マツチング方式 ワーキングメモリ内の袂累のくパターン〉と、各ルール
のく条件i〉は、次の時に限シ、マツチングしたとみな
される。
(3) Matching method The overlapping patterns in the working memory and the conditions i for each rule are considered to have been matched only in the following cases.

(a)<条件i〉とくパターン〉が同一形式であり、変
数を除く部分が完全に一致する。
(a) <Condition i> and pattern> have the same format, and the parts excluding variables completely match.

(b)〈条件i〉内の変数が、対応位置にあるくパター
ン〉の定数に束縛され、かつく条件i〉内の同一変数が
同じ値をもつ。
(b) Variables in <condition i> are bound to constants in pattern in corresponding positions, and the same variables in condition i> have the same value.

ルールは、その全ての条件が、上記の意味でワーキング
メモリ内のいずれかの要素のパターンとマツチングし、
かつ、ルール内の全ての同一変数が、同じ値に束縛され
うる時、発火可能となる。
A rule is one in which all its conditions match a pattern of any element in working memory in the above sense,
And when all the same variables in a rule can be bound to the same value, it can fire.

(4)選択規則 ある時点において、複数個のルールが発火可能となった
場合は、次の規則を適用して実行ルールを選択する。
(4) Selection rule If a plurality of rules become capable of firing at a certain point, the following rule is applied to select an execution rule.

規則1:前回実行されたルールが、前回と同じマツチン
グで実行可能であるなら、そのルールは実行しない。こ
の除外規則によシ、発火可能ルールがなくなれば、シス
テムは停止。
Rule 1: If the rule executed last time can be executed with the same matching as last time, that rule is not executed. According to this exclusion rule, if there are no more ignitable rules, the system will stop.

規則2:各ルールの第1番目の条件のうち、最も新しく
ワーキングメモリに付加された要素がマツチするルール
を選択する。第1番目の条件が、同じ要素にマツチする
ルールが複数個ある場合は、第2番目の条件にマツチす
る要素の最新性を比較する。以下、第3番目、第4番目
の条件に関する比較を行う。
Rule 2: Among the first conditions of each rule, select the rule that matches the element most recently added to the working memory. If there are multiple rules in which the first condition matches the same element, the latestness of the element that matches the second condition is compared. A comparison regarding the third and fourth conditions will be made below.

規則3:規則2の適用後なお複数のルールが残つだ場合
は、条件の多いものを選択する。
Rule 3: If multiple rules remain after applying Rule 2, select the one with the most conditions.

規則4:規則3でも絞り切れない場合に、条件部にある
変数でないアトムの数の最大のものを選択する。
Rule 4: If the number cannot be narrowed down even with Rule 3, select the one with the largest number of non-variable atoms in the condition part.

規則5:上記の適用後生き残ったものの中からランダム
に一つ選ぶ。
Rule 5: Choose one at random from those that survive after applying the above.

以上の形式の下で記述された計算機による推論過程を高
速に実行する推論機構即ちインタプリタを考える。
Let us now consider an inference mechanism, that is, an interpreter, which executes at high speed the inference process by a computer described in the above format.

インタプリタが、推論過程を実行する上で必要な情報に
は次のものがある。
The information required by the interpreter to perform the inference process includes the following:

(11各ルールの条件部が、どのワーキングメモリ要素
にマツチしているか。
(11 Which working memory element does the condition part of each rule match?

(2) マツチする要素が被数個あるj場合、そのうち
最新の要素はどれか。
(2) If there are j elements that match, which element is the latest?

(3)全条件部が、変数束縛を含めてマツチするルール
はどれか。
(3) Which rule matches all condition parts including variable binding?

(4)発火可能のルールのうち、選択規則を満たす実行
ルールはどれか。
(4) Among the rules that can be fired, which execution rule satisfies the selection rule?

これらの情報が効率よく得られるようにするために、第
1図に示される様なインタプリク構造とするものである
。第1図において、インタプリタは、機能実行部1.弁
別ネット部29条件スタック部3.ルールスタック部4
及びアクション集合部5から構成される。このうち、ま
ず弁別ネット部29条件スタック部31ルールスタック
部4のそれぞれの役割及び構成について説明する。
In order to obtain this information efficiently, an interpretive structure as shown in FIG. 1 is used. In FIG. 1, the interpreter includes a function execution unit 1. Discrimination net section 29 condition stack section 3. Rule stack part 4
and an action gathering section 5. Of these, the respective roles and configurations of the discrimination net section 29, condition stack section 31, and rule stack section 4 will be explained first.

なお、第1図において、R1+ R2+ ”’+ Rn
はルールの名称を示し、また、ci + C2r・・・
In addition, in FIG. 1, R1+ R2+ ”'+ Rn
indicates the name of the rule, and ci + C2r...
.

Crl1は条件の種類を示す。Crl1 indicates the type of condition.

(1)弁別ネット部 各ルールの条件が、プレコンパイルにより、弁別ネット
の形で保持される。弁別ネットは、認知心理学において
開発されたもので、第2図に示されるような2進判断木
を指し、人間の認識過程を直列的に記述するものである
。これをルール条件マツチングに用いるため、条件を判
定して分岐先を決定する各テストノードから出る枝を2
以上とした多進判断水を考え、各ノードでは、条件リス
トの長さや、各位置にある要素名を判断し、分岐させる
様にする。更に、末端の結論に相当するイメージノード
には、その条件が含まれているルール塩とその条件番号
、およびその条件に含まれる変数リストが含まれる様に
する。従って、あるワーキングメモリ要素を、弁別ネッ
トに通すと、要素の各位置にかかれた値に従って次々に
分岐がおこシ、最終的に、そのワーキングメモリ要素と
合致する条件の含まれるルール塩と、その条件のルール
内番号が得られる。
(1) Discrimination net section The conditions of each rule are maintained in the form of a discrimination net by pre-compilation. Discrimination nets were developed in cognitive psychology, and refer to binary decision trees as shown in Figure 2, which serially describe the human cognitive process. In order to use this for rule condition matching, two branches are created from each test node that judges the condition and determines the branch destination.
Considering the multi-ary decision system described above, each node judges the length of the condition list and the element name at each position, and branches. Further, the image node corresponding to the final conclusion includes the rule salt containing the condition, the condition number, and the variable list included in the condition. Therefore, when a certain working memory element is passed through a discrimination net, branches occur one after another according to the values assigned to each position of the element, and finally, a rule salt containing a condition that matches that working memory element and its You can get the rule number of the condition.

(2)条件スタック部 各ルールの条件毎に、スタックが設けられる。(2) Condition stack section A stack is provided for each rule condition.

スタックの内容は、条件にマツチするワーキングメモリ
の要素(又はそれを指すポインタ)と、その要素に関す
る束縛変数の値(又はそれを指すポインタ)である。ス
タックは、pirst−In/I、ast−Qut 型
で、スタックのトップには、常にその条件にマツチする
最新のワーキングメモリ要素がはいっている。
The contents of the stack are the working memory element that matches the condition (or a pointer to it) and the value of the bound variable (or a pointer to it) for that element. The stack is of the pirst-In/I, ast-Qut type, and the top of the stack always contains the latest working memory element that matches the conditions.

(3)ルールスタック部 各ルール毎にルールスタックが設けられる。ルールスタ
ックは、各時点で、七のルールにマツチする最新のワー
キングメモリ要素の組が保持される。
(3) Rule stack section A rule stack is provided for each rule. At each point in time, the rule stack maintains the most recent set of working memory elements that match the seven rules.

次に、機能実行部1について説明する。機能実行部1は
、次の4つの機能モジュールで構成される。
Next, the function execution unit 1 will be explained. The function execution unit 1 is composed of the following four functional modules.

弁別ネット部2の情報を用いて、生成されたワーキング
メモリ要素とルール条件のマツチングを行い、条件スタ
ック部3内の該当位置に一致情報を薔き込むMatch
ing機能11、条件スタック部3の各ルールスタック
を順次走査し、発火可能のルール群を選択して、その発
火可能となったルールにマツチするワーキングメモリ要
素の組をルールスタックに入れるConflict S
et Qc41eratio1機能12、ルールスタッ
ク部4の各ルールスタックのうち発火可能となっている
ルールのうちから、前述の選択規則によシ最優先とされ
る実行ルールを決定するConflict gesol
utio(1機能13及び選択された実行ルールのアク
ション集合部5を実行するActioH機能14の4つ
の機能モジュールである。この機能モジュールは、第1
図の矢印で示される順に実行され推論が進められる。
Match The generated working memory element and the rule condition are matched using the information of the discrimination net unit 2, and matching information is placed in the corresponding position in the condition stack unit 3.
ing function 11, each rule stack in the condition stack unit 3 is sequentially scanned, a group of rules that can be fired is selected, and a set of working memory elements that match the rule that can be fired is stored in the rule stack.
et Qc41eratio1 function 12, Conflict gesol which determines the execution rule that has the highest priority from among the rules that can be fired among the rule stacks of the rule stack unit 4 according to the aforementioned selection rule.
utio(1 function 13 and an ActioH function 14 that executes the action collection part 5 of the selected execution rule.
The inference is executed in the order indicated by the arrows in the figure.

第3図■、■、0は、インタプリタの動作を、P AD
 (Prot)lem AHal)’sis ])ia
gram )図で表現したものである。第3区間、 Q
3)、 (C)において、単純ボックス(ロ)は、ボッ
クス内に記述されている処理の実行を表現し、二重線付
ボックス(口])は、ボックス内に記述されている条件
が満たされるまで、そのボックスの右につながる処理を
繰シ返す(until〜、 do〜)ことを示す。
Figure 3 ■, ■, 0 shows the operation of the interpreter.
(Prot)lem AHal)'sis])ia
gram) is expressed in a diagram. 3rd section, Q
3) In (C), the simple box (b) represents the execution of the process described in the box, and the double-lined box (x) represents the execution of the process described in the box. Indicates that the process to the right of the box is repeated (until~, do~) until the box is displayed.

更に、波線付ボックス(ロ)は、判断分岐を示し、ボッ
クス内の記述がtrueの時は右上の枝に、5a1se
の時は右下の枝に分岐することを示す。例えば、第3区
間の303のボックスにつながる波線付ボックス(護【
口IR)を例にとると、もしメモリ要素に変数が含まれ
る場合は303のボックスが、変数が含まれない場合は
303の下のボックスがそれぞれ実行される。このPA
D図は従来のフローチャートに代わるもので、以下の説
明はとのPAD図表図表用いて行う。
Furthermore, the box with a wavy line (b) indicates a decision branch, and when the description in the box is true, the upper right branch is set to 5a1se.
indicates branching to the lower right branch. For example, a box with a wavy line (protection [
For example, if the memory element contains a variable, the box 303 is executed, and if the variable is not included, the box below 303 is executed. This P.A.
Diagram D replaces the conventional flowchart, and the following explanation will be made using the same PAD diagram.

(1)システムスタート時、入力されたルール集合をプ
レコンパイルし、弁別ネット部2及びアクション集合部
5を生成する(301)。弁別ネット部2は、各ノード
で多くの分岐判断を行う多進木であり、その具体的構成
の一例は、第4図に示される様なものである。また、こ
の弁別ネット部2・の生成は、第5図のPAD図に示し
た手順でなされる。第4図及び第5図は、後述のく例題
〉で詳細に説明する。
(1) When the system starts, the input rule set is precompiled to generate the discrimination net unit 2 and action set unit 5 (301). The discriminator net section 2 is a multi-ary tree in which many branch decisions are made at each node, and an example of its specific configuration is as shown in FIG. Further, the generation of this discrimination net section 2 is performed in accordance with the procedure shown in the PAD diagram of FIG. FIGS. 4 and 5 will be explained in detail in "Example Problems" below.

(2) ワーキングメモリの初期要素と条件のマツチン
グを行い(302)、条件スタック部3に条件スタック
をセットする(303)。この手続は、後述のアクショ
ン集合部5の実行に記述したものと同じである。以上で
初期設定がおわシ、インタプリタは、以下(3)〜(5
)を実行ルールがなくなるか又はhalt (停止)ア
クションを実行するまで続ける(304)。
(2) Matching the initial element of the working memory and the condition is performed (302), and the condition stack is set in the condition stack unit 3 (303). This procedure is the same as that described in the execution of the action collection section 5, which will be described later. The initial settings are now complete, and the interpreter settings are as follows (3) to (5).
) continues until there are no more execution rules or a halt action is executed (304).

(3)インタプリタは、まず各ルール毎に、その条件ス
タック部3の内容を調べる(305)。
(3) The interpreter first examines the contents of the condition stack section 3 for each rule (305).

(i)条件スタック部30条件スタックのいずれかが空
の場合は、次のルールに行く(306)。
(i) Condition stack unit 30 If any of the condition stacks is empty, go to the next rule (306).

(11)ルールに変数が含まれない場合は、各条件スタ
ックの最上部の要素を、そのルールのマツチング要素組
とし、ルールスタック部4にその組を入れる。ルールに
変数が含まれる場合は、変数束縛条件が満されるまで(
307)、スタック内の変数比較を行う。この時、若い
番号の条件に含まれる変数を固定して比較し、満されな
い時にのみ、その変数を変える。例えば、第1条件と第
4条件に変数<X>が含まれている時、〈X〉の値を第
1条件のスタック最上位の要素のもつ値に束縛し、第4
条件スタック中にその値をもつ要素があるかどうかをし
らべる。変数束縛条件が満された時(307)は、ルー
ルスタック部4にその組を入れ(308)、満されない
時は何もせずに次のルールに行く。これを全てのルール
を調べ終わるまで行う(305)。
(11) If a rule does not include a variable, the top element of each condition stack is used as a matching element set for that rule, and the set is placed in the rule stack section 4. If the rule includes a variable, the variable binding condition is met (
307), performs a variable comparison in the stack. At this time, the variables included in the conditions with the lowest numbers are fixed and compared, and only when the conditions are not satisfied, the variables are changed. For example, when the variable <X> is included in the first and fourth conditions, the value of <X> is bound to the value of the topmost element of the stack in the first condition, and
Checks whether there is an element with that value in the condition stack. When the variable binding conditions are satisfied (307), the set is placed in the rule stack section 4 (308), and when the variable binding conditions are not satisfied, the process goes to the next rule without doing anything. This is repeated until all rules have been examined (305).

(4)ルールスタック部4の各ルールスタックの最上位
の要素の最新性を比較し、最新のものを実行ルールとす
る(309)。同じ場合は、次の要素 ゛を比較する。
(4) Compare the latestness of the topmost element of each rule stack in the rule stack unit 4, and set the latest one as the execution rule (309). If they are the same, compare the next element.

この比較は、一方のスタックが空になるまで続けられ、
その時点で、残シのおるルールが選択される。同時に空
になった時は、選択規則4に従いアトム数の多い方を選
択し、それでも決らない時は、ランダム選択とする。
This comparison continues until one of the stacks is empty,
At that point, the rule with the remaining number is selected. If they become empty at the same time, the one with the larger number of atoms is selected according to selection rule 4, and if it still cannot be decided, random selection is performed.

以上の動作で実行ルールの選択が終了する。但し、これ
では、選択規則1の除外規定が満されないため、別途、
前回実行のルール塩及びマツチング要素組を保存してお
き、(31(i+)の手続きにおいて、当該ルールのマ
ツチング要素選定の際、前回のマツチング要素組が選択
されない様にする(310)また、(31(i+)の手
続きにおいて、各ルールスタック部4の内容を、前回の
ルール実行により条件スタックに変化が生じたもの以外
は、そのまま保持すれば、大幅な選択時間の節約が可能
となる。これは、ルールスタックにフラグを付ける等に
よシ容易に実現できる。
The execution rule selection is completed with the above operations. However, since this does not satisfy the exclusion provisions of Selection Rule 1, separately,
Save the rule salt and matching element set of the previous execution, and make sure that the previous matching element set is not selected when selecting matching elements of the rule in the procedure of (31(i+)) (310). In the procedure of 31(i+), if the contents of each rule stack section 4 are retained as they are, except for those whose condition stacks have changed due to the previous rule execution, it is possible to save a large amount of selection time. This can be easily realized by adding a flag to the rule stack.

(5)選択されたルールを実行する(311)。ルール
のアクション集合部5の実行で、最も多いのは、ワーキ
ングメモリに要素を付は加えるMAKEアクションと輪
素を取シ去るREMOVEアクションであり、しかもこ
の二つのみがワーキングメモリの内容を変化させる(3
12)。ところで、1回のルール実行によシ変化する要
素は、ワーキングメモリの全要素の(通常は)極く一部
であシ、多くの要素は変化しない。従って、変化した要
素のみに関して条件とのマツチングを考えれば良い。
(5) Execute the selected rule (311). The most common executions of the action collection section 5 of the rule are the MAKE action, which adds or removes elements to the working memory, and the REMOVE action, which removes elements, and these are the only two that change the contents of the working memory. (3
12). By the way, the elements that change due to one execution of a rule are (usually) only a small part of all the elements in the working memory, and many elements do not change. Therefore, it is sufficient to consider matching only the changed elements with the conditions.

このため、弁別ネット部2を用いる。弁別ネット部2は
前述のように、各条件のアトムを枝としたネットワーク
で、新しく付は加えられた要素をこの弁別ネット部2を
通すことによシ、付加要素がどのルールの何番目の条件
を満足するかがわかる(313)。例えば、1番目のノ
ードでは、要素ツバターンの第1番目のアトムが調べら
れ、そのアトムに対応する枝の先にあるノードが次の調
査対象となる。そこでは第2番目のアトムが調べられ、
第3査目のアトムに対応するノードが見いたされる。こ
のように次々にノードが調べられ、要素のアトムが全て
つきたときに到達したノードに書かれているルール塩と
その条件番号が、その要 ・累にマツチする。そこで、
そのルール名9条件番号に対応する条件スタック(複数
のマツチがあれば、その全ての条件スタック)にその要
素がブツシュダウンされる(314)。一方、要素削除
の場合は、当該スタックを順に調べ、該当する要素をス
タックからぬきだす。
For this reason, the discrimination net section 2 is used. As mentioned above, the discrimination net section 2 is a network with atoms of each condition as branches, and by passing newly added elements through this discrimination net section 2, it is possible to determine which rule and in which order the added element is placed. It can be seen whether the conditions are satisfied (313). For example, in the first node, the first atom of the element branch is investigated, and the node at the end of the branch corresponding to that atom becomes the next investigation target. There the second atom is examined,
A node corresponding to the third atom is found. In this way, nodes are examined one after another, and when all the atoms of the elements are found, the rule salt written in the node reached and its condition number match the key points. Therefore,
The element is bushed down to the condition stack (if there are multiple matches, all the condition stacks) corresponding to the rule name 9 condition number (314). On the other hand, in the case of element deletion, the relevant stack is examined in order and the relevant element is extracted from the stack.

次に、例題を用いてインタプリタの動作を詳述する。Next, the operation of the interpreter will be explained in detail using an example.

〔例題〕〔example〕

ル − ル (P R1(A) (DE)−−一→(make (B
K) ) )(P FL2 (A) (NP)−一−−
ウ(make (CN) ) )(P R3(A) (
ON) (BK)−mrnatce (ABC)))(
P R4(A)(BK)(aN)−+make (AB
C))(make (B))) (P R5(<X>)(AC<X>)−mwrite 
(ACの))(P 几6 (B) (ACB) (BO
)−ハmake (ACC) )(make (C)) (Bemove 3 ) ) (P R7(<X>) ’(Remove 1)(P 
R8(A<X×Y>)−n(Write (A) )(
haxt) ) ここで、mal(e(・)は、リスト(・)をワーキン
グメモリに伺加する。几em0veNは、そのル−ルの
第N番目の条件に現任マツチしているワーキングメモリ
要素を削除する。Write(・)は1ノスト(・)を
簀さだす。(halt)はシステム関数止させるという
システム関数である。また<X>は、Xという名の変数
を表わす。
Rule (PR1(A) (DE)--1→(make (B
K) ) ) (P FL2 (A) (NP)-1--
c (make (CN) ) ) (PR3(A) (
ON) (BK)-mrnatce (ABC)))(
PR4(A)(BK)(aN)-+make (AB
C)) (make (B))) (PR5(<X>)(AC<X>)-mwrite
(AC's)) (P 几6 (B) (ACB) (BO
)-Hamake (ACC) )(make (C)) (Bemove 3) ) (P R7(<X>) '(Remove 1)(P
R8(A<X×Y>)-n(Write (A) )(
haxt) ) Here, mal(e(・) adds the list (・) to the working memory. 几em0veN adds the working memory element that currently matches the Nth condition of the rule. Delete.Write (.) starts 1 nost (.). (halt) is a system function that stops a system function. Also, <X> represents a variable named X.

例えは、ワーキングメモリの初期状態か、1 (Bob
、2 (DE)、3 (NPJ、4 (A)の時のルー
ル実行順序は下記となる。ここで、1゜2.3.4が時
間タグである。この時は、R2゜R1,R4,R6,R
,5,几7.R8のノーて”、出力は(ACC)(A)
である。
For example, the initial state of working memory or 1 (Bob
, 2 (DE), 3 (NPJ, 4) The rule execution order when (A) is as follows.Here, 1゜2.3.4 is the time tag.At this time, R2゜R1, R4 ,R6,R
, 5, 几7. R8's output is (ACC) (A)
It is.

以下、本例退におけるルールの天性順序を説明する。The natural order of the rules in this case will be explained below.

1ず、この例題におけるルール 2を考える。ルールR,1〜R8の条件のうち、独立な
ものは(A)(DE)(NP)(BK)(CN)(AC
<X>)(<X>)(H)(ACB)(BO)(A<X
><Y>)である。
1. First, consider Rule 2 in this example. Among the conditions of rules R, 1 to R8, the independent ones are (A) (DE) (NP) (BK) (CN) (AC
<X>) (<X>) (H) (ACB) (BO) (A<X
><Y>).

従って、第5図に示した手順に従って、弁別ネット部2
を構成すると、第4図に示すようなものが得られ、各条
件とそれが含まれているルール及びその位置を表わすこ
とができる。
Therefore, according to the procedure shown in FIG.
By configuring , something like the one shown in FIG. 4 is obtained, which can represent each condition, the rule containing it, and its position.

以下、第4図,第5図を参照しながら、弁別ネット部2
の生成について説明する。なお、第5図は、前述したP
AD図表現を用いている。
Hereinafter, with reference to FIGS. 4 and 5, the discrimination net section 2
We will explain the generation of . In addition, FIG. 5 shows the above-mentioned P
AD diagram representation is used.

第5図において、T0Pノードを生成する(501)を
実行すると、第13図に示すテストノードが生成され、
そのノード名としてTOP。
In FIG. 5, when generating a T0P node (501) is executed, the test node shown in FIG. 13 is generated,
TOP as the node name.

分岐数Nとして0がセットされる。この時、第13図の
判断分岐条件、分岐ノードポインタ等は未定義である。
0 is set as the number of branches N. At this time, the judgment branch conditions, branch node pointers, etc. in FIG. 13 are undefined.

次に、(502)でルール集合の全ての条件、即ちルー
ルR1−几8の左辺にある17個の条件が処理されるま
で(503)〜(516)の処理が実行されるように、
制御は(503)にわたされる。(503)では、未処
理の条件のトップであるルール几1の第1条件Aが、第
15図に示す条件比較スタックに要素終了記号(ここで
ハ$)とともにいれられ、袂累終了ポインタ(ここでは
2)がセットされる。(504)では、別途定義される
サーチ位置ポインタがTOPノードを指し、かつ第15
図の比較対象ポインタが条件要素の第1番目を指す様に
、値がセットされる(ここでは、Aでポインタ値は1)
。(505)以降では、比較対象ポインタが、要素終了
ポインタを越えるまで、(50G)〜(516)が実行
される。(506)では、比較対象ポインタの指すスタ
ックの内容Aが要素終了記号$と比較され・この場合A
キ$であるから(507)に分岐する。
Next, in (502), the processes of (503) to (516) are executed until all the conditions of the rule set, that is, the 17 conditions on the left side of rule R1-几8, are processed.
Control is passed to (503). At (503), the first condition A of rule 1, which is the top of the unprocessed conditions, is placed in the condition comparison stack shown in FIG. Here, 2) is set. In (504), the separately defined search position pointer points to the TOP node, and the 15th
The value is set so that the comparison pointer in the diagram points to the first condition element (here, the pointer value is 1 for A).
. After (505), steps (50G) to (516) are executed until the comparison target pointer exceeds the element end pointer. In (506), the content A of the stack pointed to by the comparison target pointer is compared with the element end symbol $; in this case, A
Since it is a key $, the process branches to (507).

(507)は、サーチ位置ポインタの指すTOPノード
に、比較対象Aに関する判断分岐があるか否かを見るも
のであり,この場合は、分岐数0であり、Aに関する判
断分岐はないから(510)に制御が移る。(510)
では、Aに関する第13図のような新ノード(第4図の
N2に相当する)を生成し、(511)でTOPノード
の判断分岐条件1にAを,分岐ノードポインタ1に新ノ
一ドヘのポインタを設定し、同時に分岐数Nを1インク
リメントする。次いで、新ノードをサーチ位置ポインタ
にセットしく512)、次の条件要素$が比較対象とな
る様、比較対象ポインタをインクリメントする。その後
、(506)が再実行され、今反は比較対象が要素終了
記号となるから(514)に分岐する。この時、サーチ
位置はAに関する新ノードである。このノードN2には
、まだイメージノードが生成されていないため、(51
5)で第14図に示した様なイメージノード(漂4図の
14に相当する)を生成し、また給13図で示されるノ
ードN2のイメージノードポインタに、ノードエ4の番
地を書き込む。第14図で示されるイメージノードエ4
の生成は(516)で行われ、ルール塩1に1を、条件
位置1に1をセットし、またルール条件数を1にセット
する。ここまでで、第4図に示されるI4に至る第1条
件の弁別ネットが形成され、ルール1の第1条件の処理
がおわる。
(507) checks whether there is a judgment branch regarding comparison target A in the TOP node pointed to by the search position pointer. In this case, the number of branches is 0, and there is no judgment branch regarding A. ) control is transferred to (510)
Now, create a new node (corresponding to N2 in FIG. 4) for A as shown in FIG. The branch number N is incremented by 1 at the same time. Next, the new node is set in the search position pointer (512), and the comparison target pointer is incremented so that the next condition element $ becomes the comparison target. Thereafter, (506) is re-executed, and since the current comparison target is the element end symbol, the process branches to (514). At this time, the search position is a new node related to A. Since no image node has been generated yet for this node N2, (51
In step 5), an image node as shown in FIG. 14 (corresponding to 14 in FIG. 4) is generated, and the address of node E4 is written in the image node pointer of node N2 shown in FIG. Image node 4 shown in FIG.
is generated in step (516), where 1 is set in rule salt 1, 1 is set in condition position 1, and the number of rule conditions is set to 1. Up to this point, the discrimination net of the first condition leading to I4 shown in FIG. 4 has been formed, and the processing of the first condition of Rule 1 is completed.

制御は再び(503)に移り、ルール1の第2条件(D
E)が第15図に示す条件比較スタックによみこまれ、
まずD次いでEの順に処理される。
Control moves again to (503), where the second condition (D
E) is written into the condition comparison stack shown in FIG.
D is processed first, then E.

Dの処理では(504)、(,505)、(506)。In the process of D, (504), (,505), (506).

(507)の順で処理が進む。(5’07 )ではTO
Pノードの既存判断分岐AとDが比較され、AキDであ
るため、(510)でDに関するノード即ち第4図のN
3が生成さへ第13図で示されるTOPノードの判断分
岐条件2にDが、分岐ノードポインタ2にノードN3の
番地が入れられる。
The process proceeds in the order of (507). (5'07) then TO
The existing judgment branches A and D of the P node are compared, and since A and D, the node related to D, that is, N in FIG.
3 is generated, D is entered into the judgment branch condition 2 of the TOP node shown in FIG. 13, and the address of node N3 is entered into the branch node pointer 2.

その後、(512)、(513)を経て、Eの処理に移
り、同じ((506)、(507)。
After that, the process moves to E through (512) and (513), and the same process ((506) and (507)).

(510)、(511)、(512)、(513)を経
てノードNIOが生成され、更に(506)。
Node NIO is generated through (510), (511), (512), and (513), and further (506).

(514)、(515)、(516)の手順で第4図の
16に相当するイメージノードが生成される。
An image node corresponding to 16 in FIG. 4 is generated by steps (514), (515), and (516).

以上でルール10条件処理は終了し、第4図に示される
工4および工6に至る第1条件の弁別ネット部2が形成
される。
This completes the rule 10 condition processing, and the discrimination net portion 2 of the first condition leading to steps 4 and 6 shown in FIG. 4 is formed.

ルール2以降も同様の処理が行われるが、既存のイメー
ジノードがある場合、即ちルール2の第1条件Aの場合
は、処理手順は(503)。
Similar processing is performed for rule 2 and subsequent rules, but if there is an existing image node, that is, in the case of the first condition A of rule 2, the processing procedure is (503).

(504)、(505)、(506)、(507)。(504), (505), (506), (507).

(508)、(509)、(506)、(514)。(508), (509), (506), (514).

(516)の順で行われ、新ノードを生成することなく
、既存のノードにルール塩、条件位置を書き込むことの
みで終了する。この操作が17個金工の条件について行
われ、第4図のような弁別ネット部2が構成される。
(516), and ends by simply writing the rule salt and condition position to the existing node without creating a new node. This operation is performed under the conditions of 17 metalworks, and the discrimination net section 2 as shown in FIG. 4 is constructed.

次に、初期状態の要素を1つずつ順に、弁別ネット部2
に通す。(BO)を通ずと、T0PノードからN4を経
てN12のノードに達する。従って(BO)i−Jルー
ル6の第3番目の条件であることがわかシ、この(BO
)の時間タグ1が該当する条件スタックに入れられる。
Next, the elements in the initial state are sequentially added to the discrimination net section 2.
Pass it through. (BO), it reaches the node N12 from the T0P node via N4. Therefore, it is clear that the third condition of (BO)i-J rule 6 is satisfied, and this (BO)
) is placed in the appropriate condition stack.

このとき、T0Pノードの判定では<X>もマツチング
候補となシ、XがBに束縛されるが、Oに該当する枝が
ないので無視される。次に(DE)を通すと、N3を経
−1(NIOの)−ドに達し、ルール1の第2条件スタ
ックに時間タグ2がいれられる。以下同様にして、第6
図(/l)に示す様な条件スタック内容となる。
At this time, in the determination of the T0P node, <X> is also not a matching candidate, and X is bound to B, but since there is no branch corresponding to O, it is ignored. Next, when (DE) is passed, N3 is passed to -1 (NIO's) - and time tag 2 is placed in the second condition stack of rule 1. Similarly, the sixth
The condition stack contents will be as shown in the figure (/l).

また、スタック内容が変化したルールのフラグに米が入
れられる(第6図印(ロ))。なおミ第6図において、
(イ)は条件スタック、(ロ)はワーキングメモリ、(
ハ)に)にルールスタックを表わした図であシ、以下第
7図〜第12図も同様である。ここで、(A)は、N1
ノード、N2ノードのいずれにもマツチ7/−I7:、
fckb、ルール1.ルール2.ルール3.ルール4の
各々の第1条件に時間タグ4が条件スタックに入れられ
、ま7’CJm数を含むルール5,7の各々の第1条件
の条件スタックには時間タグ4と共に変数束縛値がかか
れる。
Also, rice is placed in the flag of the rule whose stack contents have changed (mark (b) in Figure 6). In addition, in Figure 6,
(a) is the condition stack, (b) is the working memory, (
(c) and (c) are diagrams showing the rule stack, and the same applies to the following FIGS. 7 to 12. Here, (A) is N1
Matches both node and N2 node 7/-I7:,
fckb, rule 1. Rule 2. Rule 3. A time tag 4 is placed in the condition stack for each first condition of rule 4, and a variable binding value is placed together with time tag 4 in the condition stack of each first condition of rules 5 and 7 that includes the number 7'CJm. .

次に、几1から順にフラグ米のたっているルールの条件
スタックを調べる。R1は、第1条件に第4要素、第2
条件に第2要素がマツチし、変数を含まないので、(4
,2)の組がルールスタック部4の81のルールスタッ
クに入る。R2゜R7も同様で(4,3)(4)がそれ
ぞれのルールスタックに入れられる。しかし他のルール
R3゜)I4.R5,几6は全て、空のスタックをもつ
ので、発火可能でない。このあと、各ルールのフラグ米
は消される。
Next, check the condition stacks of the flagged rules in order starting from 几1. R1 has the fourth element and the second condition in the first condition.
The second element matches the condition and does not include a variable, so (4
, 2) enters the rule stack 81 in the rule stack unit 4. Similarly for R2°R7, (4,3)(4) are placed in each rule stack. However, other rules R3゜)I4. R5 and 6 all have empty stacks and are not capable of firing. After this, the flags for each rule are erased.

さらに、ルールスタック部4の内容が調べられ、第1条
件部の要素はR1,R2,fl7が共に(4)と向じで
あるため、よシ条件の多いR1,R2が候補となり、第
2条件部にマツチする要素の最新のに ルール2(絡2)が実行ルールとされる(第6図(ハ)
、に))。
Furthermore, the contents of the rule stack part 4 are examined, and since the elements of the first condition part R1, R2, and fl7 are all opposite to (4), R1 and R2 with many good conditions become candidates, and the second Rule 2 (contact 2), which is the latest element that matches the conditional part, is set as the execution rule (Figure 6 (c)).
, to)).

ルール几2の実行後、(CN)という要素がワーキング
メモリに付加される。この要素(CN)を弁別ネット部
2に通すと、N6を経てN14のノードに達し、几4.
R3の条件スタックの内容が書き換えられる(第7図(
イ)(ロ))。この時は、几4と第3のみにフラグ米が
つけられるので、インタプリタは、この2つの条件スタ
ックのみを調べる。
After the execution of rule 几2, the element (CN) is added to the working memory. When this element (CN) is passed through the discrimination net section 2, it reaches the node N14 via N6, and the node 4.
The contents of the condition stack of R3 are rewritten (Figure 7 (
b) (b)). At this time, only the fourth and third conditions are flagged, so the interpreter examines only these two condition stacks.

この場合、いずれのルールも空のスタックをもつので実
際は何もせず、次にルールスタック部4を調べる。ルー
ルスタック部4の内容は、前回と変化ないので、R2が
再び選ばれることになるが、これは前回の実行ルールと
同じマツチング要素をもつので除かれ、几2の条件スタ
ックから次に新しい要素組がルールスタック部4に入れ
られる(第7図(ハ))。但しこの場合(4,3)以外
にマツチするものはなく、R2のルールスタックに、ク
リアされる。この時、几2の条件スタックフラグに米が
入れられる。これは、次回にR2のルールスタックを再
セットするために必要な処置である。
In this case, since each rule has an empty stack, nothing is actually done, and the rule stack section 4 is then checked. Since the contents of the rule stack part 4 are unchanged from the last time, R2 will be selected again, but since it has the same matching element as the previous execution rule, it will be removed, and the next new element from the condition stack of 几2 will be selected. The set is put into the rule stack section 4 (FIG. 7(c)). However, in this case, there is no match other than (4, 3), and the rule stack of R2 is cleared. At this time, rice is placed in the condition stack flag of 几2. This is a necessary action to reset the R2 rule stack next time.

そこで再びルールスタック部4が調べられ、几1が実行
ルールとされる(第7図に))。
Then, the rule stack section 4 is checked again, and 几1 is set as the execution rule (see FIG. 7).

几1は(BK)をワーキングメモリに付加するため、R
1,R2,几3.几4および几7が発火可能となシ、几
4が実行ルールとなる(第8図(イ)(ロ)(ハ)に)
)。R4の実行で、付加された(ACB)(B)は、几
5.几6.几7.几8の条件スタックを変化させ、R6
が実行される。これはR6の方が几5よシ条件が多いこ
とによる(第9図(イ)(ロ)(ハ)に))。ルールR
6は(ACC)(C)を付加しくBo)を取シ除くため
、同じ<R5,R,6゜87、几8が変化する。ここで
(C)は、<X>のみとマツチする。ここでR5の条件
スタックは、10.9の要素がそれぞれ第1条件と第2
条件にマツチし、その時の変数<X>がCであること、
丈に8,7の要素も、変数<X>=Hの束縛で発火可能
組となることを示しているが、スタック上位の(10,
9)の組が選ばれる。ルールR6は、(BO)の除去に
より、発火可能ではなくなり、ルールスタック部4の状
態から几5が実行ルールとなる(第10図(イ)(ロ)
(ハ)に))。このルールFL5はwrite動作のみ
を行うので、条件スタック部3、ルールスタック部4に
変化がない(第11図(イ)(ロ)(ハ)に))。その
ため再び(10,9)の要素組をもつR5が実行ルール
とされるが、これは前回と同じのため、几5の条件スタ
ックから(8,7)の組が新しくルールスタック部4に
入る。従って、几7が実行ルールとなシ、(C)が削除
される。
几1 adds (BK) to working memory, so R
1, R2, 几3.几4 and 几7 can be ignited, and 几4 becomes the execution rule (see Figure 8 (a), (b), and (c)).
). By executing R4, the added (ACB) (B) is 5. 6. 7. Change the condition stack of 几8, R6
is executed. This is because R6 has more conditions than R5 (see Figure 9 (a), (b), and (c)). Rule R
6 adds (ACC) (C) and removes Bo), so the same <R5, R, 6°87, and 几8 change. Here, (C) matches only <X>. Here, in the condition stack of R5, the elements of 10.9 are the first condition and the second condition, respectively.
The condition is met and the variable <X> at that time is C,
This shows that elements with lengths of 8 and 7 also become fireable pairs due to the binding of the variable <X>=H, but the elements at the top of the stack (10,
The group 9) is selected. Rule R6 is no longer able to fire due to the removal of (BO), and 几5 becomes the execution rule from the state of the rule stack section 4 (Fig. 10 (a) and (b)).
(c) to)). Since this rule FL5 only performs a write operation, there is no change in the condition stack section 3 and the rule stack section 4 (see (A), (B), and (C) in FIG. 11). Therefore, R5 with the element set (10, 9) is set as the execution rule again, but since this is the same as last time, the set (8, 7) is newly entered in the rule stack section 4 from the condition stack of 几5. . Therefore, since 几7 is not an execution rule, (C) is deleted.

そこで、(第12図(イ)(ロ)Hに))の状態となシ
、R8の実行によシ、(A)を出力して停止する。
Therefore, in the state shown in FIG. 12 (A), (B), and H), by executing R8, (A) is output and the process is stopped.

なお、本実施例ではスタックはli”1rst−In 
/I、ast−Qut 型として説明したが、pirs
t −In/l;”1rst−Qut型等でもよい。
In this embodiment, the stack is li"1rst-In
/I, ast-Qut type, but pirs
t-In/l;"1rst-Qut type or the like may be used.

〔発明の効果〕〔Effect of the invention〕

以上の説明から明らかな様に本発明によれば、次の効果
がある。
As is clear from the above description, the present invention has the following effects.

fl) ルールは、弁別ネットの形で、マツチングが容
易な様に蓄えられておシ、ルール数の増加が、マツチン
グスピードに影響を与えることがない。
fl) Rules are stored in the form of a discriminatory net so that matching is easy, and an increase in the number of rules does not affect matching speed.

(2)各条件とワーキングメモリ要素とのマツチング結
果をスタックの形で蓄えであるため、マツチングは、付
加あるいは削除された要素について行えはよく、ワーキ
ングメモリの要素数と、実行速度は独立となる。
(2) Since the results of matching each condition and working memory element are stored in the form of a stack, matching can be easily performed on added or deleted elements, and the execution speed is independent of the number of working memory elements. .

(3)スタック機能により、最新のマツチング要素が常
に手近にあり、選択規則の適用が容易でおる。
(3) With the stack function, the latest matching elements are always at hand, making it easy to apply selection rules.

(4)ルールスタックの導入により、変化しなかったル
ールに関するマツチングを省略でき、実行速度が更に向
上する。
(4) By introducing a rule stack, matching for rules that have not changed can be omitted, further improving execution speed.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例を示すインタプリタの全体構
成図、第2図は本発明における弁別ネットの一般概念の
説明図、第3図は本発明の−実施例を示すインタプリン
タの機能をPAD図にて表現した説明図、轡4図は本発
明における例題の弁別ネットの説明図、第5図は本発明
における例題の弁別ネットの作成手順をPAD図にて表
現した説明図、第6図〜第12図は本発明における例題
の実行過程におけるスタックの内容変化の説明図であシ
、第6図は初期状態、第7図はルール2実行後、第8図
はルール1実行後、第9図はルール4実行後、第10図
はルール6実行後、第11図はルール5実行後、第12
図は最終状態前のそれぞれのスタック内容を示したもの
、第13図は本発明における例題の弁別ネットのテスト
ノードを示す説明図、第14図は本発明における例題の
弁別ネットのイメージノードを示す説明図、第15図は
本発明における例題の条件処理のための条件比較スタッ
クの概念図である。 1・・・機能実行部、2・・・弁別ネット部、3・・・
条件ヌタツク部、4・・・ルールスタック部、5・・・
アクション集合部、11−MatChing機能、12
−・・(:onflict Set QeHerati
on機能、13・・・CoHf1ict )jesol
ution 機能、14−ActioH¥yt 図 (イ) ′¥J7図 (イ) 第 B 図 (イノ ’4 q m (イジ にジ 呆 lρ 図 (イ) l町什正し 第 11 図 (4) 旧汀旺■は 茅 12 図 (イノ にジ 開門針圧H 第 73 図 〉7 /4 びり 茅 75 図
FIG. 1 is an overall configuration diagram of an interpreter showing an embodiment of the present invention, FIG. 2 is an explanatory diagram of the general concept of a discrimination net in the present invention, and FIG. 3 is a functional diagram of an interpreter showing an embodiment of the present invention. Figure 4 is an explanatory diagram of an example discrimination net in the present invention, and Figure 5 is an explanatory diagram of the creation procedure of an example discrimination net in the present invention, expressed in a PAD diagram. Figures 6 to 12 are explanatory diagrams of changes in the contents of the stack during the execution process of the example problem in the present invention. Figure 6 is the initial state, Figure 7 is after the execution of rule 2, and Figure 8 is after the execution of rule 1. , Figure 9 is after executing rule 4, Figure 10 is after executing rule 6, Figure 11 is after executing rule 5, and Figure 12 is after executing rule 5.
The figure shows the contents of each stack before the final state, Figure 13 is an explanatory diagram showing a test node of an example discrimination net in the present invention, and Figure 14 shows an image node of an example discrimination net in the present invention. The explanatory diagram, FIG. 15, is a conceptual diagram of a condition comparison stack for example condition processing in the present invention. 1...Function execution section, 2...Discrimination net section, 3...
Condition Nutatsu section, 4... Rule stack section, 5...
Action gathering section, 11-MatChing function, 12
-・・(:onflict Set QeHerati
on function, 13...CoHf1ict) jesol
ution Function, 14-ActioH\yt Figure (A) '\J7 Figure (A) Figure B (Ino'4 q m (Ijinijijima lρ Figure (A) l Town Yosho Figure 11 (4) Old 12 Fig. 73 〉7/4 Biri-Kaya Fig. 75

Claims (1)

【特許請求の範囲】 1、前提と結論の対である推論ルールの複数個の集合と
しての推論知識を保持するテーブルと、推論対象の現状
態および前記推論ルールから導かれた結論の複数個の集
合としての現況知識を保持するテーブルとを有し、前記
推論ルールの前様と、前記現況知識との一致性を判別し
、一致した前記推論ルールの結論を前記現況知識テーブ
ルに追加するステップと、追加された該結論と全蟲記推
論ルールの前提を比較し、該前提が追加された該結論と
一致することに応じて、一致した前記推論ルールと該結
論の対応付は情報を格納するステップとをもつことを特
徴とする推論過程の高速化方式。 2、前記推論ルールの前提は、木構造で蓄えられている
ことを特徴とする特許請求の範囲第1項記載の推論過程
の高速化方式。 3、前記対応付は情報を格納するステップは、スタック
を用いることを特徴とする特許請求の範囲第1項または
第2項記載の推論過程の高速化方式。
[Range of patent claims] 1, a table that holds the reasoning knowledge as a set of inference rules as a pair of prerequisites and conclusions, and multiple conclusions derived from the phonematic status and the inference rules. and a table that holds current state knowledge as a set, and determining whether the previous state of the inference rule matches the current state knowledge, and adding the matching conclusion of the inference rule to the current state knowledge table. , compare the added conclusion with the premise of the Zenmushi inference rule, and if the premise matches the added conclusion, store information on the correspondence between the matching inference rule and the conclusion. A method for speeding up the inference process characterized by having steps. 2. The method for accelerating the inference process according to claim 1, wherein the premises of the inference rules are stored in a tree structure. 3. The method for accelerating the inference process according to claim 1 or 2, wherein the step of storing the correspondence information uses a stack.
JP58239760A 1983-12-21 1983-12-21 System for executing inferring process at high speed Pending JPS60134349A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP58239760A JPS60134349A (en) 1983-12-21 1983-12-21 System for executing inferring process at high speed

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP58239760A JPS60134349A (en) 1983-12-21 1983-12-21 System for executing inferring process at high speed

Publications (1)

Publication Number Publication Date
JPS60134349A true JPS60134349A (en) 1985-07-17

Family

ID=17049508

Family Applications (1)

Application Number Title Priority Date Filing Date
JP58239760A Pending JPS60134349A (en) 1983-12-21 1983-12-21 System for executing inferring process at high speed

Country Status (1)

Country Link
JP (1) JPS60134349A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5146537A (en) * 1985-07-12 1992-09-08 Hitachi, Ltd. Method for judging whether conditions are satisfied by using a network having a plurality of nodes representing the conditions
US5179632A (en) * 1987-12-17 1993-01-12 Hitachi, Ltd. Fast method for a bidirectional inference

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5146537A (en) * 1985-07-12 1992-09-08 Hitachi, Ltd. Method for judging whether conditions are satisfied by using a network having a plurality of nodes representing the conditions
US5179632A (en) * 1987-12-17 1993-01-12 Hitachi, Ltd. Fast method for a bidirectional inference

Similar Documents

Publication Publication Date Title
Forgy et al. OPS, A Domain-Independent Production System Language.
US4849905A (en) Method for optimized RETE pattern matching in pattern-directed, rule-based artificial intelligence production systems
Finkbeiner et al. Petri games: Synthesis of distributed systems with causal memory
Brave Evolving recursive programs for tree search
US5027305A (en) Interrogating device for changing the priority of the inference rules
Kowalski et al. Rule-based programming
JPS60134349A (en) System for executing inferring process at high speed
JPH076034A (en) Production-rule filtration mechanism and inference engine for expert system including said mechanism
Hendler Massively-parallel marker-passing in semantic networks
Wang et al. The formal design models of digraph architectures and behaviors
Meseguer Towards 40 years of constraint reasoning
Mousavi et al. Simplification Of Teleo-Reactive sequences
Hemaspaandra et al. Context-free languages can be accepted with absolutely no space overhead
Cohen et al. Object recognition and concept learning with CONFUCIUS
JPH0432927A (en) Fast inference device
Gardner Search: an overview
Hillenbrand Lessons learned from the Theorem Prover WALDMEISTER
Ferreira et al. A Reduced Instruction Set Machine for Knowledge Based Systems
Brumley HYPANT: A Hypergame Analysis Tool
Schmid Iterative macro-operators revisited: Applying program synthesis to learning in planning
Moore et al. Axiomatic data type specifications: a first order theory of linear lists
Lovas et al. 15-122: Principles of Imperative Computation, Summer 2011 Assignment 5: Hash Tables, Heaps, and Puzzle Solvers
Stapp Axiomatic approach to the system of files
Oliveira et al. Design and implementation of a toolbox of modularized C programs to construct, analyze and test network optimization algorithms
JPH03129434A (en) Inference processor