第259章 Runtime定义
第258章建立了 ICAI 控制台,其中 Runtime 监控负责观察机器个体的实际运行状态。
但是,Runtime 并不是简单的“运行时间”,也不是一个页面上的状态字段。
Runtime 是 ICAI 从启动、加载、处理、等待、执行、反馈,到停止的实际运行环境与持续运行过程。
因此,本章正式定义 ICAI Runtime。
本章主要研究:
- Runtime定义;
- Runtime对象;
- Runtime状态;
- Runtime周期。
核心模型:
Runtime={Object,State,Event,Process,Cycle}\boxed{ Runtime= \{Object,State,Event,Process,Cycle\} }
259.1 Runtime定义
Runtime(运行时)是机器个体在计算机环境中实际存在、加载、运行、处理信息、执行行为、产生状态变化并持续接受事件的运行过程。
简单来说:
Runtime 是机器个体从启动到停止期间实际发生的一切运行活动及其运行状态。
因此:
Runtime≠RunningRuntime\neq Running
Running只是 Runtime 的一种状态。
完整表示:
Runtime=RuntimeObject+RuntimeState+RuntimeEvent+RuntimeProcess+RuntimeCycleRuntime= RuntimeObject+ RuntimeState+ RuntimeEvent+ RuntimeProcess+ RuntimeCycle
259.2 Runtime的工程定义
从工程角度,Runtime 是 ICAI 的运行层。
理论层:
ICAI TheoryICAI\ Theory
经过工程实现:
ICAI Theory→DomainObject→Engine→RuntimeICAI\ Theory \rightarrow DomainObject \rightarrow Engine \rightarrow Runtime
Runtime负责将已经建立的:
- 个体;
- 对象;
- 状态;
- 认知;
- 能力;
- 方法;
- 行为;
- 记忆;
- 学习;
- 维护;
组织到实际运行过程中。
259.3 Runtime不是一个Engine
必须区分:
Runtime≠EngineRuntime\neq Engine
Engine负责某一领域的计算。
例如:
CognitiveEngineCognitiveEngine
负责认知计算。
BehaviorEngineBehaviorEngine
负责行为计算。
LearningEngineLearningEngine
负责学习计算。
MaintenanceEngineMaintenanceEngine
负责维护计算。
而 Runtime 负责组织这些 Engine 在实际运行过程中的执行。
因此:
Runtime→EngineRuntime \rightarrow Engine
而不是:
Runtime=EngineRuntime=Engine
259.4 Runtime不是数据库
同样:
Runtime≠MySQLRuntime\neq MySQL
MySQL负责持久化数据。
Runtime负责实际运行。
二者关系:
Runtime→Repository→MySQLRuntime \rightarrow Repository \rightarrow MySQL
运行过程中产生的状态、事件、结果可以保存到数据库:
RuntimeEvent→Repository→MySQLRuntimeEvent \rightarrow Repository \rightarrow MySQL
但数据库中的记录本身不是 Runtime。
259.5 Runtime不是页面
控制台可以显示 Runtime:
Runtime→RuntimeMonitor→ConsoleRuntime \rightarrow RuntimeMonitor \rightarrow Console
但是:
Runtime≠ConsoleRuntime\neq Console
控制台是观察和管理入口。
Runtime才是真正运行的过程。
259.6 Runtime核心对象
Runtime需要一个明确的 Runtime 对象。
定义:
RuntimeObject={ID,IndividualID,Process,State,Event,StartedAt,UpdatedAt,StoppedAt}RuntimeObject= \{ ID, IndividualID, Process, State, Event, StartedAt, UpdatedAt, StoppedAt \}
其中:
ID:Runtime实例标识;IndividualID:所属机器个体;Process:当前运行过程;State:当前运行状态;Event:当前或最近运行事件;StartedAt:启动时间;UpdatedAt:最近更新时间;StoppedAt:停止时间。
259.7 Runtime对象与Individual对象
必须区分:
RuntimeObject≠IndividualRuntimeObject\neq Individual
Individual描述:
机器个体是什么。
Runtime描述:
这个机器个体现在如何运行。
例如:
Individual
ID:
ICAI-001
Type:
Industrial
Name:
设备故障诊断个体
Runtime:
Runtime
ID:
RT-001
Individual:
ICAI-001
State:
Running
Process:
CognitiveProcessing
因此:
Individual=IdentityIndividual=Identity
而:
Runtime=ExecutionContextRuntime=ExecutionContext
259.8 一个Individual可以有多个Runtime实例
在生命周期管理中,同一个机器个体可能经历多个 Runtime 实例。
例如:
ICAI−001ICAI-001
第一次启动:
Runtime1Runtime_1
停止后再次启动:
Runtime2Runtime_2
因此:
Individual→Runtime1Individual \rightarrow Runtime_1
之后:
Individual→Runtime2Individual \rightarrow Runtime_2
所以:
RuntimeID≠IndividualIDRuntimeID\neq IndividualID
259.9 Runtime实例
可以定义:
RuntimeInstance={ID,IndividualID,Start,End,State,Result}RuntimeInstance= \{ID,IndividualID,Start,End,State,Result\}
例如:
Runtime-001
│
├── Individual: ICAI-001
├── Start: 09:00:00
├── End: 12:30:00
├── State: Stopped
└── Result: Normal
下一次运行:
Runtime-002
│
├── Individual: ICAI-001
├── Start: 13:00:00
├── End: ...
├── State: Running
└── Result: ...
这样可以保存机器个体的运行历史。
259.10 Runtime对象结构
完整 Runtime 对象:
RuntimeObject
│
├── Identity
│ ├── RuntimeID
│ └── IndividualID
│
├── Process
│ ├── CurrentProcess
│ └── ProcessState
│
├── State
│ ├── CurrentState
│ └── PreviousState
│
├── Event
│ ├── CurrentEvent
│ └── LastEvent
│
├── Time
│ ├── StartedAt
│ ├── UpdatedAt
│ └── StoppedAt
│
└── Result
├── CurrentResult
└── LastResult
259.11 Runtime状态定义
Runtime状态表示机器个体当前处于什么运行阶段。
定义:
RuntimeState={Code,Name,Time,Reason}RuntimeState= \{Code,Name,Time,Reason\}
状态是有限的离散状态集合。
例如:
S={Starting,Loading,Ready,Running,Waiting,Processing,Paused,Maintenance,Stopping,Stopped,Error}S= \{ Starting, Loading, Ready, Running, Waiting, Processing, Paused, Maintenance, Stopping, Stopped, Error \}
259.12 Starting状态
Starting表示 Runtime 已经收到启动请求,正在建立运行环境。
流程:
StartRequest→StartingStartRequest \rightarrow Starting
此阶段可能完成:
- 创建 Runtime;
- 初始化运行参数;
- 加载机器个体;
- 检查基础环境。
259.13 Loading状态
加载状态表示正在从持久化层或运行环境读取机器个体数据。
Starting→LoadingStarting \rightarrow Loading
加载内容可能包括:
Individual
Object
State
Knowledge
Goal
Capability
Method
Memory
Experience
加载完成:
Loading→ReadyLoading \rightarrow Ready
259.14 Ready状态
Ready表示 Runtime 已经完成初始化,可以接受运行任务。
ReadyReady
并不代表正在执行。
因此:
Ready≠RunningReady\neq Running
例如:
Runtime:
Ready
Process:
None
CurrentAction:
None
259.15 Running状态
Running表示 Runtime 当前处于正常运行状态。
Ready→RunningReady \rightarrow Running
此时可以进行:
Input→Cognition→Decision→BehaviorInput \rightarrow Cognition \rightarrow Decision \rightarrow Behavior
259.16 Waiting状态
当 Runtime 暂时没有需要执行的处理任务时,可以进入:
WaitingWaiting
例如:
Runtime:
Waiting
CurrentProcess:
None
Reason:
Waiting for input
因此:
Waiting≠StoppedWaiting\neq Stopped
Waiting仍然属于运行过程。
259.17 Processing状态
当 Runtime 正在执行具体计算时:
Running→ProcessingRunning \rightarrow Processing
例如:
Process:
CognitiveProcessing
或者:
Process:
BehaviorExecution
处理完成:
Processing→RunningProcessing \rightarrow Running
259.18 Paused状态
如果运行被暂时挂起:
Running→PausedRunning \rightarrow Paused
恢复:
Paused→RunningPaused \rightarrow Running
Paused并不意味着 Runtime 已经停止。
259.19 Maintenance状态
当系统正在进行自我维护:
Running→MaintenanceRunning \rightarrow Maintenance
例如:
Runtime:
Maintenance
Reason:
Method-A abnormal
Diagnosis:
Method-A invalid
Repair:
Switch to Method-B
修复完成:
Maintenance→RunningMaintenance \rightarrow Running
259.20 Stopping状态
收到停止请求:
Running→StoppingRunning \rightarrow Stopping
此阶段需要:
- 停止当前任务;
- 保存必要状态;
- 保存 Runtime 事件;
- 保存运行结果;
- 释放运行资源。
完成后:
Stopping→StoppedStopping \rightarrow Stopped
259.21 Stopped状态
Stopped表示 Runtime 已经结束。
StoppedStopped
不是错误状态。
例如:
Runtime:
Stopped
Reason:
Normal Shutdown
因此:
Stopped≠ErrorStopped\neq Error
259.22 Error状态
当 Runtime自身无法继续正常运行时:
Running→ErrorRunning \rightarrow Error
例如:
Runtime Error
Cause:
Required runtime object unavailable
之后可以进入:
Error→DiagnosisError \rightarrow Diagnosis
或者:
Error→MaintenanceError \rightarrow Maintenance
259.23 Runtime状态转换
Runtime状态转换可以表示为:
Statet→EventStatet+1State_t \xrightarrow{Event} State_{t+1}
例如完整启动:
Starting→Loading→Ready→RunningStarting \rightarrow Loading \rightarrow Ready \rightarrow Running
正常运行:
Running→Processing→RunningRunning \rightarrow Processing \rightarrow Running
等待:
Running→WaitingRunning \rightarrow Waiting
继续:
Waiting→RunningWaiting \rightarrow Running
维护:
Running→Maintenance→RunningRunning \rightarrow Maintenance \rightarrow Running
停止:
Running→Stopping→StoppedRunning \rightarrow Stopping \rightarrow Stopped
异常:
Running→ErrorRunning \rightarrow Error
259.24 Runtime状态机
因此可以建立:
RuntimeStateMachineRuntimeStateMachine
结构:
Starting
↓
Loading
↓
Ready
↓
Running
↙ ↓ ↘
Waiting Processing Maintenance
↘ ↓ ↙
Running
↓
Stopping
↓
Stopped
Running ───────→ Error
Error ─────────→ Maintenance
这是真正的离散状态机,而不是模糊的“正在运行”。
259.25 Runtime事件
Runtime状态变化由事件触发。
定义:
Event={ID,Type,Object,Time,Data}Event= \{ID,Type,Object,Time,Data\}
例如:
StartRequested
LoadCompleted
InputReceived
CognitionStarted
CognitionCompleted
DecisionCreated
BehaviorStarted
ActionStarted
ActionCompleted
FeedbackCreated
LearningStarted
LearningCompleted
MaintenanceStarted
RepairCompleted
StopRequested
RuntimeError
259.26 Runtime事件与状态
事件负责触发状态变化。
例如:
StartRequested⇒StartingStartRequested \Rightarrow Starting LoadCompleted⇒ReadyLoadCompleted \Rightarrow Ready ProcessingStarted⇒ProcessingProcessingStarted \Rightarrow Processing ProcessingCompleted⇒RunningProcessingCompleted \Rightarrow Running StopRequested⇒StoppingStopRequested \Rightarrow Stopping
因此:
Event→StateTransitionEvent \xrightarrow{} StateTransition
259.27 Runtime进程对象
Runtime还需要表示当前执行的过程。
定义:
RuntimeProcess={ID,Type,Object,Status,StartedAt,CompletedAt,Result}RuntimeProcess= \{ ID, Type, Object, Status, StartedAt, CompletedAt, Result \}
例如:
Process-001
Type:
CognitiveProcessing
Object:
Device-A
Status:
Running
StartedAt:
10:30:01
259.28 RuntimeProcess与Engine
Engine负责计算:
Engine(Input)→ResultEngine(Input) \rightarrow Result
Runtime负责组织执行:
Runtime→Engine→ResultRuntime \rightarrow Engine \rightarrow Result
因此:
RuntimeProcess≠EngineRuntimeProcess\neq Engine
例如:
RuntimeProcess:
CognitiveProcessing
Engine:
CognitiveEngine
二者职责不同。
259.29 Runtime周期
Runtime周期(Runtime Cycle)表示一个机器个体从启动到停止所经历的完整运行过程。
定义:
RuntimeCycle={Start,Load,Ready,Run,Process,Feedback,Maintain,Stop}RuntimeCycle= \{Start,Load,Ready,Run,Process,Feedback,Maintain,Stop\}
基本周期:
Start→Load→Ready→Run→Process→Feedback→Run→Stop\boxed{ Start \rightarrow Load \rightarrow Ready \rightarrow Run \rightarrow Process \rightarrow Feedback \rightarrow Run \rightarrow Stop }
259.30 Runtime启动周期
第一阶段:
StartStart
Runtime创建实例:
Create(Runtime)Create(Runtime)
然后:
RuntimeState=StartingRuntimeState=Starting
形成:
StartRequest→CreateRuntime→StartingStartRequest \rightarrow CreateRuntime \rightarrow Starting
259.31 Runtime加载周期
启动后加载机器个体:
Starting→LoadingStarting \rightarrow Loading
加载:
Individual+State+Memory+Capability+MethodIndividual + State + Memory + Capability + Method
加载完成:
Loading→ReadyLoading \rightarrow Ready
259.32 Runtime准备周期
Ready状态建立运行条件:
ReadyReady
检查:
- 个体是否存在;
- Runtime对象是否有效;
- 必要能力是否存在;
- 必要方法是否有效;
- Runtime配置是否有效;
- 数据是否完整。
如果满足:
Ready→RunningReady\rightarrow Running
否则:
Ready→ErrorReady\rightarrow Error
259.33 Runtime运行周期
进入:
RunningRunning
之后接受输入或事件:
Event→ProcessEvent \rightarrow Process
例如:
Input→CognitionInput \rightarrow Cognition
然后:
Cognition→DecisionCognition \rightarrow Decision
再:
Decision→BehaviorDecision \rightarrow Behavior
259.34 Runtime处理周期
处理过程:
Running→ProcessingRunning \rightarrow Processing
具体可以执行:
CognitionCognition MatchingMatching DecisionDecision BehaviorBehavior ActionAction LearningLearning MaintenanceMaintenance
完成以后:
Processing→RunningProcessing \rightarrow Running
259.35 Runtime反馈周期
行为产生结果:
Action→ResultAction \rightarrow Result
结果进入:
FeedbackFeedback
然后:
Feedback→MemoryFeedback \rightarrow Memory
因此 Runtime 可以记录:
Action
↓
Result
↓
Feedback
↓
Memory
259.36 Runtime学习周期
如果反馈满足学习条件:
Feedback→LearningFeedback \rightarrow Learning
学习:
Learning→UpdateLearning \rightarrow Update
更新完成:
Update→VerificationUpdate \rightarrow Verification
验证成功:
Verification→RunningVerification \rightarrow Running
因此:
Runtime→Learning→RuntimeRuntime \rightarrow Learning \rightarrow Runtime
259.37 Runtime维护周期
如果发现异常:
Detection→AnomalyDetection \rightarrow Anomaly
进入:
DiagnosisDiagnosis
然后:
RepairRepair
验证:
VerificationVerification
最终:
Maintenance→RunningMaintenance \rightarrow Running
因此:
Runtime→Maintenance→RuntimeRuntime \rightarrow Maintenance \rightarrow Runtime
259.38 Runtime停止周期
收到停止事件:
StopRequestedStopRequested
进入:
StoppingStopping
保存:
- 当前状态;
- 运行结果;
- 运行事件;
- 必要记忆;
- Runtime历史。
然后:
Stopping→StoppedStopping \rightarrow Stopped
259.39 Runtime完整周期
因此一个完整 Runtime:
Starting→Loading→Ready→Running\boxed{ Starting \rightarrow Loading \rightarrow Ready \rightarrow Running }
运行过程中:
Running→Processing→Running\boxed{ Running \rightarrow Processing \rightarrow Running }
学习:
Running→Learning→Running\boxed{ Running \rightarrow Learning \rightarrow Running }
维护:
Running→Maintenance→Running\boxed{ Running \rightarrow Maintenance \rightarrow Running }
结束:
Running→Stopping→Stopped\boxed{ Running \rightarrow Stopping \rightarrow Stopped }
259.40 Runtime主循环
Runtime可以抽象为一个主循环:
while Runtime is active:
receive Event
determine Runtime State
select Process
execute Process
produce Result
update State
record Event
check Learning
check Maintenance
continue
形式化:
RuntimeLoop=Receive→Determine→Process→Result→Update→Record→Check→ContinueRuntimeLoop= Receive \rightarrow Determine \rightarrow Process \rightarrow Result \rightarrow Update \rightarrow Record \rightarrow Check \rightarrow Continue
259.41 Runtime与ICAI完整结构
Runtime把前面的 ICAI 模块真正连接起来:
Runtime→CognitionEngineRuntime \rightarrow CognitionEngine Runtime→CapabilityEngineRuntime \rightarrow CapabilityEngine Runtime→DecisionEngineRuntime \rightarrow DecisionEngine Runtime→BehaviorEngineRuntime \rightarrow BehaviorEngine Runtime→LearningEngineRuntime \rightarrow LearningEngine Runtime→MaintenanceEngineRuntime \rightarrow MaintenanceEngine
这些 Engine 都属于 Runtime 中的执行对象。
259.42 Runtime完整运行模型
因此:
Runtime→Input→Cognition→Need→Goal→Capability→Matching→Method→Decision→Behavior→Action→Result\boxed{ Runtime \rightarrow Input \rightarrow Cognition \rightarrow Need \rightarrow Goal \rightarrow Capability \rightarrow Matching \rightarrow Method \rightarrow Decision \rightarrow Behavior \rightarrow Action \rightarrow Result }
结果继续:
Result→Feedback→Memory→Experience→Learning→UpdateResult \rightarrow Feedback \rightarrow Memory \rightarrow Experience \rightarrow Learning \rightarrow Update
如果发生异常:
Detection→Risk/Conflict/Anomaly→Diagnosis→Repair→VerificationDetection \rightarrow Risk/Conflict/Anomaly \rightarrow Diagnosis \rightarrow Repair \rightarrow Verification
最终重新进入:
RuntimeRuntime
259.43 Runtime与时间
Runtime天然具有时间属性。
至少需要:
StartTimeStartTime UpdateTimeUpdateTime EndTimeEndTime
因此:
RuntimeDuration=EndTime−StartTimeRuntimeDuration= EndTime-StartTime
如果 Runtime 仍在运行:
RuntimeDuration=CurrentTime−StartTimeRuntimeDuration= CurrentTime-StartTime
因此 Runtime 不只是状态,也是一个时间连续过程。
259.44 Runtime历史
每一次 Runtime 都可以产生运行历史:
RuntimeHistory={Runtime,Event,State,Process,Result,Time}RuntimeHistory= \{Runtime,Event,State,Process,Result,Time\}
例如:
09:00:00 Starting
09:00:01 Loading
09:00:02 Ready
09:00:03 Running
09:00:05 Processing
09:00:08 Result
09:00:09 Feedback
09:00:10 Running
09:30:00 Stopping
09:30:01 Stopped
这样可以追踪一个机器个体到底经历了什么。
259.45 Runtime与Memory
Runtime历史可以进入 Memory:
RuntimeEvent→MemoryRuntimeEvent \rightarrow Memory
例如:
Memory:
Runtime-001
Behavior-001
Action-003
Result=TemperatureHigh
之后可以用于:
ExperienceExperience
以及:
LearningLearning
因此:
Runtime→Memory→Experience→LearningRuntime \rightarrow Memory \rightarrow Experience \rightarrow Learning
259.46 Runtime与Maintenance
Runtime不仅产生正常事件,也可以产生异常事件。
例如:
RuntimeState=RunningRuntimeState=Running
但:
ProcessProcess
长时间没有完成。
检测:
RuntimeAnomalyRuntimeAnomaly
然后:
DiagnosisDiagnosis
最终:
RepairRepair
因此 Runtime 本身也是自我维护的检测对象。
259.47 Runtime与控制台
第258章的控制台通过 Runtime Monitor 观察:
RuntimeObjectRuntimeObject RuntimeStateRuntimeState RuntimeProcessRuntimeProcess RuntimeEventRuntimeEvent RuntimeHistoryRuntimeHistory
因此:
Runtime→RuntimeMonitor→ICAIConsoleRuntime \rightarrow RuntimeMonitor \rightarrow ICAIConsole
控制台只是 Runtime 的观察窗口。
259.48 Runtime工程结构
工程上可以建立:
app/
├── runtime/
│ ├── Runtime.php
│ ├── RuntimeState.php
│ ├── RuntimeEvent.php
│ ├── RuntimeProcess.php
│ ├── RuntimeCycle.php
│ └── RuntimeManager.php
│
├── engines/
│ ├── CognitiveEngine.php
│ ├── BehaviorEngine.php
│ ├── LearningEngine.php
│ └── MaintenanceEngine.php
│
├── services/
│ └── RuntimeService.php
│
└── controllers/
└── RuntimeController.php
259.49 Runtime类
可以建立基础 Runtime Domain Object:
class Runtime
{
protected $id;
protected $individualId;
protected $state;
protected $process;
protected $startedAt;
protected $updatedAt;
protected $stoppedAt;
public function __construct($id, $individualId)
{
$this->id = $id;
$this->individualId = $individualId;
$this->state = 'starting';
$this->process = null;
$this->startedAt = date('Y-m-d H:i:s');
$this->updatedAt = $this->startedAt;
$this->stoppedAt = null;
}
public function getId()
{
return $this->id;
}
public function getIndividualId()
{
return $this->individualId;
}
public function getState()
{
return $this->state;
}
public function setState($state)
{
$this->state = $state;
$this->updatedAt = date('Y-m-d H:i:s');
}
public function getProcess()
{
return $this->process;
}
public function setProcess($process)
{
$this->process = $process;
$this->updatedAt = date('Y-m-d H:i:s');
}
}
这个类表示:
RuntimeObjectRuntimeObject
而不是整个 Runtime 系统。
259.50 RuntimeManager
RuntimeManager负责管理 Runtime 生命周期。
基本方法:
class RuntimeManager
{
public function start(Runtime $runtime)
{
$runtime->setState('starting');
$runtime->setState('loading');
$runtime->setState('ready');
$runtime->setState('running');
return $runtime;
}
public function stop(Runtime $runtime)
{
$runtime->setState('stopping');
$runtime->setState('stopped');
return $runtime;
}
}
这里表达的是:
Start→Starting→Loading→Ready→RunningStart \rightarrow Starting \rightarrow Loading \rightarrow Ready \rightarrow Running
以及:
Stop→Stopping→StoppedStop \rightarrow Stopping \rightarrow Stopped
259.51 Runtime对象与RuntimeManager
二者职责必须区分:
RuntimeObjectRuntimeObject
保存 Runtime 状态。
RuntimeManagerRuntimeManager
控制 Runtime 生命周期。
因此:
RuntimeObject≠RuntimeManagerRuntimeObject\neq RuntimeManager
类似于:
DomainObject≠EngineDomainObject\neq Engine
259.52 Runtime与MVC
Runtime也可以进入 MVC:
Browser→RuntimeController→RuntimeService→RuntimeManagerBrowser \rightarrow RuntimeController \rightarrow RuntimeService \rightarrow RuntimeManager
如果需要保存:
RuntimeManager→Runtime→Repository→MySQLRuntimeManager \rightarrow Runtime \rightarrow Repository \rightarrow MySQL
页面返回:
Runtime→ViewData→Smarty→HTMLRuntime \rightarrow ViewData \rightarrow Smarty \rightarrow HTML
259.53 Runtime与Repository
Runtime历史需要持久化时:
Runtime→RepositoryRuntime \rightarrow Repository
Repository可以保存:
runtime
runtime_events
runtime_processes
runtime_history
例如:
runtime_events
id
runtime_id
event_type
state
process
result
created_at
这样可以保存完整运行轨迹。
259.54 Runtime数据生命周期
Runtime本身也具有生命周期:
Create→Initialize→Load→Run→Stop→DestroyCreate \rightarrow Initialize \rightarrow Load \rightarrow Run \rightarrow Stop \rightarrow Destroy
注意:
RuntimeLifecycle≠IndividualLifecycleRuntimeLifecycle\neq IndividualLifecycle
一个 Individual 可以长期存在,而多个 Runtime 可以先后运行。
例如:
Individual→Runtime1→StoppedIndividual \rightarrow Runtime_1 \rightarrow Stopped
然后:
Individual→Runtime2→RunningIndividual \rightarrow Runtime_2 \rightarrow Running
259.55 Runtime周期与Individual生命周期
Individual生命周期描述:
机器个体本身的生命周期。
Runtime周期描述:
某一次具体运行过程。
因此:
IndividualLifecycle⊃RuntimeLifecycleIndividualLifecycle \supset RuntimeLifecycle
一个长期存在的 ICAI 个体可以经历:
Runtime1→Runtime2→Runtime3→⋯Runtime_1 \rightarrow Runtime_2 \rightarrow Runtime_3 \rightarrow \cdots
259.56 Runtime周期与学习周期
学习周期:
Feedback→Memory→Experience→Learning→UpdateFeedback \rightarrow Memory \rightarrow Experience \rightarrow Learning \rightarrow Update
Runtime周期:
Running→Processing→RunningRunning \rightarrow Processing \rightarrow Running
因此学习只是 Runtime 中的一类处理周期。
LearningCycle⊂RuntimeCycleLearningCycle\subset RuntimeCycle
259.57 Runtime周期与维护周期
同理:
MaintenanceCycle⊂RuntimeCycleMaintenanceCycle\subset RuntimeCycle
即:
Detection→Diagnosis→Repair→VerificationDetection \rightarrow Diagnosis \rightarrow Repair \rightarrow Verification
发生在 Runtime 内部。
因此:
Runtime⊃LearningRuntime \supset Learning Runtime⊃MaintenanceRuntime \supset Maintenance Runtime⊃BehaviorRuntime \supset Behavior Runtime⊃CognitionRuntime \supset Cognition
259.58 Runtime统一执行模型
因此可以建立:
Runtime=CognitionCycle+BehaviorCycle+LearningCycle+MaintenanceCycle\boxed{ Runtime = CognitionCycle + BehaviorCycle + LearningCycle + MaintenanceCycle }
但这里的“+”表示多个运行子周期组成 Runtime,而不是简单的数值加法。
完整运行结构:
Runtime
│
├── Cognition Cycle
│
├── Capability / Matching Cycle
│
├── Decision Cycle
│
├── Behavior Cycle
│
├── Learning Cycle
│
└── Maintenance Cycle
259.59 Runtime核心边界
本章必须明确:
Runtime≠IndividualRuntime\neq Individual Runtime≠EngineRuntime\neq Engine Runtime≠ServiceRuntime\neq Service Runtime≠RepositoryRuntime\neq Repository Runtime≠MySQLRuntime\neq MySQL Runtime≠ConsoleRuntime\neq Console RuntimeState≠DomainStateRuntimeState\neq DomainState RuntimeEvent≠DomainEventRuntimeEvent\neq DomainEvent RuntimeProcess≠EngineRuntimeProcess\neq Engine RuntimeCycle≠IndividualLifecycleRuntimeCycle\neq IndividualLifecycle
这些边界使 Runtime 成为独立的工程概念。
259.60 ICAI Runtime完整模型
最终可以将 Runtime 定义为:
Runtime={Individual,Object,State,Process,Event,Result,Time,Cycle}\boxed{ Runtime= \{ Individual, Object, State, Process, Event, Result, Time, Cycle \} }
其中:
IndividualIndividual
确定运行主体。
ObjectObject
确定当前处理对象。
StateState
确定当前运行状态。
ProcessProcess
确定正在执行的运行过程。
EventEvent
确定状态变化的触发事件。
ResultResult
确定当前处理结果。
TimeTime
确定运行时间。
CycleCycle
确定持续运行过程。
259.61 Runtime完整周期
最终形成:
Start→Load→Ready→Running→Processing→Result→Feedback→Running\boxed{ Start \rightarrow Load \rightarrow Ready \rightarrow Running \rightarrow Processing \rightarrow Result \rightarrow Feedback \rightarrow Running }
发生学习:
Running→Learning→Update→RunningRunning \rightarrow Learning \rightarrow Update \rightarrow Running
发生维护:
Running→Maintenance→Repair→Verification→RunningRunning \rightarrow Maintenance \rightarrow Repair \rightarrow Verification \rightarrow Running
最终停止:
Running→Stopping→StoppedRunning \rightarrow Stopping \rightarrow Stopped
因此:
RuntimeCycle=Start→Load→Ready→Run→Process→Feedback→Learn/Maintain→Run→Stop\boxed{ RuntimeCycle= Start \rightarrow Load \rightarrow Ready \rightarrow Run \rightarrow Process \rightarrow Feedback \rightarrow Learn/Maintain \rightarrow Run \rightarrow Stop }
259.62 本章小结
Runtime 是 ICAI 的实际运行层。
它回答的不是:
机器个体是什么?
而是:
机器个体现在如何运行?
因此:
Individual=WhatIndividual=What Runtime=How it runsRuntime=How\ it\ runs
Runtime的核心对象:
RuntimeObjectRuntimeObject
Runtime的核心状态:
RuntimeStateRuntimeState
Runtime的核心事件:
RuntimeEventRuntimeEvent
Runtime的核心过程:
RuntimeProcessRuntimeProcess
Runtime的核心周期:
RuntimeCycleRuntimeCycle
完整模型:
Runtime=Object+State+Event+Process+Cycle\boxed{ Runtime= Object+ State+ Event+ Process+ Cycle }
完整状态:
Starting→Loading→Ready→Running→Processing→Running→Stopping→Stopped\boxed{ Starting \rightarrow Loading \rightarrow Ready \rightarrow Running \rightarrow Processing \rightarrow Running \rightarrow Stopping \rightarrow Stopped }
如果出现学习:
Running→Learning→RunningRunning \rightarrow Learning \rightarrow Running
如果出现维护:
Running→Maintenance→RunningRunning \rightarrow Maintenance \rightarrow Running
如果出现异常:
Running→Error→Diagnosis→Repair→Verification→RunningRunning \rightarrow Error \rightarrow Diagnosis \rightarrow Repair \rightarrow Verification \rightarrow Running
最终形成 ICAI 的 Runtime 基础:
Individual→Runtime→Cognition→Behavior→Learning→Maintenance→Runtime\boxed{ Individual \rightarrow Runtime \rightarrow Cognition \rightarrow Behavior \rightarrow Learning \rightarrow Maintenance \rightarrow Runtime }
Runtime因此成为连接机器个体、认知、行为、学习、自我维护和持续运行的核心工程层。