第263章 匹配Runtime
第262章建立了认知Runtime,完成了:
Input→Object→State→Relation→Scene→Knowledge→CognitionResultInput \rightarrow Object \rightarrow State \rightarrow Relation \rightarrow Scene \rightarrow Knowledge \rightarrow CognitionResult
认知Runtime解决的是:
当前机器个体认识到了什么?
但是,认知结果产生以后,机器个体还需要进一步判断:
当前有什么需求?需要达到什么目标?当前具有什么能力?在什么条件下可以使用这些能力?
这就进入匹配Runtime。
**匹配Runtime(Matching Runtime)**是机器个体在当前运行环境中,根据当前需求、目标、能力和条件,对候选能力、方法或对象进行结构化匹配计算,并产生匹配结果的运行过程。
本章主要研究五个核心结构:
需求→目标→能力→条件→匹配需求 \rightarrow 目标 \rightarrow 能力 \rightarrow 条件 \rightarrow 匹配
形式化表示为:
MatchingRuntime={Need,Goal,Capability,Condition,Matching}MatchingRuntime= \{ Need, Goal, Capability, Condition, Matching \}
最终形成:
MatchingResultMatchingResult
263.1 匹配Runtime定义
匹配Runtime不是一个新的机器个体,也不是一个新的能力。
它是当前IndividualRuntime中的一个计算上下文。
可以定义:
MR={RuntimeID,Need,Goal,Capability,Condition,Candidate,MatchingResult}MR= \{ RuntimeID, Need, Goal, Capability, Condition, Candidate, MatchingResult \}
其中:
RuntimeID:当前运行实例;Need:当前需求;Goal:当前目标;Capability:当前能力;Condition:匹配条件;Candidate:候选能力或候选对象;MatchingResult:最终匹配结果。
因此:
MatchingRuntime⊂IndividualRuntimeMatchingRuntime\subset IndividualRuntime
同时:
MatchingRuntime≠MatchingEngineMatchingRuntime\neq MatchingEngine
MatchingRuntime负责保存当前匹配计算所需要的数据。
MatchingEngine负责执行匹配计算。
263.2 认知Runtime与匹配Runtime
第262章的认知Runtime:
CognitiveRuntime→CognitionResultCognitiveRuntime \rightarrow CognitionResult
本章进一步:
CognitionResult→Need→Goal→Capability→Condition→MatchingCognitionResult \rightarrow Need \rightarrow Goal \rightarrow Capability \rightarrow Condition \rightarrow Matching
形成:
IndividualRuntime
│
├── CognitiveRuntime
│ ├── Input
│ ├── Object
│ ├── State
│ ├── Relation
│ ├── Scene
│ └── Knowledge
│
└── MatchingRuntime
├── Need
├── Goal
├── Capability
├── Condition
└── MatchingResult
因此:
CognitiveRuntime≠MatchingRuntimeCognitiveRuntime\neq MatchingRuntime
认知Runtime负责形成认知结果。
匹配Runtime负责根据当前需求、目标和条件寻找合适的能力。
263.3 需求
需求是匹配Runtime的起点。
需求表示机器个体当前需要解决的问题、满足的条件或者达到某种状态的必要性。
可以定义:
Need={ID,Individual,Object,Type,Condition,Priority,Status,Time}Need= \{ ID, Individual, Object, Type, Condition, Priority, Status, Time \}
例如:
Need:
ID: Need-001
Object: Device-001
Type: FaultDiagnosis
Condition: Device abnormal
Priority: High
Status: Active
需求不是目标。
Need≠GoalNeed\neq Goal
需求表示:
当前需要解决什么问题。
目标表示:
最终希望达到什么状态。
263.4 需求形成
需求可以来自认知结果。
例如:
CognitionResult=HighTemperatureCognitionResult=HighTemperature
机器个体发现:
Device-001
Temperature = 82℃
Normal <= 70℃
于是形成:
Need=FaultDiagnosisNeed=FaultDiagnosis
即:
当前需求:
确定设备异常原因
因此:
CognitionResult→NeedCognitionResult \rightarrow Need
也可以从状态差异直接产生需求:
Need=F(CurrentState,ExpectedState,Condition)Need= F(CurrentState,ExpectedState,Condition)
263.5 需求状态
需求本身也具有状态。
例如:
Pending
Active
Processing
Satisfied
Cancelled
Expired
Blocked
需求状态变化:
NeedStatet→EventNeedStatet+1NeedState_t \xrightarrow{Event} NeedState_{t+1}
例如:
Pending→Active→Processing→SatisfiedPending \rightarrow Active \rightarrow Processing \rightarrow Satisfied
需求状态不是Runtime状态:
NeedState≠RuntimeStateNeedState\neq RuntimeState
263.6 目标
目标表示机器个体希望通过行为或行动达到的结果状态。
可以定义:
Goal={ID,Type,Object,TargetState,Condition,Priority,Status,Time}Goal= \{ ID, Type, Object, TargetState, Condition, Priority, Status, Time \}
例如:
Goal:
ID: Goal-001
Type: Diagnosis
Object: Device-001
TargetState: FaultIdentified
Priority: High
Status: Active
目标表示:
Statet→StategoalState_t\rightarrow State_{goal}
即:
当前状态:
FaultUnknown
↓
目标状态:
FaultIdentified
263.7 需求与目标关系
需求和目标存在直接关系:
Need→GoalNeed\rightarrow Goal
需求回答:
为什么需要处理?
目标回答:
处理以后要达到什么结果?
例如:
Need:
设备出现异常
↓
Goal:
确定设备故障原因
因此:
Goal=F(Need,Capability,Knowledge,Condition)Goal=F(Need,Capability,Knowledge,Condition)
一个需求可以产生一个或多个目标:
Need→Goal1,Goal2,…,GoalnNeed \rightarrow Goal_1,Goal_2,\ldots,Goal_n
263.8 能力
能力表示机器个体能够完成什么任务。
可以定义:
Capability={ID,IndividualID,Type,Name,Level,State,Condition}Capability= \{ ID, IndividualID, Type, Name, Level, State, Condition \}
例如:
Capability-001
Name: StateDetection
Level: 3
State: Available
Capability-002
Name: FaultDiagnosis
Level: 4
State: Available
能力不是方法:
Capability≠MethodCapability\neq Method
能力表示:
能做什么。
方法表示:
怎么做。
263.9 能力状态
能力是否能够参与匹配,还取决于当前能力状态。
例如:
Available
Busy
Disabled
Failed
Learning
Maintenance
只有符合条件的能力才可以进入有效候选集合。
例如:
CapabilityState=AvailableCapabilityState=Available
才能满足:
StateCondition=AvailableStateCondition=Available
因此:
Capability→CapabilityState→CandidateCapability \rightarrow CapabilityState \rightarrow Candidate
263.10 条件
条件是匹配Runtime中的约束结构。
它决定:
什么样的能力才可以被认为符合当前需求和目标。
可以定义:
Condition={CapabilityType,Level,State,Scene,Need,Goal,Resource,Rule}Condition= \{ CapabilityType, Level, State, Scene, Need, Goal, Resource, Rule \}
例如:
CapabilityType:
FaultDiagnosis
MinimumLevel:
3
RequiredState:
Available
Scene:
Device abnormal
Goal:
FaultIdentified
因此:
Condition=ConstraintCondition = Constraint
条件不是匹配结果。
Condition≠MatchingResultCondition\neq MatchingResult
263.11 硬条件
有些条件必须满足。
例如:
最低能力等级 >= 3
能力状态 = Available
能力类型 = FaultDiagnosis
可以定义:
HardCondition∈{true,false}HardCondition\in\{true,false\}
如果:
HardCondition=falseHardCondition=false
则直接:
MatchingStatus=UnmatchedMatchingStatus=Unmatched
即:
HardCondition=false⇒MatchingResult=UnmatchedHardCondition=false \Rightarrow MatchingResult=Unmatched
263.12 软条件
除了硬条件,还可以存在软条件。
例如:
- 能力等级越高越好;
- 历史成功率越高越好;
- 当前负载越低越好;
- 当前场景适应度越高越好。
可以表示:
SoftScore=∑i=1nwiMiSoftScore= \sum_{i=1}^{n}w_iM_i
其中:
- MiM_i:第 ii 个匹配维度;
- wiw_i:该维度权重;
- nn:匹配维度数量。
权重满足:
∑i=1nwi=1\sum_{i=1}^{n}w_i=1
263.13 多维匹配
匹配可以使用多个维度。
例如:
M={Mt,Ms,Mn,Mg,Mr}M= \{ M_t, M_s, M_n, M_g, M_r \}
其中:
- MtM_t:类型匹配;
- MsM_s:状态匹配;
- MnM_n:需求匹配;
- MgM_g:目标匹配;
- MrM_r:规则匹配。
最终:
MatchScore=wtMt+wsMs+wnMn+wgMg+wrMrMatchScore= w_tM_t+ w_sM_s+ w_nM_n+ w_gM_g+ w_rM_r
例如:
Type Match = 1.00
State Match = 1.00
Need Match = 1.00
Goal Match = 0.90
Rule Match = 0.95
经过权重计算得到:
MatchScore∈[0,1]MatchScore\in[0,1]
263.14 匹配候选
匹配不是直接从全部能力中选择一个结果,而是先形成候选集合。
过程:
CapabilitySet→ConditionFilter→CandidateCapabilitiesCapabilitySet \rightarrow ConditionFilter \rightarrow CandidateCapabilities
例如:
全部能力
├── StateDetection
├── FaultDiagnosis
├── Repair
├── Report
└── DataExport
当前需求:
FaultDiagnosis
筛选后:
CandidateCapabilities
└── FaultDiagnosis
因此:
Candidate=Filter(Capability,Condition)Candidate=Filter(Capability,Condition)
263.15 候选能力过滤
第一层过滤可以按照能力类型:
C1=Filter(CapabilityType)C_1= Filter(CapabilityType)
第二层按照状态:
C2=Filter(C1,CapabilityState)C_2= Filter(C_1,CapabilityState)
第三层按照等级:
C3=Filter(C2,Level)C_3= Filter(C_2,Level)
第四层按照场景:
C4=Filter(C3,Scene)C_4= Filter(C_3,Scene)
第五层按照需求和目标:
Candidate=Filter(C4,Need,Goal)Candidate= Filter(C_4,Need,Goal)
形成:
Capability→Type→State→Level→Scene→Need→Goal→CandidateCapability \rightarrow Type \rightarrow State \rightarrow Level \rightarrow Scene \rightarrow Need \rightarrow Goal \rightarrow Candidate
263.16 匹配计算
候选集合建立以后,MatchingEngine开始计算。
基本公式:
Matching=F(Need,Goal,Capability,Condition)Matching= F( Need, Goal, Capability, Condition )
如果加入场景:
Matching=F(Need,Goal,Capability,Condition,Scene)Matching= F( Need, Goal, Capability, Condition, Scene )
如果加入知识和历史经验:
Matching=F(Need,Goal,Capability,Condition,Scene,Knowledge,Experience)Matching= F( Need, Goal, Capability, Condition, Scene, Knowledge, Experience )
263.17 匹配结果
匹配计算最终产生:
MatchingResultMatchingResult
可以定义:
MatchingResult={CapabilityID,NeedID,GoalID,Status,Score,Reason,Time}MatchingResult= \{ CapabilityID, NeedID, GoalID, Status, Score, Reason, Time \}
例如:
Capability:
FaultDiagnosis
Need:
FaultDiagnosis
Goal:
FaultIdentified
Status:
Matched
Score:
0.92
Reason:
Capability level and current state satisfy conditions.
263.18 匹配状态
匹配结果可以定义为:
Matched
Partial
Unmatched
Blocked
Expired
其中:
Matched
满足核心条件:
Status=MatchedStatus=Matched
Partial
部分条件满足:
Status=PartialStatus=Partial
Unmatched
核心条件不满足:
Status=UnmatchedStatus=Unmatched
Blocked
存在阻断条件:
Status=BlockedStatus=Blocked
Expired
匹配条件已经失效:
Status=ExpiredStatus=Expired
263.19 匹配与决策
匹配完成以后并不意味着机器个体已经完成决策。
必须保持:
MatchingResult≠DecisionMatchingResult\neq Decision
例如:
MatchingResult:
Capability-B matched
Score = 0.92
之后还需要考虑:
- 当前目标;
- 风险;
- 冲突;
- 方法;
- 资源;
- 状态;
- 优先级。
最终:
Decision=F(MatchingResult,Goal,Condition,Risk,Conflict)Decision= F(MatchingResult,Goal,Condition,Risk,Conflict)
因此:
Matching→DecisionMatching \rightarrow Decision
但:
Matching≠DecisionMatching\neq Decision
263.20 匹配Runtime完整流程
匹配Runtime的完整过程可以表示为:
Need
↓
Goal
↓
Capability
↓
Condition
↓
Candidate
↓
Matching
↓
MatchingResult
更完整地表示:
CognitionResult→Need→Goal→Capability→Condition→Candidate→Matching→MatchingResultCognitionResult \rightarrow Need \rightarrow Goal \rightarrow Capability \rightarrow Condition \rightarrow Candidate \rightarrow Matching \rightarrow MatchingResult
263.21 需求、目标、能力的三角关系
匹配Runtime的核心实际上是:
Need↔Goal↔CapabilityNeed \leftrightarrow Goal \leftrightarrow Capability
需求确定问题。
目标确定结果。
能力确定解决问题的可能性。
可以表示:
Need
/ \
/ \
↓ ↓
Goal ←→ Capability
如果:
Need≠GoalNeed\neq Goal
则需要进一步明确目标。
如果:
Goal≠CapabilityGoal\neq Capability
则需要寻找能够支持目标的能力。
因此:
Need+Goal→RequiredCapabilityNeed+Goal \rightarrow RequiredCapability
然后:
RequiredCapability→CandidateCapabilityRequiredCapability \rightarrow CandidateCapability
263.22 需求与能力匹配
最基本的匹配:
Need→CapabilityNeed\rightarrow Capability
例如:
Need:
FaultDiagnosis
Capability A:
StateDetection
Capability B:
FaultDiagnosis
Capability C:
Repair
匹配:
Need(FaultDiagnosis)→CapabilityBNeed(FaultDiagnosis) \rightarrow CapabilityB
因此:
Match(B)=trueMatch(B)=true
而:
Match(A)=falseMatch(A)=false Match(C)=falseMatch(C)=false
263.23 目标与能力匹配
仅满足需求还不够,还必须满足目标。
例如:
Goal:
Identify Fault Cause
能力:
FaultDiagnosis
可以满足目标:
Capability→GoalCapability\rightarrow Goal
但:
ReportGeneration
虽然能够产生报告,却不能直接完成故障识别。
因此:
CapabilityMatch=NeedMatch∧GoalMatchCapabilityMatch= NeedMatch \land GoalMatch
263.24 条件与能力匹配
能力即使类型正确,也可能因为条件不满足而无法使用。
例如:
Capability:
FaultDiagnosis
Level: 2
State: Available
条件:
RequiredLevel >= 3
那么:
LevelMatch=falseLevelMatch=false
最终:
MatchingStatus=UnmatchedMatchingStatus=Unmatched
因此:
CapabilityTypeMatch≠CompleteMatchCapabilityTypeMatch \neq CompleteMatch
必须综合所有条件。
263.25 能力匹配分数
假设:
Mt=1M_t=1 Ms=1M_s=1 Mn=1M_n=1 Mg=0.9M_g=0.9 Mr=0.95M_r=0.95
权重:
wt=0.2w_t=0.2 ws=0.2w_s=0.2 wn=0.2w_n=0.2 wg=0.2w_g=0.2 wr=0.2w_r=0.2
那么:
MatchScore=0.2(1)+0.2(1)+0.2(1)+0.2(0.9)+0.2(0.95)MatchScore = 0.2(1) + 0.2(1) + 0.2(1) + 0.2(0.9) + 0.2(0.95)
得到:
MatchScore=0.97MatchScore=0.97
因此:
Status:
Matched
Score:
0.97
263.26 匹配Runtime与场景
匹配不是脱离场景的。
同一个能力,在不同场景下可能具有不同匹配结果。
例如:
Capability:
Repair
State:
Available
场景A:
Device:
Maintenance
可以:
Match=1Match=1
场景B:
Device:
Running
如果维修动作禁止在Running状态下执行,则:
Match=0Match=0
因此:
Matching=F(Capability,Condition,Scene)Matching= F(Capability,Condition,Scene)
263.27 匹配Runtime与知识
知识可以提供匹配规则。
例如:
Rule:
FaultDiagnosis requires Level >= 3
匹配Runtime读取规则:
Knowledge→MatchingRuleKnowledge \rightarrow MatchingRule
然后:
MatchingRule→MatchingEngineMatchingRule \rightarrow MatchingEngine
因此:
Matching=F(Need,Goal,Capability,Condition,Knowledge)Matching= F(Need,Goal,Capability,Condition,Knowledge)
但:
Knowledge≠MatchingKnowledge\neq Matching
知识提供规则,MatchingEngine执行计算。
263.28 匹配Runtime与经验
历史经验可以参与候选能力评价。
例如:
Method-A
SuccessRate = 0.60
Method-B
SuccessRate = 0.90
在能力相同的情况下:
Experience(MethodB)>Experience(MethodA)Experience(MethodB)>Experience(MethodA)
因此可以提高Method-B的评价。
但需要注意:
Experience≠DecisionExperience\neq Decision
经验只是匹配和后续方法评价的数据来源之一。
263.29 匹配Runtime的工程结构
PHP OOP中可以建立:
class MatchingRuntime
{
protected $need;
protected $goal;
protected $capabilities;
protected $condition;
protected $candidates;
protected $result;
public function setNeed($need)
{
$this->need = $need;
}
public function setGoal($goal)
{
$this->goal = $goal;
}
public function setCapabilities($capabilities)
{
$this->capabilities = $capabilities;
}
public function setCondition($condition)
{
$this->condition = $condition;
}
public function setCandidates($candidates)
{
$this->candidates = $candidates;
}
public function setResult($result)
{
$this->result = $result;
}
public function isReady()
{
return $this->need !== null
&& $this->goal !== null
&& $this->capabilities !== null
&& $this->condition !== null;
}
}
该对象负责保存一次匹配计算的上下文。
263.30 MatchingEngine
MatchingEngine负责实际计算。
基本形式:
MatchingEngine=F(Need,Goal,Capability,Condition)MatchingEngine= F(Need,Goal,Capability,Condition)
例如:
class MatchingEngine
{
public function match($runtime)
{
$candidates = array();
foreach ($runtime->getCapabilities() as $capability) {
if ($capability['type'] !== $runtime->getNeed()['type']) {
continue;
}
if ($capability['state'] !== 'Available') {
continue;
}
if ($capability['level'] < $runtime->getCondition()['min_level']) {
continue;
}
$candidates[] = $capability;
}
return $candidates;
}
}
这里使用的是:
- 对象;
- 属性;
- 条件;
- 状态;
- 规则;
- 循环;
- 判断;
- 集合筛选。
不需要生成式模型机制。
263.31 MatchingService
Service负责组织匹配过程:
MatchingService→MatchingRuntime→MatchingEngineMatchingService \rightarrow MatchingRuntime \rightarrow MatchingEngine
例如:
class MatchingService
{
protected $engine;
public function __construct($engine)
{
$this->engine = $engine;
}
public function execute($runtime)
{
return $this->engine->match($runtime);
}
}
Service不负责具体匹配算法。
Engine负责具体计算。
因此:
Service≠EngineService\neq Engine
263.32 MatchingController
Controller负责接收请求。
完整结构:
Browser→MatchingController→MatchingService→MatchingEngineBrowser \rightarrow MatchingController \rightarrow MatchingService \rightarrow MatchingEngine
例如:
class MatchingController
{
protected $service;
public function __construct($service)
{
$this->service = $service;
}
public function execute($runtime)
{
return $this->service->execute($runtime);
}
}
Controller不保存匹配业务状态。
263.33 Repository与匹配Runtime
匹配所需要的需求、目标和能力可能来自数据库:
MySQL
│
├── needs
├── goals
├── capabilities
├── conditions
└── knowledge
读取过程:
MySQL→Repository→DomainObject→MatchingRuntimeMySQL \rightarrow Repository \rightarrow DomainObject \rightarrow MatchingRuntime
例如:
NeedRepository
GoalRepository
CapabilityRepository
ConditionRepository
分别加载对应Domain Object。
最后:
MatchingRuntime←DomainObjectsMatchingRuntime \leftarrow DomainObjects
263.34 匹配Runtime与MVC
完整工程结构:
Browser→MatchingController→MatchingService→MatchingEngine→MatchingRuntimeBrowser \rightarrow MatchingController \rightarrow MatchingService \rightarrow MatchingEngine \rightarrow MatchingRuntime
如果需要持久化:
MatchingEngine→DomainObject→Repository→MySQLMatchingEngine \rightarrow DomainObject \rightarrow Repository \rightarrow MySQL
返回:
MatchingResult→Service→Controller→ViewData→Smarty→HTMLMatchingResult \rightarrow Service \rightarrow Controller \rightarrow ViewData \rightarrow Smarty \rightarrow HTML
因此:
Browser
↓
Controller
↓
Service
↓
MatchingRuntime
↓
MatchingEngine
↓
MatchingResult
↓
ViewData
↓
Smarty
↓
HTML
263.35 一个完整匹配实例
当前机器个体:
ICAI-001
当前认知结果:
Device-001 abnormal
形成需求:
Need:
FaultDiagnosis
目标:
Goal:
FaultIdentified
当前能力:
Capability-A:
StateDetection
Level: 3
State: Available
Capability-B:
FaultDiagnosis
Level: 4
State: Available
Capability-C:
Repair
Level: 4
State: Maintenance
条件:
Type:
FaultDiagnosis
MinimumLevel:
3
State:
Available
筛选:
Capability−A→TypeMismatchCapability-A \rightarrow TypeMismatch Capability−B→MatchedCapability-B \rightarrow Matched Capability−C→TypeMismatchCapability-C \rightarrow TypeMismatch
最终:
Candidate=Capability−BCandidate=Capability-B
263.36 匹配结果形成
得到:
MatchingResult
Capability:
Capability-B
Need:
FaultDiagnosis
Goal:
FaultIdentified
Status:
Matched
Score:
0.92
Reason:
Type, level, state and goal conditions satisfied.
因此:
MatchingResult=MatchedMatchingResult=Matched
然后进入:
MatchingResult→MethodSelectionMatchingResult \rightarrow MethodSelection
进一步:
Method→DecisionMethod \rightarrow Decision
263.37 匹配失败
如果没有能力满足条件:
Candidate:
Empty
则:
MatchingStatus=UnmatchedMatchingStatus=Unmatched
不能直接假设存在能力。
正确流程:
Matching→NoCandidate→UnmatchedMatching \rightarrow NoCandidate \rightarrow Unmatched
然后可以产生新的需求:
CapabilityMissing→NeedCapabilityMissing \rightarrow Need
也可以进入:
CapabilityMissing→LearningCapabilityMissing \rightarrow Learning
或者:
CapabilityMissing→MaintenanceCapabilityMissing \rightarrow Maintenance
因此:
CapabilityMissing≠SystemFailureCapabilityMissing\neq SystemFailure
263.38 匹配被阻断
如果存在明确阻断条件:
Capability:
FaultDiagnosis
State:
Maintenance
而当前要求:
RequiredState:
Available
则:
StateMatch=falseStateMatch=false
最终:
MatchingStatus=BlockedMatchingStatus=Blocked
这与:
UnmatchedUnmatched
有所区别。
Unmatched表示没有符合条件的候选。
Blocked表示候选能力存在,但当前受到条件阻断。
263.39 匹配与风险
匹配结果还可以交给风险计算。
例如:
MatchingResult→RiskEvaluationMatchingResult \rightarrow RiskEvaluation
如果能力虽然匹配,但执行风险很高:
RiskScore>ThresholdRiskScore>Threshold
则可以:
Decision→RejectDecision \rightarrow Reject
或者重新进行匹配:
Risk→MatchingRuntimeRisk \rightarrow MatchingRuntime
因此:
Risk→MatchingRisk \rightarrow Matching
也是可能存在的反馈路径。
263.40 匹配与冲突
如果两个能力都满足需求,但目标、状态或规则之间存在冲突:
CapabilityA→MatchedCapability_A \rightarrow Matched CapabilityB→MatchedCapability_B \rightarrow Matched
但:
Conflict(A,B)=trueConflict(A,B)=true
则不能简单选择第一个结果。
需要:
MatchingResult→ConflictDetection→DecisionMatchingResult \rightarrow ConflictDetection \rightarrow Decision
因此:
Matching≠DecisionMatching\neq Decision
263.41 匹配Runtime完整模型
本章可以将匹配Runtime定义为:
MatchingRuntime={Need,Goal,Capability,Condition,Candidate,MatchingResult}\boxed{ MatchingRuntime= \{ Need, Goal, Capability, Condition, Candidate, MatchingResult \} }
核心计算:
MatchingResult=F(Need,Goal,Capability,Condition)\boxed{ MatchingResult= F( Need, Goal, Capability, Condition ) }
如果考虑场景:
MatchingResult=F(Need,Goal,Capability,Condition,Scene)\boxed{ MatchingResult= F( Need, Goal, Capability, Condition, Scene ) }
如果进一步考虑知识和经验:
MatchingResult=F(Need,Goal,Capability,Condition,Scene,Knowledge,Experience)\boxed{ MatchingResult= F( Need, Goal, Capability, Condition, Scene, Knowledge, Experience ) }
263.42 匹配Runtime完整数据流
完整运行过程:
CognitionResult
↓
Need
↓
Goal
↓
Capability
↓
Condition
↓
Candidate
↓
Matching
↓
MatchingResult
↓
Method
↓
Decision
↓
Behavior
对应数学模型:
CognitionResult→Need→GoalCognitionResult \rightarrow Need \rightarrow Goal Need+Goal→RequiredCapabilityNeed+Goal \rightarrow RequiredCapability RequiredCapability+Capability+Condition→CandidateRequiredCapability + Capability + Condition \rightarrow Candidate Candidate→Matching→MatchingResultCandidate \rightarrow Matching \rightarrow MatchingResult
最终:
MatchingResult→Method→DecisionMatchingResult \rightarrow Method \rightarrow Decision
263.43 匹配Runtime与ICAI整体Runtime
截至本章,ICAI Runtime已经形成三个连续层次。
第一层:
IndividualRuntimeIndividualRuntime
负责:
Individual+State+Knowledge+Capability+GoalIndividual+State+Knowledge+Capability+Goal
第二层:
CognitiveRuntimeCognitiveRuntime
负责:
Input+Object+State+Relation+Scene+KnowledgeInput+Object+State+Relation+Scene+Knowledge
第三层:
MatchingRuntimeMatchingRuntime
负责:
Need+Goal+Capability+Condition+MatchingNeed+Goal+Capability+Condition+Matching
三者连接:
IndividualRuntime
↓
CognitiveRuntime
↓
CognitionResult
↓
MatchingRuntime
↓
MatchingResult
然后进入:
Method→Decision→BehaviorMethod \rightarrow Decision \rightarrow Behavior
263.44 三种Runtime的职责边界
必须严格区分:
IndividualRuntime≠CognitiveRuntime≠MatchingRuntimeIndividualRuntime \neq CognitiveRuntime \neq MatchingRuntime
IndividualRuntime
解决:
当前运行的是哪个个体?它有什么状态、知识、能力和目标?
CognitiveRuntime
解决:
当前输入涉及什么对象、状态、关系和场景?根据知识可以形成什么认知结果?
MatchingRuntime
解决:
当前需求和目标,需要什么能力?当前哪些能力符合条件?
因此:
IndividualRuntime
↓
提供运行主体
CognitiveRuntime
↓
形成认知结果
MatchingRuntime
↓
寻找可用能力
263.45 匹配Runtime的核心边界
本章必须保持以下工程边界:
Need≠GoalNeed\neq Goal Goal≠CapabilityGoal\neq Capability Capability≠ConditionCapability\neq Condition Condition≠MatchingCondition\neq Matching Matching≠MatchingResultMatching\neq MatchingResult MatchingResult≠DecisionMatchingResult\neq Decision Capability≠MethodCapability\neq Method MatchingRuntime≠MatchingEngineMatchingRuntime\neq MatchingEngine MatchingRuntime≠RepositoryMatchingRuntime\neq Repository MatchingRuntime≠MySQLMatchingRuntime\neq MySQL
这些边界保证匹配Runtime不会成为一个职责混乱的“大类”。
263.46 本章总结
匹配Runtime是ICAI从认知结果进入能力选择的关键运行结构。
认知Runtime解决:
Input→CognitionResultInput \rightarrow CognitionResult
匹配Runtime解决:
CognitionResult→Need→Goal→Capability→Condition→MatchingResultCognitionResult \rightarrow Need \rightarrow Goal \rightarrow Capability \rightarrow Condition \rightarrow MatchingResult
其核心模型为:
MatchingRuntime={Need,Goal,Capability,Condition,Matching}\boxed{ MatchingRuntime= \{ Need, Goal, Capability, Condition, Matching \} }
核心计算:
Matching=F(Need,Goal,Capability,Condition)\boxed{ Matching= F( Need, Goal, Capability, Condition ) }
最终形成:
MatchingResult→Method→Decision→Behavior\boxed{ MatchingResult \rightarrow Method \rightarrow Decision \rightarrow Behavior }
因此,ICAI的Runtime体系进一步形成:
IndividualRuntime→CognitiveRuntime→MatchingRuntime→DecisionRuntime→BehaviorRuntimeIndividualRuntime \rightarrow CognitiveRuntime \rightarrow MatchingRuntime \rightarrow DecisionRuntime \rightarrow BehaviorRuntime
其中:
- IndividualRuntime负责机器个体进入运行环境;
- CognitiveRuntime负责从输入形成认知;
- MatchingRuntime负责需求、目标、能力和条件之间的匹配;
- 后续DecisionRuntime负责选择;
- BehaviorRuntime负责执行。
最终形成:
Individual→Cognition→Need→Goal→Capability→Condition→Matching→Method→Decision→Behavior→Action→Result\boxed{ Individual \rightarrow Cognition \rightarrow Need \rightarrow Goal \rightarrow Capability \rightarrow Condition \rightarrow Matching \rightarrow Method \rightarrow Decision \rightarrow Behavior \rightarrow Action \rightarrow Result }
这意味着ICAI已经从“机器个体如何运行”进一步进入“机器个体如何根据当前认知结果寻找适合自身的能力”的运行阶段。
整个匹配过程仍然建立在对象、属性、状态、关系、规则、条件、集合、离散计算和PHP OOP工程结构之上,不依赖生成式模型机制。