第221章 MethodDecisionRepository
221.1 MethodDecisionRepository定义
在前面的 Repository 体系中,已经建立:
IndividualRepository
ObjectRepository
StateRepository
RelationRepository
KnowledgeRepository
GoalCapabilityRepository
认知流程继续向前:
Goal→Capability→Matching→Method→DecisionGoal \rightarrow Capability \rightarrow Matching \rightarrow Method \rightarrow Decision
Goal 确定需要达到的目标,Capability 表示当前能够执行什么,Matching 判断能力是否满足要求。
在此基础上,系统需要保存两个重要对象:
Method
Decision
同时,二者都不是静态对象。
Method 会不断发生:
创建
修改
验证
失效
优化
Decision 也会不断发生:
产生
选择
执行
完成
失败
重新决策
因此需要同时保存:
Method
Method History
Decision
Decision History
由此建立:
MethodDecisionRepositoryMethodDecisionRepository
其核心模型:
MDR=(M,D,MH,DH,Q,P,T)MDR=(M,D,MH,DH,Q,P,T)
其中:
- MM:Method;
- DD:Decision;
- MHMH:Method History;
- DHDH:Decision History;
- QQ:Query;
- PP:Persistence;
- TT:Time。
因此:
MethodDecisionRepository=Method+Decision+MethodHistory+DecisionHistory\boxed{ MethodDecisionRepository = Method + Decision + MethodHistory + DecisionHistory }
需要特别说明:
MethodDecisionRepository≠MethodMethodDecisionRepository \neq Method
也不意味着:
MethodDecisionRepository=MethodEngine+DecisionEngineMethodDecisionRepository = MethodEngine+DecisionEngine
它只是围绕 Method、Decision 及其历史建立持久化和查询边界。
221.2 Method领域对象
前面的 MethodEngine 已经定义:
M=(T,C,P,A,R)M=(T,C,P,A,R)
其中:
- TT:Method Type;
- CC:Method Condition;
- PP:Method Process;
- AA:Method Action;
- RR:Expected Result。
Method回答:
怎么做\boxed{怎么做}
例如:
Goal
↓
Process Object
↓
Method-M1
↓
Action A1
↓
Action A2
↓
Action A3
Method 是可执行方案的结构化表示。
因此:
Method≠BehaviorMethod\neq Behavior Method≠DecisionMethod\neq Decision
Method描述执行方案。
Behavior负责把选定 Method 转化为当前可执行行为。
221.3 Decision领域对象
前面的 DecisionService / DecisionEngine 已经定义 Decision。
基本模型:
D=(C,Ca,R,H)D=(C,Ca,R,H)
其中:
- CC:Decision Condition;
- CaCa:Candidates;
- RR:Decision Result;
- HH:Decision History。
Decision回答:
现在选择哪个\boxed{现在选择哪个}
例如:
Method-M1
Method-M2
Method-M3
↓
DecisionEngine
↓
Method-M2
因此:
Decision≠MethodDecision\neq Method
Method是候选方案。
Decision是从候选方案中形成的选择结果。
221.4 Method与Decision的关系
二者之间存在:
Method→Candidate→DecisionMethod \rightarrow Candidate \rightarrow Decision
例如:
Goal G1
↓
Capability C1
↓
Matching
↓
M1
M2
M3
↓
Decision
↓
M2
其中:
M1 = Candidate
M2 = Selected
M3 = Candidate
Decision 不改变 Method 本身。
因此:
Decision(M1,M2,M3)→M2Decision(M_1,M_2,M_3)\rightarrow M_2
221.5 MethodDecisionRepository的核心职责
本 Repository 协作层主要负责四类持久化数据:
Method
Decision
Method History
Decision History
对应:
MethodRepository
↓
Method
DecisionRepository
↓
Decision
MethodDecisionRepository
↓
Method History
Decision History
如果采用统一协作 Repository,则:
MethodDecisionRepository
├── Method Query
├── Decision Query
├── Method History Query
└── Decision History Query
221.6 Repository与MethodEngine
MethodEngine负责:
方法计算
方法条件计算
方法组合
方法候选生成
方法验证
Repository负责:
方法保存
方法查询
方法更新
方法历史保存
方法历史查询
因此:
MethodEngine=方法计算\boxed{ MethodEngine=方法计算 } MethodRepository=方法持久化\boxed{ MethodRepository=方法持久化 }
正确流程:
Goal
↓
Capability
↓
MethodEngine
↓
Method Candidate
↓
Verification
↓
UpdateEngine
↓
MethodRepository
↓
MySQL
221.7 Repository与DecisionEngine
DecisionEngine负责:
候选方案
条件计算
候选过滤
决策计算
决策结果
DecisionRepository负责:
Decision Save
Decision Query
Decision Update
Decision History
因此:
DecisionEngine≠DecisionRepositoryDecisionEngine \neq DecisionRepository
正确流程:
Method Candidates
↓
DecisionEngine
↓
Decision Result
↓
DecisionRepository
↓
MySQL
221.8 Method保存
Method保存过程:
Method
↓
Validate
↓
Map
↓
Check Existing
↓
Persist
↓
ReadBack
↓
Verify
公式:
Save(M)→Validate→Map→Persist→VerifySave(M) \rightarrow Validate \rightarrow Map \rightarrow Persist \rightarrow Verify
保存前至少检查:
ValidMethod=Type∧Condition∧Process∧Action∧ResultValidMethod = Type \land Condition \land Process \land Action \land Result
这里表示 Method 的核心结构必须完整。
221.9 Method查询
基本查询:
findMethod(ID)→MfindMethod(ID)\rightarrow M
还可以按照:
Goal
Capability
Method Type
Object
State
Condition
进行查询。
例如:
Query(G,C)→{M1,M2,…,Mn}Query(G,C)\rightarrow\{M_1,M_2,\ldots,M_n\}
注意:
Query(M)≠Match(M)Query(M)\neq Match(M)
Repository 只是加载候选 Method。
真正判断 Method 是否适合当前 Goal、Capability、Object、State 的工作属于 MethodEngine / MatchingEngine。
221.10 Method与Goal查询
可以建立:
findMethodsByGoal(G)→{M1,…,Mn}findMethodsByGoal(G) \rightarrow \{M_1,\ldots,M_n\}
流程:
Goal
↓
MethodDecisionRepository
↓
Method Candidates
↓
MethodEngine
这样可以从目标反向寻找已经保存的方法方案。
221.11 Method与Capability查询
方法通常需要特定能力。
因此:
findMethodsByCapability(C)→{M1,…,Mn}findMethodsByCapability(C) \rightarrow \{M_1,\ldots,M_n\}
完整关系:
Goal
↓
Capability
↓
Method
但是 Capability 是否真的满足 Method 要求,需要重新计算:
Match(C,M,Context)Match(C,M,Context)
Repository 不负责这个计算。
221.12 Decision保存
Decision保存:
Candidates
↓
DecisionEngine
↓
Decision Result
↓
Verification
↓
DecisionRepository
公式:
Save(D)→Validate→Map→Persist→VerifySave(D) \rightarrow Validate \rightarrow Map \rightarrow Persist \rightarrow Verify
Decision至少应该记录:
Decision ID
Goal ID
Candidate
Selected Candidate
Decision State
Reason
Condition
Calculation
Evidence
Time
221.13 Decision不是一个Boolean
不能只保存:
selected = true
更完整的 Decision:
Dr=(ID,G,Ca,S,R,Ev,T)D_r= (ID,G,Ca,S,R,Ev,T)
其中:
- IDID:Decision ID;
- GG:关联 Goal;
- CaCa:Candidates;
- SS:Decision State;
- RR:Decision Result;
- EvEv:Evidence;
- TT:Decision Time。
例如:
Candidates:
M1
M2
M3
Selected:
M2
Reason:
Capability + State + Condition satisfied
这样 Decision 才具备可追踪性。
221.14 Method History
Method 会不断变化,因此需要 Method History。
定义:
MH=(M,Mb,Ma,Δ,R,T)MH=(M,M_b,M_a,\Delta,R,T)
其中:
- MM:Method;
- MbM_b:更新前 Method;
- MaM_a:更新后 Method;
- Δ\Delta:Method Change;
- RR:Change Reason;
- TT:Change Time。
例如:
Method-M1
Condition:
Resource >= 1
↓
Condition:
Resource >= 2
历史记录:
Before:
Resource >= 1
After:
Resource >= 2
Reason:
Verified execution feedback
这使 Method 的演化能够被追踪。
221.15 Decision History
Decision History记录实际决策过程。
定义:
DH=(D,Ca,Sb,Sa,R,T)DH=(D,Ca,S_b,S_a,R,T)
其中:
- DD:Decision;
- CaCa:Candidates;
- SbS_b:决策前状态;
- SaS_a:决策后状态;
- RR:决策结果/原因;
- TT:时间。
例如:
Decision D1
Candidates:
M1
M2
M3
Selected:
M2
之后执行 M2 失败:
Decision D1
↓
Execution Failure
↓
Feedback
↓
Diagnosis
↓
Re-decision
形成:
Decision D1
Decision D2
两个决策都应该保留。
221.16 Decision History不是Method History
二者必须严格分离。
Method History记录:
Method发生了什么变化
Decision History记录:
系统曾经做过什么选择
因此:
MethodHistory≠DecisionHistory\boxed{ MethodHistory\neq DecisionHistory }
例如:
Method-M1:
Condition changed
属于 Method History。
而:
Decision D1:
Selected M1
属于 Decision History。
221.17 为什么必须保存Decision History
如果只保存当前 Decision:
Current Decision = D5
系统就不知道:
之前选择了什么?
为什么选择?
候选有哪些?
当时状态是什么?
后来结果如何?
而 Decision History 可以建立:
D1→D2→D3D_1\rightarrow D_2\rightarrow D_3
形成完整决策轨迹。
这对于:
Experience
Learning
Diagnosis
Risk
Decision Optimization
都非常重要。
221.18 Method History与Learning
Method History 是 LearningEngine 的重要事实来源。
完整路径:
Method Execution
↓
Result
↓
Feedback
↓
Method History
↓
Experience
↓
LearningEngine
↓
Method Update Candidate
LearningEngine 可以发现:
某 Method
在某条件下
经常失败
然后形成 Method Update Candidate。
但:
MethodHistory≠LearningMethodHistory \neq Learning
历史只是事实。
Learning 是对事实进行结构化学习计算。
221.19 Decision History与Learning
Decision History 同样可以进入 LearningEngine:
Decision History
↓
Result
↓
Feedback
↓
Experience
↓
LearningEngine
例如发现:
在某种 Goal + State 条件下
M1 的选择结果长期较差
这可以形成未来 Decision 计算的学习依据。
但不能直接认为:
History→AutomaticRuleHistory \rightarrow AutomaticRule
必须经过比较、验证和适用性判断。
221.20 Method更新
Method更新:
Mt+ΔM→Mt+1M_t+\Delta M\rightarrow M_{t+1}
例如:
Condition:Resource≥1Condition: Resource\geq1
更新为:
Condition:Resource≥2Condition: Resource\geq2
更新流程:
Current Method
↓
LearningEngine
↓
Method Update Candidate
↓
Verification
↓
UpdateEngine
↓
MethodDecisionRepository
↓
Method History
Repository保存更新后的 Method,并保存变化历史。
221.21 Decision更新
Decision 也可能因为新的事实而重新计算。
例如:
D1
↓
M1 Selected
↓
Execution Failed
↓
Feedback
↓
Capability/State Changed
↓
New Matching
↓
D2
此时一般不应该直接覆盖 D1:
D1→D2D_1\rightarrow D_2
而应保留 D1 的历史。
因此:
DecisionHistoryDecisionHistory
是决策连续性的基础。
221.22 Decision与Method更新的区别
Method更新:
Mt+ΔM→Mt+1M_t+\Delta M\rightarrow M_{t+1}
意味着方法本身发生变化。
Decision重新计算:
Dt+ΔContext→Dt+1D_t+\Delta Context\rightarrow D_{t+1}
意味着当前选择发生变化。
例如:
Method-M1 没变
但是:
Capability C1 blocked
此时:
Method 不一定需要修改
Decision 可以重新选择 M2
所以:
CapabilityStateChange→DecisionRecalculationCapabilityStateChange \rightarrow DecisionRecalculation
并不自动意味着:
CapabilityStateChange→MethodUpdateCapabilityStateChange \rightarrow MethodUpdate
221.23 Method与Decision的完整关系
正常路径:
Goal
↓
Capability
↓
Matching
↓
Method Candidates
↓
DecisionEngine
↓
Selected Method
↓
Behavior
持久化:
Method
↓
MethodRepository
↓
MySQL
Decision
↓
DecisionRepository
↓
MySQL
历史:
Method Change
↓
MethodHistory
Decision Change
↓
DecisionHistory
221.24 PHP接口
可以建立统一协作接口:
<?php
interface MethodDecisionRepositoryInterface
{
public function findMethodById($id);
public function findMethodsByGoalId($goalId);
public function findMethodsByCapabilityId(
$capabilityId
);
public function saveMethod($method);
public function updateMethod($method);
public function saveMethodHistory($history);
public function findMethodHistory($methodId);
public function findDecisionById($id);
public function findDecisionsByGoalId($goalId);
public function saveDecision($decision);
public function updateDecision($decision);
public function saveDecisionHistory($history);
public function findDecisionHistory($decisionId);
}
如果工程规模较大,也可以拆分成:
MethodRepositoryInterface
DecisionRepositoryInterface
MethodHistoryRepositoryInterface
DecisionHistoryRepositoryInterface
再由更高层 Service 进行组合。
这种拆分通常更符合单一职责原则。
221.25 MethodMapper
class MethodMapper
{
public function toPersistence($method)
{
return array(
'id' => $method->getId(),
'method_type' => $method->getType(),
'condition' => $method->getCondition(),
'process_data' => $method->getProcess(),
'action_data' => $method->getActions(),
'expected_result' => $method->getExpectedResult()
);
}
public function toDomain($data)
{
$method = new Method();
$method->setId($data['id']);
$method->setType(
$data['method_type']
);
$method->setCondition(
$data['condition']
);
$method->setProcess(
$data['process_data']
);
$method->setActions(
$data['action_data']
);
$method->setExpectedResult(
$data['expected_result']
);
return $method;
}
}
这里的 process_data、action_data 只是持久化字段示例。实际项目可以根据 MethodProcess、MethodAction 等独立表进行规范化设计。
221.26 DecisionMapper
class DecisionMapper
{
public function toPersistence($decision)
{
return array(
'id' => $decision->getId(),
'goal_id' => $decision->getGoalId(),
'selected_candidate_id' =>
$decision->getSelectedCandidateId(),
'state' => $decision->getState(),
'reason' => $decision->getReason(),
'calculation' => $decision->getCalculation(),
'evidence' => $decision->getEvidence(),
'decision_time' => $decision->getTime()
);
}
public function toDomain($data)
{
$decision = new Decision();
$decision->setId($data['id']);
$decision->setGoalId(
$data['goal_id']
);
$decision->setSelectedCandidateId(
$data['selected_candidate_id']
);
$decision->setState(
$data['state']
);
$decision->setReason(
$data['reason']
);
$decision->setCalculation(
$data['calculation']
);
$decision->setEvidence(
$data['evidence']
);
$decision->setTime(
$data['decision_time']
);
return $decision;
}
}
221.27 Method History Repository
可以单独实现:
interface MethodHistoryRepositoryInterface
{
public function save($history);
public function findByMethodId($methodId);
public function findLatestByMethodId($methodId);
}
其职责非常明确:
MethodHistoryRepository=MethodHistoryPersistenceMethodHistoryRepository = MethodHistoryPersistence
不负责 Method 计算。
221.28 Decision History Repository
同样:
interface DecisionHistoryRepositoryInterface
{
public function save($history);
public function findByDecisionId($decisionId);
public function findByGoalId($goalId);
public function findLatestByGoalId($goalId);
}
这样可以查询:
某个Decision的历史
或者:
某个Goal过去所有决策
221.29 MySQL基础结构
Method:
CREATE TABLE methods (
id INT NOT NULL AUTO_INCREMENT,
method_type VARCHAR(100) NOT NULL,
condition_data TEXT,
process_data TEXT,
action_data TEXT,
expected_result TEXT,
created_at DATETIME,
updated_at DATETIME,
PRIMARY KEY (id)
);
Method History:
CREATE TABLE method_history (
id INT NOT NULL AUTO_INCREMENT,
method_id INT NOT NULL,
before_data TEXT,
after_data TEXT,
change_data TEXT,
reason TEXT,
changed_at DATETIME NOT NULL,
PRIMARY KEY (id)
);
Decision:
CREATE TABLE decisions (
id INT NOT NULL AUTO_INCREMENT,
goal_id INT NOT NULL,
selected_candidate_id INT,
state VARCHAR(50) NOT NULL,
reason TEXT,
calculation TEXT,
evidence TEXT,
decision_time DATETIME NOT NULL,
PRIMARY KEY (id)
);
Decision History:
CREATE TABLE decision_history (
id INT NOT NULL AUTO_INCREMENT,
decision_id INT NOT NULL,
goal_id INT NOT NULL,
candidates TEXT,
selected_candidate_id INT,
before_state VARCHAR(50),
after_state VARCHAR(50),
reason TEXT,
changed_at DATETIME NOT NULL,
PRIMARY KEY (id)
);
这些是 Repository 设计示例,不代表当前 ICAI 实际数据库已经采用这些字段。正式工程实现时,应根据实际数据库结构、版本和关联表进行验证。
221.30 方法历史与决策历史的保存顺序
如果一次 Method 更新直接影响 Decision,则应该注意顺序。
例如:
Method Update
↓
Method Verification
↓
Method History
↓
Re-Matching
↓
Decision Recalculation
↓
New Decision
↓
Decision History
这样能够保证:
MethodChange→DecisionChangeMethodChange \rightarrow DecisionChange
的因果顺序可追踪。
221.31 Method与Decision的事务
如果一个业务操作同时涉及:
Method
Method History
Decision
Decision History
可以由 Service / TransactionManager 协调:
Begin
↓
Update Method
↓
Save Method History
↓
Calculate Decision
↓
Save Decision
↓
Save Decision History
↓
Verify
↓
Commit
但必须注意:
MethodDecisionRepository≠TransactionManagerMethodDecisionRepository \neq TransactionManager
Repository参与持久化。
TransactionManager负责事务边界。
221.32 Decision失败后的重新决策
Decision 选出的 Method 执行失败以后,不应该简单覆盖原 Decision。
完整过程:
Decision D1
↓
Selected M1
↓
Behavior
↓
Execution
↓
Failure
↓
Feedback
↓
Diagnosis
↓
State / Capability / Method Change
↓
Matching
↓
Decision D2
最终:
D1≠D2D_1\neq D_2
而是:
D1→D2D_1\rightarrow D_2
Decision History 保存整个过程。
221.33 Method失败与Method History
Method执行失败也不意味着 Method 必须立即修改。
例如:
Method M1
↓
Execution Failed
失败原因可能是:
Resource
State
Environment
Action
Method
只有 DiagnosisEngine 确认 Method 本身存在问题,并经过 Learning / Verification 后,才形成:
ΔM\Delta M
然后:
Mt+ΔM→Mt+1M_t+\Delta M\rightarrow M_{t+1}
因此:
MethodFailure≠MethodInvalidMethodFailure \neq MethodInvalid
这是 ICAI 学习和维护体系中的重要原则。
221.34 Decision历史进入Experience
Decision History 可以形成历史事实:
HD={D1,D2,…,Dn}H_D= \{D_1,D_2,\ldots,D_n\}
经过:
Comparison
↓
Relation
↓
Pattern
↓
Experience
形成经验:
Experience=(History,Memory,Condition,Result,Pattern)Experience=(History,Memory,Condition,Result,Pattern)
例如:
相同Goal
相同State
相同Capability
多次选择M1
↓
M1执行结果较差
可以形成未来 Decision 计算的经验依据。
221.35 Repository不能直接形成经验
必须明确:
DecisionHistory≠ExperienceDecisionHistory \neq Experience
Repository只保存历史。
ExperienceEngine负责:
History→ExperienceHistory \rightarrow Experience
因此:
DecisionRepository
↓
DecisionHistory
↓
ExperienceEngine
↓
Experience
221.36 MethodDecision完整架构
最终形成:
Goal
↓
Capability
↓
Matching
↓
Method Candidates
↓
DecisionEngine
↓
Selected Method
↓
Behavior
↓
Action
↓
Execution
↓
Result
持久化:
Method
↓
MethodRepository
↓
MySQL
Decision
↓
DecisionRepository
↓
MySQL
Method Change
↓
MethodHistoryRepository
↓
MySQL
Decision Change
↓
DecisionHistoryRepository
↓
MySQL
221.37 Repository读取路径
Method读取:
MySQL→MethodRepository→MethodMySQL \rightarrow MethodRepository \rightarrow Method
Decision读取:
MySQL→DecisionRepository→DecisionMySQL \rightarrow DecisionRepository \rightarrow Decision
Method History:
MySQL→MethodHistoryRepository→MethodHistoryMySQL \rightarrow MethodHistoryRepository \rightarrow MethodHistory
Decision History:
MySQL→DecisionHistoryRepository→DecisionHistoryMySQL \rightarrow DecisionHistoryRepository \rightarrow DecisionHistory
然后进入认知计算:
Method
↓
MethodEngine
Decision
↓
DecisionEngine
Method History
↓
ExperienceEngine
Decision History
↓
ExperienceEngine
221.38 与前面Repository体系的连接
到本章为止:
IndividualRepository
↓
ObjectRepository
↓
StateRepository
↓
RelationRepository
↓
KnowledgeRepository
↓
GoalCapabilityRepository
↓
MethodDecisionRepository
对应认知结构:
Individual
↓
Object
↓
State
↓
Relation
↓
Knowledge
↓
Goal
↓
Capability
↓
Matching
↓
Method
↓
Decision
这已经形成从基础对象到决策层的连续持久化体系。
221.39 核心公式
Method:
M=(T,C,P,A,R)\boxed{ M=(T,C,P,A,R) }
Decision:
D=(C,Ca,R,H)\boxed{ D=(C,Ca,R,H) }
Method更新:
Mt+ΔM→Mt+1\boxed{ M_t+\Delta M\rightarrow M_{t+1} }
Decision变化:
Dt+ΔContext→Dt+1\boxed{ D_t+\Delta Context\rightarrow D_{t+1} }
Method History:
MH=(M,Mb,Ma,Δ,R,T)\boxed{ MH=(M,M_b,M_a,\Delta,R,T) }
Decision History:
DH=(D,Ca,Sb,Sa,R,T)\boxed{ DH=(D,Ca,S_b,S_a,R,T) }
Method持久化:
Method→MethodRepository→MySQL\boxed{ Method \rightarrow MethodRepository \rightarrow MySQL }
Decision持久化:
Decision→DecisionRepository→MySQL\boxed{ Decision \rightarrow DecisionRepository \rightarrow MySQL }
221.40 本章核心原则
原则一:Method与Decision是两个独立Domain Object
Method≠DecisionMethod\neq Decision
原则二:Method是方案,Decision是选择
Method=HowMethod=How Decision=WhichDecision=Which
原则三:MethodEngine负责方法计算
MethodEngine≠MethodRepositoryMethodEngine\neq MethodRepository
原则四:DecisionEngine负责决策计算
DecisionEngine≠DecisionRepositoryDecisionEngine\neq DecisionRepository
原则五:Method History与Decision History必须分离
MethodHistory≠DecisionHistoryMethodHistory\neq DecisionHistory
原则六:Method变化不等于Decision变化
ΔM≠ΔD\Delta M\neq\Delta D
原则七:Decision重新计算不等于Method更新
DecisionRecalculation≠MethodUpdateDecisionRecalculation \neq MethodUpdate
原则八:失败不直接等于Method无效
MethodFailure≠MethodInvalidMethodFailure \neq MethodInvalid
原则九:Decision历史不能被当前Decision覆盖
D1→D2D_1\rightarrow D_2
而不是:
D1→overwrite(D1)D_1\rightarrow overwrite(D_1)
原则十:Repository保存事实,不进行认知推理
Repository≠CognitiveEngineRepository\neq CognitiveEngine
221.41 本章总结
MethodDecisionRepository 建立的是 ICAI 从:
Goal→Capability→Matching→Method→DecisionGoal \rightarrow Capability \rightarrow Matching \rightarrow Method \rightarrow Decision
进入执行阶段之前的重要持久化体系。
Method表示:
可执行的方法方案\boxed{可执行的方法方案}
Decision表示:
当前候选方案中的选择结果\boxed{当前候选方案中的选择结果}
Method History表示:
方法自身的变化过程\boxed{方法自身的变化过程}
Decision History表示:
决策自身的变化过程\boxed{决策自身的变化过程}
完整关系:
Goal
↓
Capability
↓
Matching
↓
Method Candidates
↓
Decision
↓
Selected Method
↓
Behavior
持久化关系:
Method
↓
MethodRepository
↓
MySQL
Decision
↓
DecisionRepository
↓
MySQL
Method History
↓
MethodHistoryRepository
↓
MySQL
Decision History
↓
DecisionHistoryRepository
↓
MySQL
学习关系:
Method History
↓
Decision History
↓
Experience
↓
LearningEngine
↓
Method / Decision Update Candidate
↓
UpdateEngine
↓
Repository
最终形成明确的工程边界:
MethodEngine=方法计算\boxed{ MethodEngine=方法计算 } DecisionEngine=决策计算\boxed{ DecisionEngine=决策计算 } MethodRepository=方法持久化\boxed{ MethodRepository=方法持久化 } DecisionRepository=决策持久化\boxed{ DecisionRepository=决策持久化 } MethodHistoryRepository=方法历史持久化\boxed{ MethodHistoryRepository=方法历史持久化 } DecisionHistoryRepository=决策历史持久化\boxed{ DecisionHistoryRepository=决策历史持久化 }
如果采用本章的协作式 Repository,则:
MethodDecisionRepository=Method/Decision/HistoryPersistence Boundary\boxed{ MethodDecisionRepository = Method/Decision/History Persistence\ Boundary }
最终完整链条为:
Goal→Capability→Matching→Method→Decision→Behavior→Action→Execution\boxed{ Goal \rightarrow Capability \rightarrow Matching \rightarrow Method \rightarrow Decision \rightarrow Behavior \rightarrow Action \rightarrow Execution }
而历史数据从执行结果反向进入学习体系:
Execution→Feedback→MethodHistory/DecisionHistory→Experience→Learning→Update\boxed{ Execution \rightarrow Feedback \rightarrow MethodHistory/DecisionHistory \rightarrow Experience \rightarrow Learning \rightarrow Update }
这样,Method 与 Decision 就不再是一次性的运行时变量,而成为能够被保存、读取、追踪、比较、学习和更新的长期认知工程对象。