第236章 Method Controller|方法控制器
236.1 Method Controller的定义
前面三章已经形成了一个逐渐向下展开的控制结构:
Cognition Controller
↓
Cognitive Controller
↓
Perception Controller
它们分别解决:
如何认知?
下一步做什么?
应该感知什么?
但是当系统已经确定:
- 当前目标是什么
- 当前状态是什么
- 应该感知什么
- 下一步需要执行什么
仍然存在一个问题:
具体采用什么方法完成这个认知动作?
这就是 Method Controller|方法控制器。
Method Controller负责在已有的方法集合中,根据当前对象、目标、状态、条件和约束,选择、组合、切换和终止具体的方法。
因此可以定义:
Method Controller=Control(Method Selection, Execution, Combination, Switching)\boxed{ Method\ Controller = Control(Method\ Selection,\ Execution,\ Combination,\ Switching) }
更简单地说:
Method Controller决定“用什么方法做”。
236.2 Method与Action的区别
这是本章最重要的概念之一。
Action|行动回答:
做什么?
Method|方法回答:
用什么方式做?
例如:
Action:
比较两个产品
但是“比较”本身并没有说明具体方法。
可能采用:
Method A:
属性逐项比较
Method B:
权重评分
Method C:
规则匹配
Method D:
场景适配
Method E:
历史案例比较
所以:
Action≠MethodAction \neq Method
可以表示为:
Action+Method→ExecutionAction + Method \rightarrow Execution
236.3 为什么需要Method Controller
如果一个系统只有固定方法:
Task
↓
Method A
↓
Result
它的能力非常有限。
因为现实中的同一个任务,经常存在多种解决方法。
例如:
“判断产品是否适合某个用户。”
可以:
Specification Matching
也可以:
Rule Matching
也可以:
Scenario Simulation
也可以:
Historical Case Comparison
因此系统需要一个更高层机制:
根据当前条件选择最合适的方法。
这就是 Method Controller。
236.4 Method Controller在认知架构中的位置
本章可以把前面的控制体系进一步向下展开:
Cognition Controller
│
▼
Cognitive Controller
│
▼
Perception Controller
│
▼
Method Controller
│
▼
Method
│
▼
Execution
但是需要注意:
Method Controller并不是简单地位于Perception Controller下面。
更准确的结构是:
Cognition Controller
│
▼
Cognitive Controller
│
┌──────────┼──────────┐
▼ ▼ ▼
Perception Analysis Learning
│
▼
Method Controller
│
┌────────────┼────────────┐
▼ ▼ ▼
Method A Method B Method C
也就是说:
Method Controller通常由具体认知任务触发,而不是所有感知过程都必须经过方法选择。
236.5 Method是什么
在WSaiOS理论中,Method可以定义为:
针对特定对象、目标和状态,用于产生某种认知或行动结果的可执行知识结构。
例如:
Method
├── Input
├── Preconditions
├── Operations
├── Rules
├── Parameters
├── Output
└── Postconditions
因此一个方法不是一句描述。
它包含:
Method=Input+Condition+Operation+OutputMethod = Input + Condition + Operation + Output
例如:
Method: Product Comparison
Input:
Product A
Product B
Precondition:
Both products identified
Operation:
Compare specifications
Output:
Comparison Result
236.6 Method Controller的基本职责
Method Controller至少承担七项职责。
1. Method Selection
选择方法。
2. Method Validation
判断方法是否适用。
3. Method Parameterization
为方法配置参数。
4. Method Composition
组合多个方法。
5. Method Switching
运行过程中切换方法。
6. Method Termination
判断方法什么时候停止。
7. Method Evaluation
评估方法产生的结果。
因此:
MethodController=Select+Validate+Configure+Compose+Switch+Terminate+EvaluateMethodController = Select + Validate + Configure + Compose + Switch + Terminate + Evaluate
236.7 Method Selection|方法选择
最基本的职责是:
从多个候选方法中选择一个。
例如:
Task:
Evaluate Product
Candidate Methods
│
├── Rule Matching
├── Attribute Scoring
├── Scenario Matching
└── Case Comparison
Method Controller根据:
Goal
State
Input
Knowledge
Constraint
Cost
Accuracy
选择:
Scenario Matching
可以表示为:
M∗=argmaxm∈MScore(m∣State,Goal,Input)M^* = argmax_{m\in M} Score(m|State,Goal,Input)
236.8 Method Validation|方法验证
并不是找到一个方法就一定可以使用。
例如:
Method:
Product Comparison
但系统只有一个产品。
那么:
Precondition Failed
Method Controller应该拒绝执行。
因此:
Applicable(M)=Precondition(M,State)Applicable(M)= Precondition(M,State)
只有:
Applicable(M)=TrueApplicable(M)=True
方法才能进入执行阶段。
236.9 Method Parameterization|方法参数化
同一个方法可能服务不同场景。
例如:
Method:
Product Comparison
在不同任务中参数可能不同:
Comparison A:
Price
Comparison B:
Battery
Comparison C:
Child Safety
Comparison D:
Wholesale Value
因此:
Method+Parameters→Specific Method InstanceMethod + Parameters \rightarrow Specific\ Method\ Instance
Method Controller负责配置这些参数。
236.10 Method Composition|方法组合
复杂任务往往不是一个方法可以完成。
例如:
“判断产品是否适合美国市场。”
可能需要:
Identify Product
↓
Retrieve Specification
↓
Market Matching
↓
Requirement Matching
↓
Risk Evaluation
↓
Decision
这里不是一个Method,而是一个:
Method ChainMethod\ Chain
因此:
Method A
↓
Method B
↓
Method C
↓
Method D
Method Controller负责组织这些方法。
236.11 Method Switching|方法切换
认知过程中,原方法可能失效。
例如:
Method A
↓
Insufficient Data
此时不能继续机械执行。
Method Controller可以切换:
Method A
↓
Failure
↓
Method B
↓
Additional Retrieval
↓
Continue
因此:
Methodt→Failure→Methodt+1Method_t \rightarrow Failure \rightarrow Method_{t+1}
方法切换是动态认知的重要能力。
236.12 Method Termination|方法终止
方法并不是一直执行。
例如:
Comparison
↓
All required attributes compared
↓
STOP
或者:
Analysis
↓
Confidence reached
↓
STOP
因此:
Stop(Method)=ConditionSatisfiedStop(Method) = Condition_{Satisfied}
Method Controller负责判断:
方法是否已经完成其任务。
236.13 Method Evaluation|方法评价
同一个任务可能存在多个方法。
系统长期运行以后,需要知道:
哪一种方法更有效?
例如:
Method A
Accuracy = 0.82
Method B
Accuracy = 0.94
Method C
Accuracy = 0.76
于是可以更新:
Method PreferenceMethod\ Preference
形成:
Experience
↓
Method Evaluation
↓
Method Preference Update
↓
Future Method Selection
这就使Method Controller与Learning产生直接联系。
236.14 Method Controller与Knowledge
方法本身可以被视为一种特殊知识。
普通知识:
Product A
Battery = 120 min
方法知识:
How to compare products
因此:
Knowledge=Fact+Relation+Rule+MethodKnowledge = Fact + Relation + Rule + Method
这使WSaiOS中的Knowledge概念进一步扩展。
知识不仅描述:
世界是什么。
也可以描述:
如何处理世界。
236.15 Method Controller与EOM
这与WSaiOS的 EOM|Element–Object–Method 模型具有直接关系。
EOM:
Element→Object→MethodElement \rightarrow Object \rightarrow Method
其中:
Element
描述最基本认知元素。
Object
组织元素形成对象。
Method
描述如何处理对象。
例如:
Element
Battery
Waterproof
Mode
↓
Object
Electric Toothbrush
↓
Method
Product Evaluation
而本章的Method Controller则进一步回答:
当系统拥有多个Method时,应该选择哪一个?
因此:
EOM→MethodEOM \rightarrow Method
而:
Method Controller→Method SelectionMethod\ Controller \rightarrow Method\ Selection
236.16 Method Controller与EOM的进一步关系
可以形成:
Element
│
▼
Object
│
▼
Method Library
│
▼
Method Controller
│
┌───────────┼───────────┐
▼ ▼ ▼
Method A Method B Method C
│ │ │
└───────────┼───────────┘
▼
Result
因此:
EOM定义“对象能够使用什么方法”,Method Controller决定“当前使用哪个方法”。
这是两者的重要区别。
236.17 Method与Rule的区别
方法和规则也不能混淆。
Rule
回答:
如果满足什么条件,那么应该怎样判断。
例如:
IF
IPX7 = true
THEN
Waterproof Capability = High
Method
回答:
采用什么过程获得结果。
例如:
Method:
Waterproof Evaluation
内部可能使用多个规则。
因此:
Rule⊆MethodRule \subseteq Method
但并非所有Method都只是Rule集合。
Method可能包含:
Retrieval
Calculation
Comparison
Iteration
Validation
Decision
236.18 Method与Algorithm的区别
Algorithm是一个非常具体的计算过程。
Method则更加广义。
例如:
Method:
Similarity Evaluation
可以采用:
Algorithm A
Cosine Similarity
Algorithm B
Jaccard Similarity
Algorithm C
Rule Matching
因此:
Method⊇AlgorithmMethod \supseteq Algorithm
Method Controller可以选择具体算法,也可以选择完全不同的方法类型。
236.19 Method Controller与场景
第234章讨论了Scene Commonality。
方法同样具有场景依赖性。
例如:
Scene A:采购
→ Cost Evaluation
Scene B:使用
→ Usability Evaluation
Scene C:推荐
→ Suitability Evaluation
三个场景可能使用同一个基础对象:
Product
但方法不同。
因此:
Method=f(Scene,Goal,Object)Method=f(Scene,Goal,Object)
场景变化:
SceneA→SceneBScene_A \rightarrow Scene_B
方法选择也可能变化:
MethodA→MethodBMethod_A \rightarrow Method_B
236.20 Method Controller与认知深度
第235章提出了 Cognition Depth。
方法控制器是实现认知深度控制的重要机制。
例如:
Low Depth
Direct Lookup
Medium Depth
Attribute Comparison
High Depth
Multi-factor Evaluation
+
Cross-source Verification
+
Scenario Analysis
因此:
Depth→Method SelectionDepth \rightarrow Method\ Selection
认知越复杂,方法链可能越长。
236.21 Method Controller与不确定性
不确定性也会影响方法选择。
例如:
Confidence = High
↓
Direct Retrieval
Confidence = Medium
↓
Comparison
Confidence = Low
↓
Verification
+
Cross-check
因此:
Method=f(Uncertainty)Method = f(Uncertainty)
可以形成:
High Confidence
→ Simple Method
Low Confidence
→ Deep Method
236.22 Method Controller与学习
Method Controller本身也可以被学习。
系统记录:
Task
↓
Method
↓
Result
↓
Feedback
经过长期积累:
Method Performance
形成:
Method A → 失败率高
Method B → 稳定
Method C → 成本高但准确
下一次:
Same Task
↓
Method Controller
↓
Prefer Method B
因此:
Learning→Method Selection ImprovementLearning \rightarrow Method\ Selection\ Improvement
最终形成:
Experience→Method Preference→Better CognitionExperience \rightarrow Method\ Preference \rightarrow Better\ Cognition
236.23 Method Controller与生成器
在内容生成系统中,这个概念尤其重要。
例如目标:
生成产品内容。
可能存在:
Method A
Template Generation
Method B
Knowledge-to-Content
Method C
Scene-based Generation
Method D
Question-based Generation
Generator只是执行生成。
Method Controller负责选择:
Current Goal
↓
Content Type
↓
Scene
↓
Method Selection
↓
Generator
因此:
Method Controller→GeneratorMethod\ Controller \rightarrow Generator
而不是:
Generator=Method ControllerGenerator = Method\ Controller
236.24 Method Controller与多方法认知
真正复杂的认知系统不会只拥有一个方法。
它应该拥有:
Method LibraryMethod\ Library
例如:
Method Library
│
├── Retrieval
├── Matching
├── Classification
├── Comparison
├── Scoring
├── Reasoning
├── Verification
├── Prediction
├── Learning
└── Generation
Method Controller就是:
Method Library
↓
Method Controller
↓
Selected Method
因此:
Method Library提供能力,Method Controller负责调度能力。
236.25 Method Controller与认知资源
可以进一步区分:
Resource
↓
Method
↓
Execution
例如:
Knowledge Graph
↓
Graph Traversal Method
Database
↓
Query Method
Memory
↓
Memory Retrieval Method
因此:
Resource≠MethodResource \neq Method
Resource是:
有什么可以使用。
Method是:
怎么使用它。
Method Controller负责连接二者。
236.26 Method Controller的闭环
完整的方法控制过程:
Task
↓
Candidate Methods
↓
Method Evaluation
↓
Method Selection
↓
Parameterization
↓
Execution
↓
Result
↓
Evaluation
↓
Feedback
↓
Method Update
可以表示为:
Task→Select→Execute→Evaluate→Learn\boxed{ Task \rightarrow Select \rightarrow Execute \rightarrow Evaluate \rightarrow Learn }
这使Method Controller不只是一次性的选择器,而成为:
方法管理与方法优化机制。
236.27 WSaiOS中的Method Controller
综合前面的认知架构,可以进一步形成:
Cognition Controller
│
▼
Cognitive Controller
│
┌────────────┼────────────┐
▼ ▼ ▼
Perception Analysis Learning
│
▼
Method Controller
│
┌─────────┼─────────┐
▼ ▼ ▼
Method A Method B Method C
│ │ │
└─────────┼─────────┘
▼
Execution
│
▼
Result
│
▼
Feedback
因此:
Method Controller=Method Selection+Method Management+Method Switching+Method Evaluation\boxed{ Method\ Controller = Method\ Selection + Method\ Management + Method\ Switching + Method\ Evaluation }
236.28 四层控制体系
截至本章,WSaiOS可以形成更加完整的控制层:
┌───────────────────────────────┐
│ Cognition Controller │
│ 控制整个认知过程 │
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Cognitive Controller │
│ 控制认知动作 │
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Perception Controller │
│ 控制信息感知 │
└───────────────┬───────────────┘
↓
┌───────────────────────────────┐
│ Method Controller │
│ 控制方法选择 │
└───────────────┬───────────────┘
↓
Method
↓
Execution
但这里存在一个重要的架构关系:
Method Controller不是简单的“更低一级”,而是连接认知控制与具体方法执行的专门控制层。
236.29 四个问题
因此可以用四个问题理解整个控制体系:
Cognition Controller
如何进行认知?
Cognitive Controller
下一步做什么?
Perception Controller
应该感知什么?
Method Controller
采用什么方法完成?
形成:
How to Cognize→What Next→What to Perceive→How to Execute\boxed{ How\ to\ Cognize \rightarrow What\ Next \rightarrow What\ to\ Perceive \rightarrow How\ to\ Execute }
236.30 Method Controller与EOM认知系统
最终,EOM可以与控制架构连接起来:
ELEMENT
│
▼
OBJECT
│
▼
METHOD LIBRARY
│
▼
METHOD CONTROLLER
│
┌───────────┼───────────┐
▼ ▼ ▼
Method A Method B Method C
│ │ │
└───────────┼───────────┘
▼
Execution
│
▼
Result
│
▼
Feedback
这可以进一步形成:
EOM+Controllers\boxed{ EOM + Controllers }
即:
Element→Object→Method→Control→Execution\boxed{ Element \rightarrow Object \rightarrow Method \rightarrow Control \rightarrow Execution }
其中 Method 是认知能力的结构化表达,而 Method Controller 是对这种能力进行动态选择和调度的机制。
236.31 本章核心结论
Method Controller|方法控制器解决的是认知系统中的一个关键问题:
已经确定要做什么之后,究竟采用什么方法完成?
因此:
Action=做什么\boxed{ Action = 做什么 } Method=怎么做\boxed{ Method = 怎么做 } Method Controller=选择怎么做\boxed{ Method\ Controller = 选择怎么做 }
它负责:
方法发现
↓
方法选择
↓
方法验证
↓
参数配置
↓
方法组合
↓
方法切换
↓
方法终止
↓
方法评价
↓
方法学习
最终形成:
Task→Method Controller→Method→Execution→Result→Feedback\boxed{ Task \rightarrow Method\ Controller \rightarrow Method \rightarrow Execution \rightarrow Result \rightarrow Feedback }
而与前面几章结合:
Cognition Controller→Cognitive Controller→Perception Controller→Method Controller→Method→Execution\boxed{ Cognition\ Controller \rightarrow Cognitive\ Controller \rightarrow Perception\ Controller \rightarrow Method\ Controller \rightarrow Method \rightarrow Execution }
在WSaiOS的EOM体系中,则可以进一步得到一个非常关键的结构:
Element→Object→Method\boxed{ Element \rightarrow Object \rightarrow Method }
以及:
Cognition→Control→Method→Execution\boxed{ Cognition \rightarrow Control \rightarrow Method \rightarrow Execution }
由此,Method不再只是一个程序函数,而成为认知系统中的“可选择认知能力”;Method Controller则成为决定这些能力何时、为何以及以何种组合被调用的控制机制。