首页 理论 架构 工程 文档 白皮书 著作 研究 案例 下载 博客 关于 开始使用 →

第164章 Memory与Experience类

第164章 Memory与Experience类

164.1 提出背景

在前面的章节中,ICAI已经建立了从需求到行为、从行为到结果、从结果到反馈的运行链:

Need → Goal → Capability → Method → Decision → Behavior → Action → Execution → Result → Feedback → State

但是,一个个体如果每次行为结束以后都不保存相关信息,那么下一次面对相同或者相似情况时,系统只能重新开始。

因此,个体必须具有保存过去信息的能力。

这种能力首先表现为:

Memory(记忆)

但是,仅仅保存过去发生过的事实仍然不够。

例如系统记录:

2026-09-08
Object = Cup
Action = Grip
Result = Failure

这只是过去发生过的一条记录。

如果系统经过多次行为发现:

Smooth Cup → Grip Method A → Frequently Failed

那么系统已经不只是保存历史,而是形成了一种关于过去行为的结构化认识。

这就是:

Experience(经验)

因此必须明确区分:

History记录发生过什么。

Memory保存可以被再次调用的信息。

Experience表示从过去行为和结果中形成的结构化经验。

进一步,Memory和Experience内部还需要建立关系:

Memory Relation

以及:

Experience Relation

于是形成:

History → Memory → Experience

以及:

Memory → Memory Relation

Experience → Experience Relation


164.2 Memory概念定义

**Memory(记忆)**是个体对过去已经获得的信息、事实、状态、对象、关系、行为和结果进行保存,并能够在后续认知过程中重新访问的信息结构。

Memory解决的问题是:

“过去发生过什么,以及过去保存了哪些可以再次使用的信息?”

可以定义:

M=(I,C,W,T,R)M=(I,C,W,T,R)

其中:

  • MM:Memory,记忆;
  • II:Information,记忆信息;
  • CC:Context,记忆上下文;
  • WW:Weight,记忆权重;
  • TT:Time,记忆时间;
  • RR:Relation,记忆关系。

因此:

Memory = Information + Context + Weight + Time + Relation

Memory不是简单的字符串存储。

一个有效Memory至少应该知道:

是什么信息
什么时候产生
在什么条件下产生
与什么对象有关
与哪些其他Memory有关
当前具有什么状态或权重

例如:

Memory
Object = Cup
State = OnTable
Context = Kitchen
Time = 2026-09-08
Source = Observation

这才构成一个具有认知意义的记忆对象。


164.3 Experience概念定义

**Experience(经验)**是个体根据过去的Behavior、Action、Execution、Result、Feedback和相关Memory,经过组织、比较和归纳形成的可用于后续认知和行为的结构化知识。

Experience解决的问题是:

“过去的行为告诉了我什么?”

因此:

Memory ≠ Experience

Memory保存过去的信息。

Experience则从过去的信息中形成可重复使用的行为认识。

例如:

Memory 1:
Grip Cup A → Success

Memory 2:
Grip Cup B → Failure

Memory 3:
Grip Smooth Cup → Failure

Memory 4:
Grip Rough Cup → Success

经过关系组织以后,可以形成:

Experience:
Smooth Surface → Grip Method A → Failure Probability Higher

经验因此不是单纯的历史记录,而是具有一定结构和适用条件的信息。

可以定义:

E=(H,M,C,R,P)E=(H,M,C,R,P)

其中:

  • EE:Experience;
  • HH:History,历史事实;
  • MM:Memory,相关记忆;
  • CC:Condition,形成经验的条件;
  • RR:Result,相关结果;
  • PP:Pattern,形成的经验模式。

因此:

Experience = History + Memory + Condition + Result + Pattern


164.4 History概念定义

**History(历史记录)**是按照时间顺序保存过去事件、行为、状态、执行和结果的事实记录。

History回答:

“过去具体发生了什么?”

例如:

10:00 观察杯子
10:01 移动手
10:02 抓取杯子
10:03 抓取失败
10:04 再次抓取
10:05 抓取成功

这些是History。

History强调:

时间顺序 + 事实发生

