第194章 MatchingEngine
194.1 MatchingEngine的定义
在ICAI系统中,前面的ObjectEngine负责对象计算,StateEngine负责状态计算,RelationEngine负责关系计算,KnowledgeEngine负责知识计算,CapabilityEngine负责能力计算。当系统进入实际认知与执行过程后,还需要解决一个基础问题:
当前对象、属性、状态、能力和方法,是否与当前要求相匹配?
因此,需要建立独立的MatchingEngine(匹配引擎)。
MatchingEngine不是一个简单的字符串比较工具,也不是数据库查询器,而是一个基于对象、属性、状态、条件、能力、方法及规则进行离散判断的计算引擎。
其基本定义为:
MatchingEngine=MatchingCalculation+ConditionEvaluation+ResultClassificationMatchingEngine = MatchingCalculation + ConditionEvaluation + ResultClassification
即:
MatchingEngine = 匹配计算 + 条件判断 + 匹配结果分类
MatchingEngine回答的不是“对象是什么”,而是:
已有对象或认知要素,与当前需求之间是否满足规定的匹配关系。
因此可以建立:
Match(X,R,C)→MMatch(X,R,C)\rightarrow M
其中:
- XX:待匹配对象;
- RR:匹配要求;
- CC:当前上下文条件;
- MM:匹配结果。
匹配结果不是简单的True或False,而应当能够表达完整的匹配状态。
例如:
Matched
Partial
Unmatched
Unknown
Blocked
Conflicted
Expired
Invalid
由此,MatchingEngine成为ICAI中连接“当前事实”和“目标要求”的基础计算层。
194.2 MatchingEngine与其他Engine的关系
MatchingEngine虽然处理匹配,但是它并不替代其他Engine。
不同Engine处理不同问题:
| Engine | 核心问题 |
|---|---|
| ObjectEngine | 对象是什么 |
| StateEngine | 对象现在是什么状态 |
| RelationEngine | 对象之间是什么关系 |
| KnowledgeEngine | 已知事实能够推出什么知识 |
| CapabilityEngine | 对象具有什么能力、能力是否可用 |
| MethodEngine | 哪些方法能够处理当前目标 |
| MatchingEngine | 当前要素是否满足当前要求 |
| DecisionEngine | 多个候选中选择哪一个 |
因此:
Object→State→Relation→KnowledgeObject \rightarrow State \rightarrow Relation \rightarrow Knowledge
提供事实基础;
Capability→MethodCapability \rightarrow Method
提供可执行基础;
而:
MatchingEngineMatchingEngine
负责判断这些基础是否与当前要求相符合。
最终形成:
Requirement→MatchingEngine→Candidate→DecisionEngineRequirement \rightarrow MatchingEngine \rightarrow Candidate \rightarrow DecisionEngine
MatchingEngine负责“匹配”,DecisionEngine负责“选择”。
两者不能混淆。
194.3 MatchingEngine的统一模型
MatchingEngine可以定义为:
ME=(X,R,C,D,M,V,T)ME=(X,R,C,D,M,V,T)
其中:
- XX:待匹配对象;
- RR:匹配要求;
- CC:当前条件;
- DD:离散匹配计算;
- MM:匹配结果;
- VV:验证信息;
- TT:计算时间。
进一步可以将匹配过程表示为:
X+R+C→Dimension Check→Condition Check→Comparison→Classification→MX+R+C \rightarrow Dimension\ Check \rightarrow Condition\ Check \rightarrow Comparison \rightarrow Classification \rightarrow M
即:
待匹配对象 + 要求 + 当前条件 → 匹配维度检查 → 条件检查 → 属性比较 → 结果分类 → 匹配结果。
这里最重要的是,MatchingEngine不能只比较一个字段。
一个对象可能:
- 类型匹配;
- 属性部分匹配;
- 状态不匹配;
- 能力匹配;
- 方法不可执行。
因此必须允许多维匹配结果同时存在。
194.4 匹配维度
ICAI中的匹配不是单一维度判断,而是由多个明确维度组成。
可以建立:
MD={D1,D2,…,Dn}M_D=\{D_1,D_2,…,D_n\}
其中每一个 DiD_i 都代表一个匹配维度。
例如:
Type
Attribute
State
Condition
Range
Capability
Method
Relation
Resource
Time
系统根据当前匹配任务选择实际需要参与计算的维度。
例如,一个能力匹配可能只需要:
Capability Type
Condition
State
Range
Verification
而一个对象匹配可能需要:
Type
Attribute
State
Relation
Range
因此:
MatchingDimensions=f(RequirementType)MatchingDimensions=f(RequirementType)
即匹配维度由当前要求类型决定。
194.5 对象匹配
194.5.1 对象匹配定义
对象匹配是MatchingEngine最基础的匹配类型。
对象模型:
O=(ID,T,A,S,R)O=(ID,T,A,S,R)
其中:
- IDID:对象标识;
- TT:对象类型;
- AA:属性;
- SS:状态;
- RR:关系。
对象匹配要求:
Match(O,Ro,C)→MoMatch(O,R_o,C)\rightarrow M_o
其中 RoR_o 是对象要求。
例如系统需要寻找:
Type = Device
State = Ready
Power = Available
MatchingEngine需要检查候选对象的实际:
Type
Attributes
State
Relations
而不是仅通过对象名称判断。
194.5.2 对象匹配过程
对象匹配可以按照以下流程进行:
加载对象
→ 读取对象类型
→ 读取对象属性
→ 读取对象状态
→ 读取对象关系
→ 加载对象要求
→ 类型匹配
→ 属性匹配
→ 状态匹配
→ 关系匹配
→ 综合判断
→ 输出匹配结果
形式化表示:
O→TypeMatch→AttributeMatch→StateMatch→RelationMatch→ObjectMatchO \rightarrow TypeMatch \rightarrow AttributeMatch \rightarrow StateMatch \rightarrow RelationMatch \rightarrow ObjectMatch
对象匹配并不意味着对象一定可以执行任务。
例如:
对象类型匹配 = 是
对象属性匹配 = 是
对象状态匹配 = 否
最终不能简单得到“匹配”。
因此对象匹配必须保留各维度结果。
194.6 属性匹配
194.6.1 属性匹配定义
对象匹配解决“是不是这个类型的对象”,属性匹配解决:
这个对象的具体特征是否满足要求。
属性模型可以定义为:
A=(N,V,T,S,Tm)A=(N,V,T,S,Tm)
其中:
- NN:属性名称;
- VV:属性值;
- TT:属性类型;
- SS:属性状态;
- TmTm:属性时间。
属性要求可以表示为:
Ra=(N,O,V,C)R_a=(N,O,V,C)
其中:
- NN:属性名称;
- OO:比较运算;
- VV:要求值;
- CC:适用条件。
例如:
temperature <= 30
capacity >= 100
type = electric
status = active
MatchingEngine按照规定的比较运算进行离散计算。
194.6.2 属性比较类型
属性比较不能统一采用“相等”。
根据属性类型,可以定义:
EQ 等于
NE 不等于
GT 大于
GTE 大于等于
LT 小于
LTE 小于等于
IN 属于集合
NOT_IN 不属于集合
BETWEEN 区间
CONTAINS 包含
PREFIX 前缀
EXISTS 存在
NOT_EXISTS不存在
例如:
capacity≥100capacity \geq 100
如果实际值:
capacity=120capacity=120
则:
120≥100120\geq100
得到:
Matched
如果:
capacity=80capacity=80
则得到:
Unmatched
194.7 多属性匹配
真实对象通常具有多个属性,因此需要建立属性集合:
A(O)={a1,a2,…,an}A(O)=\{a_1,a_2,…,a_n\}
要求集合:
R(O)={r1,r2,…,rm}R(O)=\{r_1,r_2,…,r_m\}
MatchingEngine逐项计算:
Match(ai,ri)Match(a_i,r_i)
最终形成:
MA={m1,m2,…,mn}M_A=\{m_1,m_2,…,m_n\}
例如:
Power = Matched
Capacity = Matched
Temperature= Partial
Location = Unmatched
因此最终不能丢失单项结果。
可以进一步定义:
AttributeMatch=MatchedRequiredAttributeMatch= \frac{Matched}{Required}
但是该比例只能作为辅助计算。
对于存在强制条件的属性:
RequiredAttribute=falseRequiredAttribute = false
可能直接导致:
Unmatched
因此:
属性数量相同并不代表匹配程度相同。
194.8 状态匹配
194.8.1 状态匹配定义
对象拥有状态:
S=(O,V,T,C,R)S=(O,V,T,C,R)
但是当前要求通常也包含目标状态。
例如:
Required State = Ready
候选对象当前:
Current State = Active
此时不能简单认为对象不匹配。
系统首先需要判断:
Active → Ready
是否属于合法状态关系。
因此状态匹配必须使用StateEngine提供的状态事实和状态规则。
194.8.2 状态匹配模型
定义:
Match(S,Rs,C)→MsMatch(S,R_s,C)\rightarrow M_s
其中:
- SS:当前状态;
- RsR_s:要求状态;
- CC:当前条件;
- MsM_s:状态匹配结果。
状态匹配结果可以包括:
Matched
Transitionable
Unmatched
Blocked
Unknown
Conflicted
Expired
其中:
Matched:
当前状态已经满足要求。
Transitionable:
当前状态不满足,但是存在合法状态转换路径。
Unmatched:
没有满足要求,也没有合法转换路径。
Blocked:
存在状态转换可能,但当前条件禁止转换。
因此:
CurrentState\neqRequiredStateCurrentState\neqRequiredState
并不必然意味着:
UnmatchedUnmatched
这是ICAI状态认知中的重要区别。
194.9 能力匹配
194.9.1 能力匹配定义
能力模型:
C=(T,Co,S,R,V)C=(T,Co,S,R,V)
其中:
- TT:能力类型;
- CoCo:能力条件;
- SS:能力状态;
- RR:能力范围;
- VV:能力验证。
能力匹配回答:
当前对象拥有的能力,是否满足当前任务要求?
定义:
Match(C,Rc,Ctx)→McMatch(C,R_c,Ctx)\rightarrow M_c
其中:
- CC:实际能力;
- RcR_c:能力要求;
- CtxCtx:当前上下文;
- McM_c:匹配结果。
194.9.2 能力匹配维度
能力匹配至少可以检查:
Capability Type
Condition
State
Range
Verification
Object
Resource
Time
例如要求:
Capability Type = Transport
Range >= 100 km
State = Available
Verification = Verified
候选能力:
Type = Transport
Range = 150 km
State = Available
Verification = Verified
则:
TypeMatch=1TypeMatch=1 RangeMatch=1RangeMatch=1 StateMatch=1StateMatch=1 VerificationMatch=1VerificationMatch=1
最终:
Matched
但是如果范围只有:
50 km
则:
Range = Unmatched
能力整体不能直接判定为完全匹配。
194.10 能力存在与能力匹配的区别
系统必须严格区分:
CapabilityExistsCapabilityExists
与:
CapabilityMatchedCapabilityMatched
能力存在只表示系统记录了某种能力。
能力匹配则要求:
Type∧Condition∧State∧RangeType \land Condition \land State \land Range
同时,在要求验证能力时还需要:
VerificationVerification
因此:
CapabilityExists≠CapabilityAvailable≠CapabilityMatched≠CapabilityVerifiedCapabilityExists \neq CapabilityAvailable \neq CapabilityMatched \neq CapabilityVerified
这一区分可以避免系统把“声明拥有能力”错误地当成“当前可以完成任务”。
194.11 方法匹配
194.11.1 方法匹配定义
方法模型:
M=(T,C,P,A,R)M=(T,C,P,A,R)
其中:
- TT:方法类型;
- CC:方法条件;
- PP:过程;
- AA:动作;
- RR:结果。
方法匹配回答:
某个方法是否适合当前目标、对象、状态和能力条件?
定义:
Match(M,Rm,Ctx)→MmMatch(M,R_m,Ctx)\rightarrow M_m
其中:
- MM:候选方法;
- RmR_m:方法要求;
- CtxCtx:当前上下文;
- MmM_m:方法匹配结果。
194.12 方法匹配的核心条件
一个方法能够匹配当前任务,至少需要考虑:
Goal
Object
State
Condition
Capability
Resource
Method Type
Method Range
Method Verification
例如某方法需要:
Capability A
Capability B
State = Ready
Resource X
而当前对象只有:
Capability A
则:
CapabilityMatch=PartialCapabilityMatch=Partial
因此该方法不能直接进入可执行状态。
可以表示为:
MethodMatch=GoalMatch∧ObjectMatch∧StateMatch∧CapabilityMatch∧ConditionMatchMethodMatch= GoalMatch \land ObjectMatch \land StateMatch \land CapabilityMatch \land ConditionMatch
当所有必要条件满足后:
Method = Matched
否则可能为:
Partial
Unmatched
Blocked
Unknown
Conflicted
194.13 MatchingEngine的综合匹配
MatchingEngine最终并不是五个完全独立的模块,而是形成统一匹配体系:
Object→Attribute→State→Capability→MethodObject \rightarrow Attribute \rightarrow State \rightarrow Capability \rightarrow Method
但实际运行时,这些维度可能存在交叉。
例如:
对象
↓
对象类型匹配
↓
属性匹配
↓
当前状态匹配
↓
能力匹配
↓
方法匹配
↓
形成候选集合
↓
DecisionEngine
因此可以建立:
MatchResult=(Om,Am,Sm,Cm,Mm)MatchResult= (O_m,A_m,S_m,C_m,M_m)
其中:
- OmO_m:对象匹配结果;
- AmA_m:属性匹配结果;
- SmS_m:状态匹配结果;
- CmC_m:能力匹配结果;
- MmM_m:方法匹配结果。
194.14 匹配结果不是简单布尔值
传统程序经常采用:
if ($match) {
...
}
但是ICAI的认知过程不能只保留:
true / false
因为系统必须知道为什么匹配、哪里匹配、哪里不匹配。
因此定义:
MatchingResult=Type+Dimensions+Condition+Evidence+Status+Reason+TimeMatchingResult= Type+ Dimensions+ Condition+ Evidence+ Status+ Reason+ Time
例如:
Object: Matched
Attribute: Partial
State: Matched
Capability: Matched
Method: Blocked
最终:
Overall = Blocked
其原因可能是:
Method requires Resource X
Resource X is unavailable
这种结果可以直接提供给DecisionEngine、RiskEngine和ConflictEngine。
194.15 匹配状态分类
MatchingEngine建议使用统一状态集合:
Matched
全部必要条件满足。
Partial
部分条件满足,但仍存在未满足条件。
Unmatched
核心条件不满足。
Unknown
当前事实不足,无法完成可靠判断。
Blocked
匹配本身存在可能,但受到状态、资源、规则或条件限制。
Conflicted
多个事实或规则产生冲突。
Expired
原匹配依据已经超过有效时间。
Invalid
匹配依据经过验证后被证明无效。
因此:
MatchStatus∈{Matched,Partial,Unmatched,Unknown,Blocked,Conflicted,Expired,Invalid}MatchStatus\in \{ Matched, Partial, Unmatched, Unknown, Blocked, Conflicted, Expired, Invalid \}
194.16 匹配与验证
匹配结果本身不一定等于事实验证。
例如系统记录:
Capability = Transport
MatchingEngine可以计算:
Capability Type = Matched
但这并不意味着能力已经被实际验证。
因此:
Matching≠VerificationMatching \neq Verification
MatchingEngine主要负责:
是否符合要求
Verification负责:
该事实是否经过实际证据确认
两者组合:
Match+Verification→ReliableCandidateMatch + Verification \rightarrow ReliableCandidate
这也是ICAI避免错误认知的重要机制。
194.17 MatchingEngine与DecisionEngine
MatchingEngine和DecisionEngine具有明确边界。
MatchingEngine:
Candidates→Filter→MatchCandidates \rightarrow Filter \rightarrow Match
DecisionEngine:
MatchedCandidates→Evaluate→SelectMatchedCandidates \rightarrow Evaluate \rightarrow Select
例如存在三个方法:
Method A = Matched
Method B = Matched
Method C = Unmatched
MatchingEngine输出:
A = Matched
B = Matched
C = Unmatched
它不应该自行决定:
选择A
选择A还是B属于DecisionEngine。
因此:
MatchingEngine≠DecisionEngineMatchingEngine\neq DecisionEngine
匹配是筛选基础,决策是选择过程。
194.18 MatchingEngine与CapabilityEngine
CapabilityEngine负责计算能力本身:
能力是什么
能力当前是什么状态
能力范围是什么
能力是否经过验证
能力发生了什么变化
MatchingEngine负责:
这个能力是否符合当前要求
因此:
CapabilityEngine→CapabilityFacts→MatchingEngine→CapabilityMatchCapabilityEngine \rightarrow CapabilityFacts \rightarrow MatchingEngine \rightarrow CapabilityMatch
例如:
CapabilityEngine得到:
Range = 150
State = Available
Verified = Yes
MatchingEngine得到要求:
Range >= 100
State = Available
Verified = Yes
最终:
Capability = Matched
194.19 MatchingEngine与MethodEngine
MethodEngine负责方法计算:
方法结构
方法条件
方法过程
方法动作
方法结果
MatchingEngine则判断:
当前方法是否适合当前目标
因此:
MethodEngine→MethodFacts→MatchingEngine→MethodMatchMethodEngine \rightarrow MethodFacts \rightarrow MatchingEngine \rightarrow MethodMatch
如果方法匹配:
Matched
才能进入后续:
Candidate Methods
→ DecisionEngine
→ Selected Method
194.20 MatchingEngine与SceneEngine
SceneEngine提供当前场景:
Objects
States
Relations
Environment
Conditions
Time
MatchingEngine使用这些场景事实进行当前匹配。
因此:
SceneEngine→CurrentScene→MatchingEngineSceneEngine \rightarrow CurrentScene \rightarrow MatchingEngine
例如当前场景发生变化:
Object A = Active
Object B = Available
Relation A→B = Connected
Environment = Normal
则MatchingEngine可以重新计算对象、状态、能力和方法匹配。
所以:
Scenet≠Scenet+1Scene_t\neq Scene_{t+1}
可能导致:
Matcht≠Matcht+1Match_t\neq Match_{t+1}
匹配不是永久结果,而是当前条件下的计算结果。
194.21 MatchingEngine的PHP工程结构
MatchingEngine属于Engine层,因此不负责数据库直接操作。
推荐结构:
app/
├── Domain/
│ ├── Object.php
│ ├── Attribute.php
│ ├── State.php
│ ├── Capability.php
│ └── Method.php
│
├── Engine/
│ ├── Engine.php
│ ├── MatchingEngine.php
│ ├── ObjectEngine.php
│ ├── StateEngine.php
│ ├── CapabilityEngine.php
│ └── MethodEngine.php
│
├── Service/
│ └── MatchingService.php
│
└── Repository/
├── ObjectRepository.php
├── CapabilityRepository.php
└── MethodRepository.php
Engine负责计算:
Domain Object
+
Requirement
+
Condition
+
Rule
→
MatchingResult
Service负责组织:
读取数据
→
调用MatchingEngine
→
保存结果
→
返回应用结果
194.22 MatchingEngine核心PHP实现
下面使用兼容PHP 5.6/7.0的基础写法建立核心结构:
<?php
abstract class Engine
{
abstract public function calculate($input);
}
class MatchingEngine extends Engine
{
public function calculate($input)
{
$type = $this->matchObject(
$input['object'],
$input['requirement']
);
$attributes = $this->matchAttributes(
$input['object'],
$input['requirement']
);
$state = $this->matchState(
$input['state'],
$input['requirement']
);
$capability = $this->matchCapability(
$input['capability'],
$input['requirement']
);
$method = $this->matchMethod(
$input['method'],
$input['requirement']
);
return array(
'object' => $type,
'attributes' => $attributes,
'state' => $state,
'capability' => $capability,
'method' => $method
);
}
protected function matchObject($object, $requirement)
{
if (!isset($object['type'])) {
return 'Unknown';
}
if (
isset($requirement['type']) &&
$object['type'] == $requirement['type']
) {
return 'Matched';
}
return 'Unmatched';
}
protected function matchAttributes($object, $requirement)
{
if (!isset($requirement['attributes'])) {
return 'Unknown';
}
if (!isset($object['attributes'])) {
return 'Unmatched';
}
foreach ($requirement['attributes'] as $name => $value) {
if (!isset($object['attributes'][$name])) {
return 'Partial';
}
if ($object['attributes'][$name] != $value) {
return 'Unmatched';
}
}
return 'Matched';
}
protected function matchState($state, $requirement)
{
if (!isset($requirement['state'])) {
return 'Unknown';
}
if ($state == $requirement['state']) {
return 'Matched';
}
return 'Unmatched';
}
protected function matchCapability($capability, $requirement)
{
if (!is_array($capability)) {
return 'Unknown';
}
if (isset($requirement['capability'])) {
if (in_array(
$requirement['capability'],
$capability
)) {
return 'Matched';
}
return 'Unmatched';
}
return 'Unknown';
}
protected function matchMethod($method, $requirement)
{
if (!is_array($method)) {
return 'Unknown';
}
if (
isset($requirement['method']) &&
in_array($requirement['method'], $method)
) {
return 'Matched';
}
return 'Unmatched';
}
}
这里的代码只表达MatchingEngine的核心计算职责。
它不直接:
SELECT SQL
INSERT SQL
UPDATE SQL
也不直接控制完整业务流程。
数据库读取和结果保存应由Repository与Service完成。
194.23 MatchingService与MatchingEngine
工程中可以建立:
Controller
↓
MatchingService
↓
MatchingEngine
↓
EngineResult
↓
Repository
↓
MySQL
MatchingService负责:
接收匹配请求
→
读取对象
→
读取属性
→
读取状态
→
读取能力
→
读取方法
→
建立匹配上下文
→
调用MatchingEngine
→
保存匹配结果
→
返回结果
而MatchingEngine只负责:
计算
因此:
MatchingService=OrchestrationMatchingService=Orchestration MatchingEngine=Matching CalculationMatchingEngine=Matching\ Calculation
194.24 MatchingEngine的数据结构
为了保存可追溯的匹配结果,可以建立:
matching_records
记录一次完整匹配。
id
source_type
source_id
requirement_type
requirement_id
overall_status
reason
created_at
matching_dimensions
保存每一个匹配维度。
id
matching_id
dimension_type
source_value
required_value
status
reason
created_at
例如:
matching_id = 1001
Object → Matched
Attribute → Matched
State → Matched
Capability → Partial
Method → Blocked
这样系统不会只保存:
match = false
而能够保存完整计算过程。
194.25 匹配历史
匹配结果具有时间属性。
因此:
Matcht≠Matcht+1Match_t \neq Match_{t+1}
当对象状态、属性、能力、场景或方法条件发生变化时,原匹配结果可能失效。
例如:
12:00
Capability = Available
Match = Matched
12:30
Capability = Blocked
Match = Unmatched
因此建议保存:
matching_history
用于记录:
原匹配状态
新匹配状态
变化原因
触发事件
时间
相关证据
这使MatchingEngine能够成为完整认知链的一部分。
194.26 匹配变化计算
定义:
ΔM=Compare(Mt,Mt+1)\Delta M= Compare(M_t,M_{t+1})
可以得到:
NoChange
Matched
→ Partial
Partial
→ Matched
Matched
→ Unmatched
Unmatched
→ Matched
Matched
→ Blocked
Blocked
→ Matched
匹配变化本身也是认知事实。
例如:
Mt=MatchedM_t=Matched
而:
Mt+1=UnmatchedM_{t+1}=Unmatched
系统不能仅记录“现在不匹配”,还应该知道:
什么时候变化
为什么变化
哪个维度变化
什么事实导致变化
因此:
MatchChange→Feedback→Memory→Experience→LearningMatchChange \rightarrow Feedback \rightarrow Memory \rightarrow Experience \rightarrow Learning
可以进一步进入ICAI学习闭环。
194.27 MatchingEngine的完整运行流程
完整匹配过程可以表示为:
Requirement
↓
Load Candidate
↓
Load Object
↓
Load Attribute
↓
Load State
↓
Load Capability
↓
Load Method
↓
Load Scene / Context
↓
Dimension Selection
↓
Object Matching
↓
Attribute Matching
↓
State Matching
↓
Capability Matching
↓
Method Matching
↓
Condition Evaluation
↓
Comparison
↓
Classification
↓
Verification Check
↓
Matching Result
↓
DecisionEngine
其核心计算关系:
Requirement+Object+Attribute+State+Capability+Method+ContextRequirement + Object + Attribute + State + Capability + Method + Context ↓\downarrow MatchingEngineMatchingEngine ↓\downarrow MatchingResultMatchingResult ↓\downarrow DecisionEngineDecisionEngine
194.28 MatchingEngine与ICAI完整认知链
至此,ICAI已经形成较完整的“事实→匹配→决策→执行”结构:
Individual→Object→State→Scene→KnowledgeIndividual \rightarrow Object \rightarrow State \rightarrow Scene \rightarrow Knowledge
↓
Capability→MethodCapability \rightarrow Method
↓
Requirement→MatchingEngineRequirement \rightarrow MatchingEngine
↓
Candidate→DecisionEngineCandidate \rightarrow DecisionEngine
↓
Behavior→Action→ExecutionBehavior \rightarrow Action \rightarrow Execution
↓
Result→FeedbackResult \rightarrow Feedback
↓
Memory→Experience→LearningMemory \rightarrow Experience \rightarrow Learning
↓
Knowledge/Capability/Method→MatchingEngineKnowledge/Capability/Method \rightarrow MatchingEngine
由此形成循环:
Matcht→Decisiont→Executiont→Feedbackt→Learningt→Matcht+1Match_t \rightarrow Decision_t \rightarrow Execution_t \rightarrow Feedback_t \rightarrow Learning_t \rightarrow Match_{t+1}
匹配不再是一次性的查询动作,而成为ICAI持续认知计算中的动态节点。
194.29 MatchingEngine的工程边界
MatchingEngine必须保持以下边界。
第一,不负责对象定义。
对象由Object及ObjectEngine表达。
第二,不负责状态管理。
状态由StateEngine和StateService管理。
第三,不负责能力更新。
能力变化由CapabilityEngine与LearningService处理。
第四,不负责方法选择。
MatchingEngine只能筛选和判断,最终选择由DecisionEngine完成。
第五,不负责数据库持久化。
数据持久化由Repository负责。
第六,不负责完整业务流程。
流程协调由Service负责。
因此:
MatchingEngine=MatchMatchingEngine = Match
而不是:
MatchingEngine=Match+Decision+Execution+PersistenceMatchingEngine = Match+Decision+Execution+Persistence
保持这一边界,才能使ICAI系统中的Engine体系长期可扩展。
194.30 MatchingEngine与非生成式认知体系
MatchingEngine完全可以建立在确定性、规则化、离散计算基础上。
其核心机制是:
对象
+
属性
+
状态
+
能力
+
方法
+
要求
+
条件
+
规则
→
比较
→
判断
→
分类
因此它不依赖:
LLM
Transformer
Embedding
Vector Search
Prompt Engineering
Neural Network
LLM API
它的判断依据必须能够追溯到:
实际对象
实际属性
实际状态
实际能力
实际方法
明确要求
明确条件
明确规则
实际证据
因此MatchingEngine的每一个结果都应当能够回答:
为什么匹配?为什么部分匹配?为什么不匹配?为什么被阻塞?
这正是ICAI可解释认知工程的重要基础。
194.31 本章总结
MatchingEngine解决的是ICAI体系中的一个基础问题:
当前已有认知要素是否满足当前要求。
它统一处理:
Object MatchingObject\ Matching Attribute MatchingAttribute\ Matching State MatchingState\ Matching Capability MatchingCapability\ Matching Method MatchingMethod\ Matching
其核心模型为:
ME=(X,R,C,D,M,V,T)ME=(X,R,C,D,M,V,T)
核心计算流程为:
Requirement→Candidate→Dimension Matching→Condition Evaluation→Comparison→Classification→MatchingResultRequirement \rightarrow Candidate \rightarrow Dimension\ Matching \rightarrow Condition\ Evaluation \rightarrow Comparison \rightarrow Classification \rightarrow MatchingResult
最终形成:
Object→Attribute→State→Capability→Method→Matching→DecisionObject \rightarrow Attribute \rightarrow State \rightarrow Capability \rightarrow Method \rightarrow Matching \rightarrow Decision
其中:
Object表达对象;
Attribute表达对象特征;
State表达当前状态;
Capability表达能够做什么;
Method表达如何做;
MatchingEngine判断是否满足当前要求;
DecisionEngine在满足条件的候选中进行选择。
因此,MatchingEngine不是普通的查询模块,而是ICAI从“事实认知”进入“候选筛选”和“决策计算”的关键Engine。
最终形成:
Fact→Matching→Candidate→Decision→Behavior→Execution→Feedback\boxed{ Fact \rightarrow Matching \rightarrow Candidate \rightarrow Decision \rightarrow Behavior \rightarrow Execution \rightarrow Feedback }
这使匹配从简单的数据比较,上升为ICAI统一认知计算体系中的基础判断机制。