第99章 方法匹配
99.1 提出背景
第97章建立了方法理论,定义了方法对象、方法条件、方法步骤、方法结果和方法适用范围。
第98章进一步建立了方法形成机制,使机器个体能够通过知识、经验、方法组合、方法修改和方法更新形成新的方法结构。
但是,方法形成以后,并不能直接进入执行。
机器个体在面对一个具体目标时,可能同时拥有多个方法:
Goal→{M1,M2,M3,…,Mn}Goal\rightarrow\{M_1,M_2,M_3,\ldots,M_n\}
这些方法虽然都存在,但可能存在不同情况:
方法A:目标适合,能力不足
方法B:能力满足,当前状态不适合
方法C:状态满足,环境条件不满足
方法D:全部条件满足
因此必须建立一个新的理论:
方法匹配(Method Matching)
方法匹配解决的问题不是“有没有方法”,而是:
当前目标、能力、状态和条件,与某个方法是否相互适合?
因此:
MethodExistence≠MethodApplicability\boxed{ MethodExistence\neq MethodApplicability }
一个方法存在:
M∈MethodSetM\in MethodSet
并不意味着:
Applicable(M)=TrueApplicable(M)=True
只有经过方法匹配以后,才能确定方法是否可以进入后续的方法选择和决策过程。
99.2 方法匹配定义
**方法匹配(Method Matching)**是指机器个体将当前目标、已有能力、当前状态、运行条件与候选方法进行结构化比较和条件判断,以确定候选方法是否适合当前目标和运行环境的过程。
基本模型:
MethodMatch=f(Goal,Capability,State,Condition,Method)\boxed{ MethodMatch= f(Goal,Capability,State,Condition,Method) }
进一步:
Goal+Capability+State+Condition↔Method\boxed{ Goal + Capability + State + Condition \leftrightarrow Method }
方法匹配的核心不是简单比较名称,而是比较:
目标要求
↓
方法目标
↓
能力要求
↓
方法能力
↓
当前状态
↓
方法状态要求
↓
当前条件
↓
方法条件
↓
适用范围
最终形成:
MethodMatchResultMethodMatchResult
99.3 方法匹配与方法选择
方法匹配与方法选择必须严格区分。
方法匹配回答:
这个方法能不能用于当前目标?
方法选择回答:
在多个可用方法中,最终选择哪一个?
因此:
MethodMatching≠MethodSelection\boxed{ MethodMatching\neq MethodSelection }
基本过程:
Goal→MethodMatching→CandidateMethods→MethodSelectionGoal \rightarrow MethodMatching \rightarrow CandidateMethods \rightarrow MethodSelection
例如:
目标
↓
候选方法A
↓
匹配:部分
↓
候选方法B
↓
匹配:完全
↓
候选方法C
↓
匹配:不匹配
↓
形成候选方法集合
↓
方法选择
因此,方法匹配是方法选择的前置条件。
99.4 目标与方法匹配
目标是方法匹配的第一层。
一个方法必须能够服务于当前目标:
Goal↔MethodGoal\leftrightarrow Method
目标可以包含:
Goal={Object,TargetState,Condition,Range,Result}Goal= \{ Object, TargetState, Condition, Range, Result \}
方法可以包含:
Method={Object,Goal,Condition,Capability,Step,Result,Scope}Method= \{ Object, Goal, Condition, Capability, Step, Result, Scope \}
因此需要比较:
Goalrequirement↔MethodstructureGoal_{requirement} \leftrightarrow Method_{structure}
99.5 目标对象与方法对象
首先判断方法作用对象是否符合目标对象。
例如:
目标:
维修设备A
方法:
维修设备
如果该方法适用于设备A:
ObjectG∈ObjectScopeMObject_G\in ObjectScope_M
则:
ObjectMatch=TrueObjectMatch=True
如果:
目标对象:车辆
方法对象:建筑物
则:
ObjectMatch=FalseObjectMatch=False
因此:
GoalObject↔MethodObject\boxed{ GoalObject\leftrightarrow MethodObject }
是方法匹配的基础。
99.6 目标状态与方法结果
目标通常规定一个希望达到的目标状态。
例如:
Scurrent=StoppedS_{current}=Stopped
目标:
Starget=RunningS_{target}=Running
方法:
M=StartM=Start
如果方法能够将:
Stopped→RunningStopped\rightarrow Running
则:
Result(M)≈TargetStateResult(M)\approx TargetState
方法与目标匹配。
因此:
MethodResult↔GoalTargetState\boxed{ MethodResult\leftrightarrow GoalTargetState }
这是方法匹配的重要判断。
99.7 目标条件与方法条件
目标本身存在执行条件:
ConditionGCondition_G
方法也存在适用条件:
ConditionMCondition_M
因此:
ConditionG↔ConditionMCondition_G\leftrightarrow Condition_M
如果目标要求:
必须在设备正常状态下执行
而方法要求:
设备正常
则条件匹配。
如果目标允许:
设备温度低于50℃
而方法要求:
设备温度低于30℃
则可能形成部分匹配或者条件限制。
因此:
ConditionMatch=f(ConditionG,ConditionM)ConditionMatch= f(Condition_G,Condition_M)
99.8 目标与方法的完整匹配
目标与方法可以建立:
GM=f(ObjectMatch,TargetMatch,ConditionMatch,ResultMatch,ScopeMatch)GM= f( ObjectMatch, TargetMatch, ConditionMatch, ResultMatch, ScopeMatch )
即:
GoalMethodMatch=Object+Target+Condition+Result+Scope\boxed{ GoalMethodMatch= Object+ Target+ Condition+ Result+ Scope }
如果关键条件全部满足:
GM=FullGM=Full
如果只有部分要求满足:
GM=PartialGM=Partial
如果关键要求无法满足:
GM=NoneGM=None
99.9 能力与方法匹配
方法不是独立执行的。
方法必须依赖机器个体已有能力:
Method→CapabilityMethod\rightarrow Capability
因此需要判断:
Capabilityavailable↔CapabilityrequiredCapability_{available} \leftrightarrow Capability_{required}
方法可以要求:
能力A
能力B
能力C
而机器个体当前拥有:
能力A
能力B
能力C
能力D
如果:
CapabilityRequired⊆CapabilityAvailableCapabilityRequired \subseteq CapabilityAvailable
则能力层面完全匹配。
99.10 能力不足
如果:
CapabilityRequired⊈CapabilityAvailableCapabilityRequired \not\subseteq CapabilityAvailable
则方法可能不能执行。
例如:
方法:
自动移动到目标位置
需要:
定位能力
方向控制能力
速度控制能力
而当前机器个体只有:
定位能力
则:
CapabilityMatch=PartialCapabilityMatch=Partial
如果缺少的是关键能力:
CriticalCapabilityMissing=TrueCriticalCapabilityMissing=True
则:
MethodMatch=NoneMethodMatch=None
因此:
关键能力缺失→方法不可用\boxed{ 关键能力缺失 \rightarrow 方法不可用 }
99.11 能力状态与方法
能力不仅有“有没有”的问题,还存在当前状态。
例如:
能力存在
↓
能力状态:故障
虽然:
Capability∈CapabilitySetCapability\in CapabilitySet
但是:
CapabilityState=FailedCapabilityState=Failed
则:
MethodAvailable=FalseMethodAvailable=False
因此必须区分:
CapabilityExistenceCapabilityExistence
与:
CapabilityAvailabilityCapabilityAvailability
完整判断:
MethodCapabilityMatch=f(CapabilityType,CapabilityState,CapabilityRange,CapabilityCondition)MethodCapabilityMatch= f( CapabilityType, CapabilityState, CapabilityRange, CapabilityCondition )
99.12 能力范围与方法范围
方法可能要求:
RangeMRange_M
能力具有:
RangeCRange_C
因此:
RangeC↔RangeMRange_C\leftrightarrow Range_M
如果:
RangeM⊆RangeCRange_M\subseteq Range_C
则:
RangeMatch=FullRangeMatch=Full
如果:
RangeM∩RangeC≠∅Range_M\cap Range_C\neq\varnothing
则:
RangeMatch=PartialRangeMatch=Partial
如果:
RangeM∩RangeC=∅Range_M\cap Range_C=\varnothing
则:
RangeMatch=NoneRangeMatch=None
因此:
能力范围是方法匹配的重要约束\boxed{ 能力范围是方法匹配的重要约束 }
99.13 状态与方法匹配
方法通常只能在特定状态下使用。
**状态与方法匹配(State-Method Matching)**是判断当前对象状态是否满足方法执行要求的过程。
基本关系:
Statecurrent↔StaterequiredState_{current} \leftrightarrow State_{required}
例如:
当前状态:设备停止
方法要求:设备停止
则:
StateMatch=TrueStateMatch=True
如果:
当前状态:设备故障
方法要求:设备正常
则:
StateMatch=FalseStateMatch=False
99.14 状态转换与方法
方法通常不仅要求当前状态,还会规定状态变化。
例如:
S0→MS1S_0\xrightarrow{M}S_1
其中:
- S0S_0:方法执行前状态;
- MM:方法;
- S1S_1:方法执行后的预期状态。
例如:
Stopped→StartRunningStopped\xrightarrow{Start}Running
如果当前:
CurrentState=StoppedCurrentState=Stopped
则方法适用。
如果当前:
CurrentState=FaultCurrentState=Fault
则:
StartStart
可能不适用。
因此:
StateBefore→Method→StateAfter\boxed{ StateBefore \rightarrow Method \rightarrow StateAfter }
是方法匹配的重要模型。
99.15 状态条件变化
方法匹配不是一次永久判断。
运行过程中:
Statet→Statet+1State_t\rightarrow State_{t+1}
如果状态发生变化:
StateChange→ReMatchingStateChange\rightarrow ReMatching
例如:
方法执行前
设备正常
↓
开始执行
↓
设备异常
↓
原方法条件失效
↓
方法重新匹配
因此:
StateChange→MethodRematching\boxed{ StateChange \rightarrow MethodRematching }
99.16 条件与方法匹配
**条件与方法匹配(Condition-Method Matching)**是判断当前运行条件是否满足方法规定条件的过程。
条件可以包括:
对象条件
状态条件
环境条件
时间条件
空间条件
资源条件
能力条件
关系条件
安全条件
规则条件
因此:
ConditionMatch=f(Ccurrent,Cmethod)ConditionMatch= f(C_{current},C_{method})
如果所有关键条件满足:
ConditionMatch=FullConditionMatch=Full
如果部分条件满足:
ConditionMatch=PartialConditionMatch=Partial
如果关键条件不满足:
ConditionMatch=NoneConditionMatch=None
99.17 环境条件与方法
环境可能直接影响方法适用性。
例如:
方法:
室外设备运行
方法条件:
天气正常
温度在规定范围
环境安全
当前环境如果发生变化:
EnvironmentChangeEnvironmentChange
则需要重新判断:
Applicable(M)Applicable(M)
因此:
Environment→Condition→MethodMatchEnvironment \rightarrow Condition \rightarrow MethodMatch
99.18 时间条件与方法
某些方法具有时间范围:
TimeRange(M)=[Tstart,Tend]TimeRange(M)=[T_{start},T_{end}]
当前时间:
TcurrentT_{current}
只有:
Tcurrent∈TimeRange(M)T_{current}\in TimeRange(M)
方法才满足时间条件。
例如:
方法:
夜间维护
适用时间:
22:00—06:00
如果当前时间不在范围内:
TimeMatch=FalseTimeMatch=False
因此:
Time→MethodApplicabilityTime\rightarrow MethodApplicability
99.19 空间条件与方法
方法还可以存在空间范围:
SpaceRange(M)SpaceRange(M)
当前对象位置:
Position(O)Position(O)
如果:
Position(O)∈SpaceRange(M)Position(O)\in SpaceRange(M)
则满足空间条件。
例如:
方法:
仓库内部搬运
适用空间:
仓库区域
如果对象已经离开仓库:
SpaceMatch=FalseSpaceMatch=False
因此:
空间条件也是方法适用性的重要组成部分\boxed{ 空间条件也是方法适用性的重要组成部分 }
99.20 方法适用性
**方法适用性(Method Applicability)**是综合判断一个方法在当前目标、对象、能力、状态、条件和范围下是否可以使用的结果。
定义:
Applicable(M)=f(Goal,Object,Capability,State,Condition,Scope,Rule)\boxed{ Applicable(M)= f( Goal, Object, Capability, State, Condition, Scope, Rule ) }
基本条件:
Applicable(M)=TrueApplicable(M)=True
意味着该方法具备进入候选方法集合的基本条件。
99.21 方法适用性等级
方法适用性可以划分为:
Applicability∈{Full,Partial,None,Blocked,Pending}Applicability\in \{ Full, Partial, None, Blocked, Pending \}
其中:
Full:当前条件完全满足,可以使用。
Partial:部分条件满足,需要补充能力、资源或者调整条件。
None:方法与当前目标结构基本不匹配。
Blocked:方法本身可能适合,但受到安全、规则、资源等条件阻止。
Pending:当前条件尚未确定,需要等待进一步信息。
99.22 方法匹配结果
可以建立统一的方法匹配结果:
MMR={Method,Goal,Capability,State,Condition,Scope,Status,Reason,Priority,Time}MMR= \{ Method, Goal, Capability, State, Condition, Scope, Status, Reason, Priority, Time \}
其中:
Method:候选方法;Goal:目标;Capability:能力匹配结果;State:状态匹配结果;Condition:条件匹配结果;Scope:适用范围;Status:最终匹配状态;Reason:匹配原因;Priority:候选优先级;Time:匹配时间。
99.23 方法匹配状态
可以建立:
MMRStatus={Full,Partial,None,Blocked,Pending}MMRStatus= \{ Full, Partial, None, Blocked, Pending \}
并进一步记录具体原因:
目标不匹配
对象不匹配
能力不足
能力失效
状态不满足
环境不满足
时间不满足
空间不满足
资源不足
安全条件不满足
规则禁止
适用范围超出
因此:
MatchResult→ReasonMatchResult \rightarrow Reason
可以使机器个体不仅知道:
不匹配。
还知道:
为什么不匹配。
99.24 方法匹配优先级
方法匹配之后可能存在多个完全匹配方法:
{M1,M2,M3}\{M_1,M_2,M_3\}
因此需要形成方法候选集合:
CandidateMethods={Mi∣Applicable(Mi)=True}CandidateMethods= \{M_i|Applicable(M_i)=True\}
然后根据:
Priority(Mi)Priority(M_i)
进行后续选择。
可以建立:
Priority(Mi)=f(Goal,Capability,Condition,State,Risk,Cost,Time,Result)Priority(M_i)= f( Goal, Capability, Condition, State, Risk, Cost, Time, Result )
这里的参数是明确的结构化规则,不是神经网络参数。
因此:
MethodMatching→CandidateMethods→MethodSelection\boxed{ MethodMatching \rightarrow CandidateMethods \rightarrow MethodSelection }
99.25 方法重新匹配
方法匹配必须支持动态重新计算。
当发生:
GoalChangeGoalChange CapabilityChangeCapabilityChange StateChangeStateChange ConditionChangeConditionChange EnvironmentChangeEnvironmentChange
时:
Change→ReMatching\boxed{ Change \rightarrow ReMatching }
例如:
原目标
↓
方法A完全匹配
↓
执行过程中
↓
能力A失效
↓
重新匹配
↓
方法A不可用
↓
方法B部分匹配
↓
方法B进入候选集合
这使方法系统能够适应动态环境。
99.26 方法匹配统一模型
综合本章,可以建立:
MM=f(GM,CM,SM,ConditionM,ScopeM)\boxed{ MM= f( GM, CM, SM, ConditionM, ScopeM ) }
其中:
- GMGM:目标与方法匹配;
- CMCM:能力与方法匹配;
- SMSM:状态与方法匹配;
- ConditionMConditionM:条件与方法匹配;
- ScopeMScopeM:方法适用范围匹配。
最终:
Method→GoalMatch+CapabilityMatch+StateMatch+ConditionMatch+ScopeMatch→Applicability\boxed{ Method \rightarrow GoalMatch + CapabilityMatch + StateMatch + ConditionMatch + ScopeMatch \rightarrow Applicability }
99.27 方法匹配工程模型
在 PHP OOP 工程中,可以建立:
CognitiveMethodMatch——方法匹配对象。
class CognitiveMethodMatch
{
protected $id;
protected $goalId;
protected $methodId;
protected $capabilityResult;
protected $stateResult;
protected $conditionResult;
protected $scopeResult;
protected $status;
protected $reason;
protected $priority;
protected $createdAt;
}
方法匹配引擎:
class MethodMatchingEngine
{
public function matchGoal($goal, $method)
{
return null;
}
public function matchCapability($capability, $method)
{
return null;
}
public function matchState($state, $method)
{
return null;
}
public function matchCondition($condition, $method)
{
return null;
}
public function matchScope($method, $object)
{
return null;
}
public function evaluate($matchItems)
{
return null;
}
public function buildResult($evaluation)
{
return null;
}
}
99.28 方法匹配数据库
可以建立:
cognitive_method_matches
id
goal_id
method_id
goal_result
capability_result
state_result
condition_result
scope_result
status
reason
priority
evaluation
created_at
updated_at
方法匹配明细:
cognitive_method_match_items
id
match_id
dimension
source_id
target_id
status
value
reason
created_at
方法匹配历史:
cognitive_method_match_history
id
match_id
old_status
new_status
old_priority
new_priority
change_reason
created_at
这样可以保存:
MethodMatcht→MethodMatcht+1MethodMatch_t \rightarrow MethodMatch_{t+1}
从而支持动态重新匹配。
99.29 方法匹配 Runtime
方法匹配 Runtime 可以形成:
目标
↓
读取候选方法
↓
目标与方法匹配
↓
能力与方法匹配
↓
状态与方法匹配
↓
条件与方法匹配
↓
适用范围检查
↓
规则检查
↓
安全检查
↓
综合评价
↓
形成方法匹配结果
├── 完全匹配
├── 部分匹配
├── 不匹配
├── 阻止
└── 待定
↓
形成候选方法集合
↓
方法优先级计算
↓
进入方法选择
99.30 方法匹配与前面理论的连接
前面的理论形成了完整的输入结构:
对象
↓
属性
↓
状态
↓
关系
↓
场景
↓
知识
↓
需求
↓
目标
↓
能力
↓
匹配
↓
方法
第99章进一步形成:
目标
↓
方法
↓
目标匹配
↓
能力匹配
↓
状态匹配
↓
条件匹配
↓
适用范围
↓
方法匹配结果
因此:
MatchResult→Method→MethodMatching\boxed{ MatchResult \rightarrow Method \rightarrow MethodMatching }
99.31 从方法匹配到方法选择
方法匹配完成以后,机器个体可能得到:
CandidateMethods={M1,M2,M3}CandidateMethods= \{M_1,M_2,M_3\}
例如:
方法A:完全匹配,成本高
方法B:完全匹配,成本低
方法C:部分匹配,风险高
此时还不能简单认为方法A一定执行。
必须进一步进行:
Priority→Evaluation→SelectionPriority \rightarrow Evaluation \rightarrow Selection
因此:
方法匹配解决“能不能用”\boxed{ 方法匹配解决“能不能用” }
而后续方法选择解决:
“用哪个”\boxed{ “用哪个” }
这构成第99章向后续理论的直接连接。
99.32 本章总结
第99章建立了 ICAI 的方法匹配理论。
方法匹配的核心不是判断方法是否存在,而是判断:
当前方法是否适合当前目标和当前机器个体的实际运行条件。
其核心结构为:
目标↔方法\boxed{ 目标 \leftrightarrow 方法 } 能力↔方法\boxed{ 能力 \leftrightarrow 方法 } 状态↔方法\boxed{ 状态 \leftrightarrow 方法 } 条件↔方法\boxed{ 条件 \leftrightarrow 方法 } 范围↔方法\boxed{ 范围 \leftrightarrow 方法 }
最终形成:
Goal+Capability+State+Condition+Scope→MethodMatching→Applicability\boxed{ Goal+ Capability+ State+ Condition+ Scope \rightarrow MethodMatching \rightarrow Applicability }
方法匹配结果可以表示为:
MMR∈{Full,Partial,None,Blocked,Pending}MMR\in \{ Full, Partial, None, Blocked, Pending \}
完整运行过程为:
目标
↓
读取方法集合
↓
目标与方法匹配
↓
能力与方法匹配
↓
状态与方法匹配
↓
条件与方法匹配
↓
适用范围检查
↓
规则检查
↓
安全检查
↓
综合匹配
↓
方法适用性
↓
候选方法集合
↓
方法优先级
↓
方法选择
↓
方法执行
↓
行为
↓
结果
↓
反馈
↓
重新匹配
最终形成:
MethodFormation→MethodMatching→MethodSelection→Behavior→Result\boxed{ MethodFormation \rightarrow MethodMatching \rightarrow MethodSelection \rightarrow Behavior \rightarrow Result }
由此,第97章定义了方法是什么,第98章解决了方法如何形成和变化,第99章则解决了形成的方法如何与当前目标、能力、状态和条件进行匹配。
三章共同构成 ICAI 方法理论的基础:
方法定义→方法形成→方法匹配→方法选择→方法执行\boxed{ 方法定义 \rightarrow 方法形成 \rightarrow 方法匹配 \rightarrow 方法选择 \rightarrow 方法执行 }