可以定义:

H={h1,h2,h3,…,hn}H=\{h_1,h_2,h_3,\dots,h_n\}

其中:

  • HH:History;
  • hih_i:第 ii 条历史记录;
  • nn:历史记录数量。

每条History可以定义:

h=(T,O,A,R,S)h=(T,O,A,R,S)

其中:

  • TT:Time;
  • OO:Object;
  • AA:Action;
  • RR:Result;
  • SS:State。

因此:

History是事实序列。


164.5 History与Memory的区别

History与Memory非常接近,但两者不能合并。

History:

按照发生时间保存过去事实。

Memory:

保存以后可能被认知系统再次使用的信息。

例如:

History:
09:01 Grip Cup → Failure

History:
09:03 Grip Cup → Failure

History:
09:05 Grip Cup → Success

这些是三条历史事实。

系统进一步处理后,可以形成Memory:

Memory:
Cup A
Previous Grip Attempts = 3
Previous Success = 1
Previous Failure = 2

因此:

History → Memory

但不是所有History都必须永久成为Memory。

系统可以根据:

  • 重要性;
  • 重复次数;
  • 关联程度;
  • 使用频率;
  • 时间;
  • 当前任务相关性;

决定哪些历史事实进入长期Memory。


164.6 Memory Relation概念定义

**Memory Relation(记忆关系)**是两个或多个Memory对象之间形成的结构化关系。

Memory如果彼此孤立,就很难形成复杂认知结构。

例如:

Memory A:
Cup

Memory B:
Kitchen

Memory C:
Table

Memory D:
Cup On Table

它们之间存在:

Cup → LocatedIn → Kitchen
Cup → On → Table
Table → LocatedIn → Kitchen

这些关系就是Memory Relation。

可以定义:

MR=(M1,T,M2,C)MR=(M_1,T,M_2,C)

其中:

  • MRMR:Memory Relation;
  • M1M_1:起始Memory;
  • TT:Relation Type;
  • M2M_2:目标Memory;
  • CC:Relation Context。

因此:

Memory → Relation → Memory

形成记忆网络。


164.7 Memory Relation类型

Memory Relation可以根据认知需要建立多种类型。

例如:

same
similar
before
after
cause
effect
part_of
contains
located_in
associated_with
derived_from
used_with
conflicts_with

例如:

Memory A:
CupOnTable

Memory B:
CupLifted

可以建立:

CupOnTable
    ↓ before
CupLifted

如果:

Memory A:
GripFailed

Memory B:
SurfaceSmooth

可以建立:

SurfaceSmooth
    ↓ associated_with
GripFailed

这些关系使Memory从“记录集合”变成“结构化记忆网络”。


164.8 Experience Relation概念定义

**Experience Relation(经验关系)**是不同Experience之间形成的逻辑关系,用于表达经验之间的因果、条件、继承、冲突、支持、顺序和适用关系。

可以定义:

ER=(E1,T,E2,C)ER=(E_1,T,E_2,C)

其中:

  • ERER:Experience Relation;
  • E1E_1:源Experience;
  • TT:关系类型;
  • E2E_2:目标Experience;
  • CC:关系条件。

例如:

Experience A:
Smooth Surface → Grip A → Failure

Experience B:
Smooth Surface → Grip B → Success

可以建立:

Experience A
    ↓ conflicts_with
Experience B

也可以:

Experience A
    ↓ supports
Experience B

因此Experience Relation用于组织经验之间的结构关系。


164.9 Memory Relation与Experience Relation的区别

两者不能混合。

类型 连接对象 主要作用
Memory Relation Memory ↔ Memory 组织过去信息
Experience Relation Experience ↔ Experience 组织经验结构

例如:

Memory:
Cup
Memory:
SmoothSurface
Memory:
GripFailure

可以建立:

SmoothSurface → associated_with → GripFailure

这是Memory Relation。

进一步形成:

Experience:
Smooth Surface + Grip A → Failure

另一个Experience:

Experience:
Rough Surface + Grip A → Success

二者之间:

Experience 1 → contrasts_with → Experience 2

这是Experience Relation。

因此:

