From ab0cdf47f453bf3e12df0201cd7bd1835fb03cae Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Sat, 19 Sep 2026 18:47:24 +0800 Subject: fix: M3c 关系半衰期单位错误 86400L(=24模拟分钟)→ticksPerDay(1模拟日=5,184,000tick) + 衰减改真半衰 exp(-ln2*age/halfLife)(age=halfLife 处权重恰0.5, 旧式 exp(-age/halfLife) 为 e^-1≈0.368) + 单测锁定(1天=5184000tick/halfLife=1天/半衰权重0.5, 手算期望随真半衰语义更新) + headless 批验新增旧判据 old_crit 观测报告(60% 覆盖判据保留为门) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LivingVillage.Kernel/Sim.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/LivingVillage.Kernel') diff --git a/src/LivingVillage.Kernel/Sim.fs b/src/LivingVillage.Kernel/Sim.fs index ebc435e..33f2b57 100644 --- a/src/LivingVillage.Kernel/Sim.fs +++ b/src/LivingVillage.Kernel/Sim.fs @@ -120,7 +120,7 @@ module Sim = let chatValence = 0.3f // 关系网派生(纯函数;仅在 dump/视图打开时调用,不进 step 热路径) - let relationHalfLifeTicks = 86400L // HALF_LIFE = 1 天(86400 tick) + let relationHalfLifeTicks = ticksPerDay // HALF_LIFE = 1 模拟日(修复单位错误:原 86400L 实为 24 模拟分钟;1 模拟日 = ticksPerDay = 5,184,000 tick) let relationThreshold = 0.5f // |rel| > 0.5 视为有关系 let clamp (v: float32) (lo: float32) (hi: float32) : float32 = if v < lo then lo elif v > hi then hi else v @@ -434,11 +434,11 @@ module Sim = Npcs = newNpcs Events = [] } - // ---- 关系网派生:rel(i,j) = sum(Chatted valence * exp(-(now-tick)/HALF_LIFE)) ---- + // ---- 关系网派生:rel(i,j) = sum(Chatted valence * exp(-ln2*(now-tick)/HALF_LIFE))(真半衰:age=HALF_LIFE 处权重恰 0.5)---- let relationDecayWeight (nowTick: int64) (eventTick: int64) : float32 = let age = float (nowTick - eventTick) - float32 (exp (-age / float relationHalfLifeTicks)) + float32 (exp (-(log 2.0) * age / float relationHalfLifeTicks)) // 30x30 对称矩阵(对角线 0):双向累加双方 Chatted 记忆的衰减 valence let relationMatrix (world: World) : float32[,] = -- cgit v1.2.3