Memory Relation描述记忆之间的关系。

Experience Relation描述经验之间的关系。


164.10 Memory形成模型

Memory的形成来源于系统运行过程。

可以定义:

Perception → Object → State → Behavior → Result → Feedback → Memory

例如:

观察杯子 → 建立Cup对象 → 获得Cup状态 → 执行抓取 → 得到Result → 获得Feedback → 保存Memory

因此Memory不是凭空生成的。

它具有明确来源。

可以表示:

Memory=F(Observation,Behavior,Result,Feedback,Context)Memory=F(Observation,Behavior,Result,Feedback,Context)

其中:

  • Observation:观察信息;
  • Behavior:行为信息;
  • Result:行为结果;
  • Feedback:反馈信息;
  • Context:上下文;
  • FF:记忆形成规则。

164.11 Experience形成模型

Experience形成需要比Memory更高一级的处理。

可以定义:

History → Memory → Comparison → Relation → Experience

例如:

History 1:
Smooth Cup → Grip A → Failure

History 2:
Smooth Cup → Grip A → Failure

History 3:
Smooth Cup → Grip B → Success

系统发现:

Grip A
→
Smooth Cup
→
Repeated Failure

以及:

Grip B
→
Smooth Cup
→
Success

于是形成Experience:

Experience:
Under Smooth Cup Condition,
Grip B is more suitable than Grip A.

这里并不需要大模型。

它可以通过:

  • 离散事实;
  • 条件匹配;
  • 结果统计;
  • 关系分析;
  • 规则判断;

形成经验。


164.12 Memory Recall

Memory的重要能力不是“保存”,而是“再次取得”。

因此Memory必须支持:

Memory Store → Memory Recall → Cognitive Processing

例如当前Goal:

Pick Up Cup

系统可以查询:

Memory:
Previous Cup
Previous Grip
Previous Result
Previous Condition

然后得到:

Relevant Memory

进一步:

Relevant Memory → Experience → Decision

因此形成:

Goal → Memory Recall → Experience Recall → Decision

这使过去信息能够参与当前认知。


164.13 Experience与Decision

Experience本身不直接执行行为。

Experience的作用之一,是为Decision提供过去行为依据。

例如:

Candidate A
Candidate B

过去经验:

Experience A:
Method A → Failure under Condition X

Experience B:
Method B → Success under Condition X

Decision可以利用这些经验:

Experience → Candidate Evaluation → Decision

因此:

Experience影响Decision,但Experience不等于Decision。

Decision仍然必须依据当前Condition、Capability、Method和Candidate状态进行选择。


164.14 Experience与Capability

Experience还可以影响Capability的发展。

例如最初:

Capability:
Grip Smooth Object = Unknown

经过多次行为:

Experience:
Smooth Object + Method A → Failure

Experience:
Smooth Object + Method B → Success

系统逐渐可以确认:

Capability:
Grip Smooth Object with Method B = Verified

因此形成:

Behavior → Result → Feedback → Experience → Capability Update

这意味着Capability不是永远静态不变的。

经验可以成为Capability变化的重要依据。


164.15 Memory与Experience的对象模型

PHP OOP中可以建立Memory类:

class Memory
{
    protected $id;
    protected $memoryType;
    protected $objectType;
    protected $objectValue;
    protected $context;
    protected $weight;
    protected $createdAt;

    public function setWeight($weight)
    {
        $this->weight = $weight;
    }

    public function getWeight()
    {
        return $this->weight;
    }
}

Experience类:

class Experience
{
    protected $id;
    protected $type;
    protected $condition;
    protected $action;
    protected $result;
    protected $pattern;
    protected $weight;

    public function setPattern($pattern)
    {
        $this->pattern = $pattern;
    }

    public function getPattern()
    {
        return $this->pattern;
    }
}

二者职责不同。

Memory负责保存记忆信息。

Experience负责保存经过组织后的经验结构。


164.16 History类

History可以独立建立:

class History
{
    protected $id;
    protected $time;
    protected $objectId;
    protected $actionId;
    protected $result;
    protected $state;

    public function record($data)
    {
        $this->objectId = $data['object_id'];
        $this->actionId = $data['action_id'];
        $this->result = $data['result'];
        $this->state = $data['state'];
    }
}

History的主要职责是:

记录事实。

它不应该负责:

  • 经验推导;
  • Decision;
  • Method选择;
  • Capability判断。

这样可以保持对象职责单一。


164.17 MemoryRelation类

class MemoryRelation
{
    protected $id;
    protected $memoryId;
    protected $targetMemoryId;
    protected $relationType;
    protected $context;

    public function setRelation($type)
    {
        $this->relationType = $type;
    }

    public function getRelation()
    {
        return $this->relationType;
    }
}

其核心结构:

Memory A → Relation → Memory B


164.18 ExperienceRelation类

class ExperienceRelation
{
    protected $id;
    protected $experienceId;
    protected $targetExperienceId;
    protected $relationType;
    protected $condition;

    public function setRelation($type)
    {
        $this->relationType = $type;
    }

    public function getRelation()
    {
        return $this->relationType;
    }
}

其核心结构:

Experience A → Relation → Experience B


164.19 MemoryManager与ExperienceManager

随着Memory和Experience数量增长,需要建立独立管理对象。

MemoryManager:

class MemoryManager
{
    protected $memories;

    public function add($memory)
    {
        $this->memories[] = $memory;
    }

    public function recall($type, $value)
    {
        $result = array();

        foreach ($this->memories as $memory) {
            if ($memory->getObjectType() == $type &&
                $memory->getObjectValue() == $value) {
                $result[] = $memory;
            }
        }

        return $result;
    }
}

ExperienceManager:

class ExperienceManager
{
    protected $experiences;

    public function add($experience)
    {
        $this->experiences[] = $experience;
    }

    public function findByCondition($condition)
    {
        $result = array();

        foreach ($this->experiences as $experience) {
            if ($experience->getCondition() == $condition) {
                $result[] = $experience;
            }
        }

        return $result;
    }
}

这种设计可以在后续继续扩展:

Store → Recall → Match → Select → Apply


164.20 数据库模型

Memory可以建立:

memories

主要字段:

id
memory_type
object_type
object_value
context
weight
source
created_at
updated_at

History可以建立:

histories

主要字段:

id
event_type
object_id
action_id
result
state
event_time
created_at

Memory Relation:

memory_relations

主要字段:

id
memory_id
target_memory_id
relation_type
context
weight
created_at

Experience:

experiences

主要字段:

id
experience_type
condition
action
result
pattern
weight
source
created_at
updated_at

Experience Relation:

experience_relations

主要字段:

id
experience_id
target_experience_id
relation_type
condition
weight
created_at

这样形成完整的持久化结构:

History → Memory → Memory Relation

以及:

History + Memory → Experience → Experience Relation


164.21 Memory与Experience运行流程

完整运行过程可以表示为:

Behavior → Execution → Result → Feedback → History

然后:

History → Memory Storage

多个相关Memory进一步形成:

Memory → Memory Relation

再经过比较、条件组织和结果分析:

History + Memory + Relation → Experience

Experience之间继续形成:

Experience → Experience Relation

最终:

Memory + Experience → Current Cognition

因此完整闭环为:

Behavior → Result → Feedback → History → Memory → Experience → Decision


164.22 记忆不是简单数据库

ICAI中的Memory虽然最终可以使用MySQL保存,但是:

Memory ≠ MySQL Table

数据库只是Memory的持久化载体。

真正的Memory对象还必须具有:

  • 信息;
  • 对象;
  • 上下文;
  • 时间;
  • 权重;
  • 来源;
  • 状态;
  • 关系;
  • Recall能力。

因此:

Memory Object → Memory Store → Memory Recall

才构成完整的记忆系统。

MySQL负责持久化。

Memory类负责认知对象。

MemoryManager负责管理。

MemoryRelation负责结构连接。


164.23 经验不是简单统计

Experience同样不能简单理解为:

Success = 10
Failure = 2

统计数据可以成为经验形成的依据,但Experience本身还必须包含:

Condition + Action/Method + Result + Relation + Pattern

例如:

Condition:
Object = Smooth

Method:
Grip B

Result:
Success

Pattern:
Under Smooth Condition,
Grip B is effective.

因此Experience是具有条件约束的结构化经验。

这使Experience可以参与:

Method Selection

Decision

Capability Verification

Behavior Adjustment


164.24 Memory与Experience的生命周期

Memory可以具有:

Created → Stored → Recalled → Updated → Weakened → Archived

Experience可以具有:

Formed → Verified → Used → Confirmed → Revised → Archived

其中:

Memory强调:

保存与调用。

Experience强调:

形成、验证与修正。

例如某一Experience最初为:

Experience:
Method A is effective

经过新的Feedback:

Method A → Failure

系统不能简单删除过去经验。

而应该保留:

Old Experience
+
New Experience
+
Experience Relation

然后形成新的经验结构。

这使经验成为动态对象。


164.25 Memory、Experience与Learning

第163章已经建立:

Feedback → Experience

本章进一步建立:

Experience → Learning

完整过程为:

Behavior → Result → Feedback → Memory → Experience → Learning

Learning不应该直接从单个Result产生复杂知识。

而应该经过:

History → Memory → Relation → Experience → Verification → Learning

因此经验是连接行为系统与学习系统的重要中间层。


164.26 个体记忆认知闭环

综合前面章节,可以建立ICAI个体记忆闭环:

Behavior→Result→Feedback→History→Memory→MemoryRelation→Experience→ExperienceRelation→DecisionBehavior \rightarrow Result \rightarrow Feedback \rightarrow History \rightarrow Memory \rightarrow MemoryRelation \rightarrow Experience \rightarrow ExperienceRelation \rightarrow Decision

其含义是:

行为产生结果;

结果产生反馈;

反馈形成历史记录;

历史进入记忆;

记忆之间建立关系;

多个相关记忆形成经验;

经验之间建立关系;

经验重新参与下一次Decision。

最终:

过去行为 → 当前记忆 → 当前经验 → 当前决策 → 新行为

形成持续循环。


164.27 本章统一对象模型

最终可以建立五个核心对象:

Memory

保存过去可调用的信息。

Experience

保存经过组织和验证的经验结构。

History

记录过去发生的事实。

Memory Relation

建立Memory之间的关系。

Experience Relation

建立Experience之间的关系。

统一结构为:

History
   ↓
Memory
   ↓
Memory Relation
   ↓
Experience
   ↓
Experience Relation
   ↓
Decision

但需要特别注意:

History不是Memory的简单别名。

Memory不是Experience的简单别名。

Memory Relation不是Experience Relation的别名。

五个对象必须保持不同职责。


164.28 本章总结

第164章建立了ICAI的记忆与经验结构。

Memory解决:

“过去保存了什么?”

Experience解决:

“过去的行为告诉了我什么?”

History解决:

“过去具体发生了什么?”

Memory Relation解决:

“过去保存的信息之间有什么关系?”

Experience Relation解决:

“形成的经验之间有什么关系?”

因此形成:

History → Memory

表示历史事实进入记忆。

形成:

Memory → Memory Relation

表示记忆之间建立结构关系。

形成:

Memory + History → Experience

表示过去信息经过组织形成经验。

形成:

Experience → Experience Relation

表示经验之间建立更高层关系。

最终形成:

Behavior → Result → Feedback → History → Memory → Experience → Decision → Behavior

这条链路使ICAI第一次具备了真正意义上的个体连续性

一个行为不会随着Execution结束而消失。

它会留下:

History

形成:

Memory

进一步形成:

Experience

再通过:

Decision

影响下一次:

Behavior

因此个体不再是:

一次行为 → 一次结果 → 结束

而是:

过去行为 → 记忆 → 经验 → 当前决策 → 新行为 → 新结果 → 新反馈 → 新记忆 → 新经验

由此形成:

行为—反馈—记忆—经验—决策闭环。

这为后续的Memory Recall、Experience Learning、Knowledge、Learning Update以及个体认知持续运行机制建立了基础。

Leave a Reply

Your email address will not be published. Required fields are marked *